Class CwtSwtGraphicsContext

java.lang.Object
de.intarsys.cwt.swt.environment.CwtSwtGraphicsContext
All Implemented Interfaces:
IGraphicsContext

public class CwtSwtGraphicsContext extends Object implements IGraphicsContext
An IGraphicsContext mapping to SWT.

It is currently not safe to use this IGraphicsContext concurrently.

  • Constructor Details

    • CwtSwtGraphicsContext

      public CwtSwtGraphicsContext(org.eclipse.swt.graphics.GC paramGC, org.eclipse.swt.graphics.Device paramDevice)
  • Method Details

    • toPath

      public static org.eclipse.swt.graphics.Path toPath(org.eclipse.swt.graphics.Device device, PathIterator pathIterator)
    • toRectangle2D

      public static Rectangle2D toRectangle2D(org.eclipse.swt.graphics.Rectangle rect)
    • toTransform

      public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, AffineTransform at)
      This methods intentionally duplicated to avoid compile time dependency..
    • toTransform

      public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Transform st, AffineTransform at)
      This methods intentionally duplicated to avoid compile time dependency..
    • applyAlphaBackground

      protected void applyAlphaBackground()
    • applyAlphaForeground

      protected void applyAlphaForeground()
    • applyClip

      protected void applyClip()
    • applyTransform

      protected void applyTransform()
    • clip

      public void clip(Shape shape)
      Description copied from interface: IGraphicsContext
      Clip the subsequent drawing operations to the shape. This adds the new clip shape to the existing one.
      Specified by:
      clip in interface IGraphicsContext
      Parameters:
      shape -
    • createPath

      protected org.eclipse.swt.graphics.Path createPath(Shape s)
    • dispose

      public void dispose()
      Description copied from interface: IGraphicsContext
      Dispose the current context and all its resources.
      Specified by:
      dispose in interface IGraphicsContext
    • draw

      public void draw(Shape s)
      Description copied from interface: IGraphicsContext
      Draw s using the current graphics context state.
      Specified by:
      draw in interface IGraphicsContext
      Parameters:
      s -
    • drawImage

      public void drawImage(IImage image, float x, float y)
      Description copied from interface: IGraphicsContext
      Draw image image at coordinates x, y.
      Specified by:
      drawImage in interface IGraphicsContext
      Parameters:
      image -
      x -
      y -
    • drawString

      public void drawString(String s, float x, float y)
      Description copied from interface: IGraphicsContext
      Draw a plain text string in the graphics.
      Specified by:
      drawString in interface IGraphicsContext
      Parameters:
      s -
      x -
      y -
    • fill

      public void fill(Shape s)
      Description copied from interface: IGraphicsContext
      Fill s using the current graphics context state.
      Specified by:
      fill in interface IGraphicsContext
      Parameters:
      s -
    • getBackgroundColor

      public Color getBackgroundColor()
      Description copied from interface: IGraphicsContext
      The current background color.
      Specified by:
      getBackgroundColor in interface IGraphicsContext
      Returns:
    • getBlendMode

      public BlendMode getBlendMode()
    • getClip

      public Shape getClip()
      Description copied from interface: IGraphicsContext
      The current clip.
      Specified by:
      getClip in interface IGraphicsContext
      Returns:
    • getDevice

      public org.eclipse.swt.graphics.Device getDevice()
    • getFont

      public Font getFont()
    • getFontRenderContext

      public FontRenderContext getFontRenderContext()
    • getForegroundColor

      public Color getForegroundColor()
      Description copied from interface: IGraphicsContext
      The current foregroumd color.
      Specified by:
      getForegroundColor in interface IGraphicsContext
      Returns:
    • getGc

      public org.eclipse.swt.graphics.GC getGc()
    • getGraphicsEnvironment

      public IGraphicsEnvironment getGraphicsEnvironment()
      Description copied from interface: IGraphicsContext
      The associated IGraphicsEnvironment
      Specified by:
      getGraphicsEnvironment in interface IGraphicsContext
      Returns:
    • getRenderingHints

      public RenderingHints getRenderingHints()
      Description copied from interface: IGraphicsContext
      The current RenderingHints
      Specified by:
      getRenderingHints in interface IGraphicsContext
      Returns:
    • getTransform

      public AffineTransform getTransform()
      Description copied from interface: IGraphicsContext
      The transformatiom currentlz active.
      Specified by:
      getTransform in interface IGraphicsContext
      Returns:
    • getTransformationValues

      protected float[] getTransformationValues(AffineTransform tx)
    • resetAdvanced

      public void resetAdvanced()
    • rotate

      public void rotate(float theta)
      Description copied from interface: IGraphicsContext
      Rotate the currently active transformation by theta.
      Specified by:
      rotate in interface IGraphicsContext
      Parameters:
      theta -
    • scale

      public void scale(float x, float y)
      Description copied from interface: IGraphicsContext
      Scale the currently active transformation by x, y
      Specified by:
      scale in interface IGraphicsContext
    • setBackgroundColor

      public void setBackgroundColor(Color color)
      Description copied from interface: IGraphicsContext
      Assign a new background color.
      Specified by:
      setBackgroundColor in interface IGraphicsContext
      Parameters:
      color -
    • setBackgroundColor

      public void setBackgroundColor(org.eclipse.swt.graphics.Color resource)
    • setBackgroundPaint

      public void setBackgroundPaint(IPaint paint)
      Description copied from interface: IGraphicsContext
      Assign a new background IPaint.
      Specified by:
      setBackgroundPaint in interface IGraphicsContext
      Parameters:
      paint -
    • setBackgroundPattern

      public void setBackgroundPattern(org.eclipse.swt.graphics.Pattern resource)
    • setBlendMode

      public void setBlendMode(BlendMode blendMode)
    • setClip

      public void setClip(Shape shape)
      Description copied from interface: IGraphicsContext
      Assign the new shape as the clipping shape.
      Specified by:
      setClip in interface IGraphicsContext
      Parameters:
      shape -
    • setFont

      public void setFont(Font awtFont)
      Description copied from interface: IGraphicsContext
      Set the current font for writing plain text in the graphics.
      Specified by:
      setFont in interface IGraphicsContext
      Parameters:
      awtFont -
    • setForegroundColor

      public void setForegroundColor(Color color)
      Description copied from interface: IGraphicsContext
      Assign a new foreground color.
      Specified by:
      setForegroundColor in interface IGraphicsContext
      Parameters:
      color -
    • setForegroundColor

      public void setForegroundColor(org.eclipse.swt.graphics.Color resource)
    • setForegroundPaint

      public void setForegroundPaint(IPaint paint)
      Description copied from interface: IGraphicsContext
      Assign a new foreground IPaint
      Specified by:
      setForegroundPaint in interface IGraphicsContext
      Parameters:
      paint -
    • setForegroundPattern

      public void setForegroundPattern(org.eclipse.swt.graphics.Pattern resource)
    • setRenderingHint

      public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
      Description copied from interface: IGraphicsContext
      Set a specific rendering hint.
      Specified by:
      setRenderingHint in interface IGraphicsContext
      Parameters:
      hintKey -
      hintValue -
    • setRenderingHints

      public void setRenderingHints(Map hints)
      Description copied from interface: IGraphicsContext
      Assign the currently active rendering hints.
      Specified by:
      setRenderingHints in interface IGraphicsContext
      Parameters:
      hints -
    • setStroke

      public void setStroke(Stroke s)
      Description copied from interface: IGraphicsContext
      Assign the currently active Stroke
      Specified by:
      setStroke in interface IGraphicsContext
      Parameters:
      s -
    • setTransform

      public void setTransform(AffineTransform pTransform)
      Description copied from interface: IGraphicsContext
      Set the currently active AffineTransform
      Specified by:
      setTransform in interface IGraphicsContext
      Parameters:
      pTransform -
    • textExtent

      public Point textExtent(String s)
    • transform

      public void transform(AffineTransform deltaTransform)
      Description copied from interface: IGraphicsContext
      Transform the IGraphicsEnvironment by transform
      Specified by:
      transform in interface IGraphicsContext
      Parameters:
      deltaTransform -
    • translate

      public void translate(float x, float y)
      Description copied from interface: IGraphicsContext
      translate the currently active transformation by x, y
      Specified by:
      translate in interface IGraphicsContext