Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class SWTGraphics

java.lang.Object
  extended by

org.eclipse.draw2d.Graphics
      extended by
org.eclipse.draw2d.SWTGraphics

public class SWTGraphics
extends Graphics

A concrete implementation of Graphics using an SWT GC. There are 2 states contained in this graphics class -- the applied state which is the actual state of the GC and the current state which is the current state of this graphics object. Certain properties can be changed multiple times and the GC won't be updated until it's actually used.

WARNING: This class is not intended to be subclassed.


Field Summary
 
Fields inherited from class org.eclipse.draw2d. Graphics
LINE_CUSTOM, LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID
 
Constructor Summary
SWTGraphics (GC gc)
          Constructs a new SWTGraphics that draws to the Canvas using the given GC.
 
Method Summary
protected  void checkFill ()
          If the background color has changed, this change will be pushed to the GC.
protected  void checkGC ()
          If the rendering hints or the clip region has changed, these changes will be pushed to the GC.
protected  void checkPaint ()
          If the line width, line style, foreground or background colors have changed, these changes will be pushed to the GC.
protected  void checkText ()
          If the font has changed, this change will be pushed to the GC.
 void clipRect ( Rectangle rect)
          Sets the clip region to the given rectangle.
 void dispose ()
          Disposes this object, releasing any resources.
 void drawArc (int x, int y, int width, int height, int offset, int length)
          Draws the outline of an arc located at (x,y) with width w and height h.
 void drawFocus (int x, int y, int w, int h)
          Draws a focus rectangle.
 void drawImage (Image srcImage, int x, int y)
          Draws the given Image at the location (x,y).
 void drawImage (Image srcImage, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
          Draws a rectangular section of the given Image to the specified rectangular reagion on the canvas.
 void drawLine (int x1, int y1, int x2, int y2)
          Draws a line between the points (x1,y1) and (x2,y2) using the foreground color.
 void drawOval (int x, int y, int width, int height)
          Draws the outline of an ellipse that fits inside the rectangle with the given properties using the foreground color.
 void drawPath (Path path)
          This method requires advanced graphics support.
 void drawPoint (int x, int y)
          Draws a pixel, using the foreground color, at the specified point (x, y).
 void drawPolygon (int[] points)
          Draws a closed polygon defined by the given Integer array containing the vertices in x,y order.
 void drawPolygon ( PointList points)
          Draws a closed polygon defined by the given PointList containing the vertices.
 void drawPolyline (int[] points)
          Draws a polyline defined by the given Integer array containing the vertices in x,y order.
 void drawPolyline ( PointList points)
          Draws a polyline defined by the given PointList containing the vertices.
 void drawRectangle (int x, int y, int width, int height)
          Draws a rectangle whose top-left corner is located at the point (x,y) with the given width and height.
 void drawRoundRectangle ( Rectangle r, int arcWidth, int arcHeight)
          Draws a rectangle with rounded corners using the foreground color.
 void drawString (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 void drawText (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 void drawTextLayout (TextLayout layout, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground)
           
 void fillArc (int x, int y, int width, int height, int offset, int length)
          Fills the interior of an arc located at (x,y) with width w and height h.
 void fillGradient (int x, int y, int w, int h, boolean vertical)
          Fills the the given rectangle with a gradient from the foreground color to the background color.
 void fillOval (int x, int y, int width, int height)
          Fills an ellipse that fits inside the rectangle with the given properties using the background color.
 void fillPath (Path path)
          This method requires advanced graphics support.
 void fillPolygon (int[] points)
          Fills a closed polygon defined by the given Integer array containing the vertices in x,y order.
 void fillPolygon ( PointList points)
          Fills a closed polygon defined by the given PointList containing the vertices.
 void fillRectangle (int x, int y, int width, int height)
          Fills a rectangle whose top-left corner is located at the point (x,y) with the given width and height.
 void fillRoundRectangle ( Rectangle r, int arcWidth, int arcHeight)
          Fills a rectangle with rounded corners using the background color.
 void fillString (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 void fillText (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 boolean getAdvanced ()
           
 int getAlpha ()
          Returns the current alpha value of the graphics.
 int getAntialias ()
          Returns the anti-aliasing setting value, which will be one of SWT.DEFAULT, SWT.OFF or SWT.ON.
 Color getBackgroundColor ()
          Returns the background color used for filling.
  Rectangle getClip ( Rectangle rect)
          Modifies the given rectangle to match the clip region and returns that rectangle.
 int getFillRule ()
          Returns the fill rule, which will be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING.
 Font getFont ()
          Returns the font used to draw and fill text.
 FontMetrics getFontMetrics ()
          Returns the font metrics for the current font.
 Color getForegroundColor ()
          Returns the foreground color used to draw lines and text.
 int getInterpolation ()
          Returns the interpolation setting.
 void getLineAttributes (LineAttributes lineAttributes)
           
 int getLineCap ()
          Returns the current line cap style.
 float[] getLineDash ()
           
 float getLineDashOffset ()
           
 int getLineJoin ()
          Returns the line join style.
 float getLineMiterLimit ()
          Returns the line miter limit.
 int getLineStyle ()
          Returns the line style.
 int getLineWidth ()
          Returns the current line width.
 float getLineWidthFloat ()
          Returns the current line width.
 int getTextAntialias ()
          Returns the textual anti-aliasing setting value, which will be one of SWT.DEFAULT, SWT.OFF or SWT.ON.
 boolean getXORMode ()
          Returns true if this graphics object should use XOR mode with painting.
protected  void init ()
          Called by constructor, initializes all State information for currentState
 void popState ()
          Pops the previous state of this graphics object off the stack (if pushState() has previously been called) and restores the current state to that popped state.
 void pushState ()
          Pushes the current state of this graphics object onto a stack.
 void restoreState ()
          Restores the previous state of this graphics object.
protected  void restoreState (org.eclipse.draw2d.SWTGraphics.State s)
          Sets all State information to that of the given State, called by restoreState()
 void rotate (float degrees)
          This method requires advanced graphics support.
 void scale (double factor)
          Scales this graphics object by the given amount.
 void scale (float horizontal, float vertical)
          This method requires advanced graphics support.
 void setAdvanced (boolean value)
          Turns advanced graphics mode on or off.
 void setAlpha (int alpha)
          This method requires advanced graphics support.
 void setAntialias (int value)
          This method requires advanced graphics support.
 void setBackgroundColor (Color color)
          Sets the background color.
 void setBackgroundPattern (Pattern pattern)
          Sets the pattern used for fill-type graphics operations.
 void setClip (Path path)
          This method requires advanced graphics support.
 void setFillRule (int rule)
          Sets the fill rule to the given value, which must be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING.
 void setFont (Font f)
          Sets the font.
 void setForegroundColor (Color color)
          Sets the foreground color.
 void setForegroundPattern (Pattern pattern)
          Sets the foreground pattern for draw and text operations.
 void setInterpolation (int interpolation)
          This method requires advanced graphics support.
 void setLineAttributes (LineAttributes lineAttributes)
          Sets all line attributes together
 void setLineCap (int value)
          Sets the line cap style to the argument, which must be one of the constants SWT.CAP_FLAT, SWT.CAP_ROUND, or SWT.CAP_SQUARE.
 void setLineDash (float[] value)
          Sets the dash pattern when the custom line style is in use.
 void setLineDash (int[] dashes)
          Sets the dash pattern when the custom line style is in use.
 void setLineDashOffset (float value)
           
 void setLineJoin (int value)
          Sets the line join style to the argument, which must be one of the constants SWT.JOIN_MITER, SWT.JOIN_ROUND, or SWT.JOIN_BEVEL.
 void setLineMiterLimit (float value)
           
 void setLineStyle (int value)
          Sets the line style to the argument, which must be one of the constants SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DOT, SWT.LINE_DASHDOT or SWT.LINE_DASHDOTDOT.
 void setLineWidth (int width)
          Sets the line width.
 void setLineWidthFloat (float value)
          Sets the line width.
 void setTextAntialias (int value)
          This method requires advanced graphics support.
 void setXORMode (boolean xor)
          Sets the XOR mode.
 void shear (float horz, float vert)
          This method requires advanced graphics support.
 void translate (float dx, float dy)
          This method requires advanced graphics support.
 void translate (int dx, int dy)
          This method may require advanced graphics support if using a transform, in this case, a check should be made to ensure advanced graphics is supported in the user's environment before calling this method.
 
Methods inherited from class org.eclipse.draw2d. Graphics
drawArc, drawFocus, drawImage, drawImage, drawLine, drawOval, drawRectangle, drawString, drawText, drawText, drawText, drawTextLayout, fillArc, fillGradient, fillOval, fillRectangle, fillString, fillText, getAbsoluteScale, getLineAttributes, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTGraphics

public SWTGraphics(GC gc)
Constructs a new SWTGraphics that draws to the Canvas using the given GC.

Parameters:
gc - the GC
Method Detail

checkFill

protected final void checkFill()
If the background color has changed, this change will be pushed to the GC. Also calls checkGC().


checkGC

protected final void checkGC()
If the rendering hints or the clip region has changed, these changes will be pushed to the GC. Rendering hints include anti-alias, xor, join, cap, line style, fill rule, interpolation, and other settings.


checkPaint

protected final void checkPaint()
If the line width, line style, foreground or background colors have changed, these changes will be pushed to the GC. Also calls checkGC().


checkText

protected final void checkText()
If the font has changed, this change will be pushed to the GC. Also calls checkPaint() and checkFill().


clipRect

public void clipRect(
Rectangle rect)
Description copied from class: Graphics
Sets the clip region to the given rectangle. Anything outside this rectangle will not be drawn.

Specified by:
clipRect in class Graphics
Parameters:
rect - the clip rectangle
See Also:
Graphics.clipRect(Rectangle)

dispose

public void dispose()
Description copied from class: Graphics
Disposes this object, releasing any resources.

Specified by:
dispose in class Graphics
See Also:
Graphics.dispose()

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int offset,
                    int length)
Description copied from class: Graphics
Draws the outline of an arc located at (x,y) with width w and height h. The starting angle of the arc (specified in degrees) is offset and length is the arc's angle (specified in degrees).

Specified by:
drawArc in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
offset - the start angle
length - the length of the arc
See Also:
Graphics.drawArc(int, int, int, int, int, int)

drawFocus

public void drawFocus(int x,
                      int y,
                      int w,
                      int h)
Description copied from class: Graphics
Draws a focus rectangle.

Specified by:
drawFocus in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
See Also:
Graphics.drawFocus(int, int, int, int)

drawImage

public void drawImage(Image srcImage,
                      int x,
                      int y)
Description copied from class: Graphics
Draws the given Image at the location (x,y).

Specified by:
drawImage in class Graphics
Parameters:
srcImage - the Image
x - the x coordinate
y - the y coordinate
See Also:
Graphics.drawImage(Image, int, int)

drawImage

public void drawImage(Image srcImage,
                      int x1,
                      int y1,
                      int w1,
                      int h1,
                      int x2,
                      int y2,
                      int w2,
                      int h2)
Description copied from class: Graphics
Draws a rectangular section of the given Image to the specified rectangular reagion on the canvas. The section of the image bounded by the rectangle (x1,y1,w1,h1) is copied to the section of the canvas bounded by the rectangle (x2,y2,w2,h2). If these two sizes are different, scaling will occur.

Specified by:
drawImage in class Graphics
Parameters:
srcImage - the image
x1 - the x coordinate of the source
y1 - the y coordinate of the source
w1 - the width of the source
h1 - the height of the source
x2 - the x coordinate of the destination
y2 - the y coordinate of the destination
w2 - the width of the destination
h2 - the height of the destination
See Also:
Graphics.drawImage(Image, int, int, int, int, int, int, int, int)

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Description copied from class: Graphics
Draws a line between the points (x1,y1) and (x2,y2) using the foreground color.

Specified by:
drawLine in class Graphics
Parameters:
x1 - the x coordinate for the first point
y1 - the y coordinate for the first point
x2 - the x coordinate for the second point
y2 - the y coordinate for the second point
See Also:
Graphics.drawLine(int, int, int, int)

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Graphics
Draws the outline of an ellipse that fits inside the rectangle with the given properties using the foreground color.

Specified by:
drawOval in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
Graphics.drawOval(int, int, int, int)

drawPath

public void drawPath(Path path)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
drawPath in class Graphics
Parameters:
path - the path to draw
See Also:
Graphics.drawPath(Path)

drawPoint

public void drawPoint(int x,
                      int y)
Description copied from class: Graphics
Draws a pixel, using the foreground color, at the specified point (x, y).

Note that the current line attributes do not affect this operation.

Overrides:
drawPoint in class Graphics
Parameters:
x - the point's x coordinate
y - the point's y coordinate
See Also:
Graphics.drawPoint(int, int)

drawPolygon

public void drawPolygon(int[] points)
Description copied from class: Graphics
Draws a closed polygon defined by the given Integer array containing the vertices in x,y order. The first and last points in the list will be connected.

Overrides:
drawPolygon in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.drawPolygon(int[])

drawPolygon

public void drawPolygon(
PointList points)
Description copied from class: Graphics
Draws a closed polygon defined by the given PointList containing the vertices. The first and last points in the list will be connected.

Specified by:
drawPolygon in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.drawPolygon(PointList)

drawPolyline

public void drawPolyline(int[] points)
Description copied from class: Graphics
Draws a polyline defined by the given Integer array containing the vertices in x,y order. The first and last points in the list will not be connected.

Overrides:
drawPolyline in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.drawPolyline(int[])

drawPolyline

public void drawPolyline(
PointList points)
Description copied from class: Graphics
Draws a polyline defined by the given PointList containing the vertices. The first and last points in the list will not be connected.

Specified by:
drawPolyline in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.drawPolyline(PointList)

drawRectangle

public void drawRectangle(int x,
                          int y,
                          int width,
                          int height)
Description copied from class: Graphics
Draws a rectangle whose top-left corner is located at the point (x,y) with the given width and height.

Specified by:
drawRectangle in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
Graphics.drawRectangle(int, int, int, int)

drawRoundRectangle

public void drawRoundRectangle(
Rectangle r,
                               int arcWidth,
                               int arcHeight)
Description copied from class: Graphics
Draws a rectangle with rounded corners using the foreground color. arcWidth and arcHeight represent the horizontal and vertical diameter of the corners.

Specified by:
drawRoundRectangle in class Graphics
Parameters:
r - the rectangle
arcWidth - the arc width
arcHeight - the arc height
See Also:
Graphics.drawRoundRectangle(Rectangle, int, int)

drawString

public void drawString(java.lang.String s,
                       int x,
                       int y)
Description copied from class: Graphics
Draws the given string using the current font and foreground color. No tab expansion or carriage return processing will be performed. The background of the string will be transparent.

Specified by:
drawString in class Graphics
Parameters:
s - the string
x - the x coordinate
y - the y coordinate
See Also:
Graphics.drawString(String, int, int)

drawText

public void drawText(java.lang.String s,
                     int x,
                     int y)
Description copied from class: Graphics
Draws the given string using the current font and foreground color. Tab expansion and carriage return processing are performed. The background of the text will be transparent.

Specified by:
drawText in class Graphics
Parameters:
s - the text
x - the x coordinate
y - the y coordinate
See Also:
Graphics.drawText(String, int, int)

drawTextLayout

public void drawTextLayout(TextLayout layout,
                           int x,
                           int y,
                           int selectionStart,
                           int selectionEnd,
                           Color selectionForeground,
                           Color selectionBackground)
Overrides:
drawTextLayout in class Graphics
Parameters:
x - the x location
y - the y location
layout - the TextLayout being rendered
selectionStart - the start of selection
selectionEnd - the end of selection
selectionForeground - the foreground selection color
selectionBackground - the background selection color
See Also:
Graphics.drawTextLayout(TextLayout, int, int, int, int, Color, Color)

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int offset,
                    int length)
Description copied from class: Graphics
Fills the interior of an arc located at (x,y) with width w and height h. The starting angle of the arc (specified in degrees) is offset and length is the arc's angle (specified in degrees).

Specified by:
fillArc in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
offset - the start angle
length - the length of the arc
See Also:
Graphics.fillArc(int, int, int, int, int, int)

fillGradient

public void fillGradient(int x,
                         int y,
                         int w,
                         int h,
                         boolean vertical)
Description copied from class: Graphics
Fills the the given rectangle with a gradient from the foreground color to the background color. If vertical is true, the gradient will go from top to bottom. Otherwise, it will go from left to right. background color.

Specified by:
fillGradient in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
vertical - whether the gradient should be vertical
See Also:
Graphics.fillGradient(int, int, int, int, boolean)

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Description copied from class: Graphics
Fills an ellipse that fits inside the rectangle with the given properties using the background color.

Specified by:
fillOval in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
Graphics.fillOval(int, int, int, int)

fillPath

public void fillPath(Path path)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
fillPath in class Graphics
Parameters:
path - the path to fill
See Also:
Graphics.fillPath(Path)

fillPolygon

public void fillPolygon(int[] points)
Description copied from class: Graphics
Fills a closed polygon defined by the given Integer array containing the vertices in x,y order. The first and last points in the list will be connected.

Overrides:
fillPolygon in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.fillPolygon(int[])

fillPolygon

public void fillPolygon(
PointList points)
Description copied from class: Graphics
Fills a closed polygon defined by the given PointList containing the vertices. The first and last points in the list will be connected.

Specified by:
fillPolygon in class Graphics
Parameters:
points - the vertices
See Also:
Graphics.fillPolygon(PointList)

fillRectangle

public void fillRectangle(int x,
                          int y,
                          int width,
                          int height)
Description copied from class: Graphics
Fills a rectangle whose top-left corner is located at the point (x,y) with the given width and height.

Specified by:
fillRectangle in class Graphics
Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
Graphics.fillRectangle(int, int, int, int)

fillRoundRectangle

public void fillRoundRectangle(
Rectangle r,
                               int arcWidth,
                               int arcHeight)
Description copied from class: Graphics
Fills a rectangle with rounded corners using the background color. arcWidth and arcHeight represent the horizontal and vertical diameter of the corners.

Specified by:
fillRoundRectangle in class Graphics
Parameters:
r - the rectangle
arcWidth - the arc width
arcHeight - the arc height
See Also:
Graphics.fillRoundRectangle(Rectangle, int, int)

fillString

public void fillString(java.lang.String s,
                       int x,
                       int y)
Description copied from class: Graphics
Draws the given string using the current font and foreground color. No tab expansion or carriage return processing will be performed. The background of the string will be filled with the current background color.

Specified by:
fillString in class Graphics
Parameters:
s - the string
x - the x coordinate
y - the y coordinate
See Also:
Graphics.fillString(String, int, int)

fillText

public void fillText(java.lang.String s,
                     int x,
                     int y)
Description copied from class: Graphics
Draws the given string using the current font and foreground color. Tab expansion and carriage return processing are performed. The background of the text will be filled with the current background color.

Specified by:
fillText in class Graphics
Parameters:
s - the text
x - the x coordinate
y - the y coordinate
See Also:
Graphics.fillText(String, int, int)

getAlpha

public int getAlpha()
Description copied from class: Graphics
Returns the current alpha value of the graphics.

Overrides:
getAlpha in class Graphics
Returns:
the alpha value
See Also:
Graphics.getAlpha()

getAntialias

public int getAntialias()
Description copied from class: Graphics
Returns the anti-aliasing setting value, which will be one of SWT.DEFAULT, SWT.OFF or SWT.ON. Note that this controls anti-aliasing for all non-text drawing operations.

Overrides:
getAntialias in class Graphics
Returns:
the anti-alias setting
See Also:
Graphics.getAntialias()

getAdvanced

public boolean getAdvanced()
Overrides:
getAdvanced in class Graphics
Returns:
true if the underlying graphics device is using advanced graphics mode.

getBackgroundColor

public Color getBackgroundColor()
Description copied from class: Graphics
Returns the background color used for filling.

Specified by:
getBackgroundColor in class Graphics
Returns:
the background color
See Also:
Graphics.getBackgroundColor()

getClip

public 
Rectangle getClip(
Rectangle rect)
Description copied from class: Graphics
Modifies the given rectangle to match the clip region and returns that rectangle.

Specified by:
getClip in class Graphics
Parameters:
rect - the rectangle to hold the clip region
Returns:
the clip rectangle
See Also:
Graphics.getClip(Rectangle)

getFillRule

public int getFillRule()
Description copied from class: Graphics
Returns the fill rule, which will be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING.

Overrides:
getFillRule in class Graphics
Returns:
the fill rule
See Also:
Graphics.getFillRule()

getFont

public Font getFont()
Description copied from class: Graphics
Returns the font used to draw and fill text.

Specified by:
getFont in class Graphics
Returns:
the font
See Also:
Graphics.getFont()

getFontMetrics

public FontMetrics getFontMetrics()
Description copied from class: Graphics
Returns the font metrics for the current font.

Specified by:
getFontMetrics in class Graphics
Returns:
the font metrics
See Also:
Graphics.getFontMetrics()

getForegroundColor

public Color getForegroundColor()
Description copied from class: Graphics
Returns the foreground color used to draw lines and text.

Specified by:
getForegroundColor in class Graphics
Returns:
the foreground color
See Also:
Graphics.getForegroundColor()

getInterpolation

public int getInterpolation()
Description copied from class: Graphics
Returns the interpolation setting.

Overrides:
getInterpolation in class Graphics
Returns:
the interpolation setting
See Also:
Graphics.getInterpolation()

getLineAttributes

public void getLineAttributes(LineAttributes lineAttributes)
Since:
3.5

getLineCap

public int getLineCap()
Description copied from class: Graphics
Returns the current line cap style.

Overrides:
getLineCap in class Graphics
Returns:
the cap style used for drawing lines
See Also:
Graphics.getLineCap()

getLineJoin

public int getLineJoin()
Description copied from class: Graphics
Returns the line join style.

Overrides:
getLineJoin in class Graphics
Returns:
the join style used for drawing lines
See Also:
Graphics.getLineJoin()

getLineStyle

public int getLineStyle()
Description copied from class: Graphics
Returns the line style.

Specified by:
getLineStyle in class Graphics
Returns:
the line style
See Also:
Graphics.getLineStyle()

getLineWidth

public int getLineWidth()
Description copied from class: Graphics
Returns the current line width.

Specified by:
getLineWidth in class Graphics
Returns:
the line width
See Also:
Graphics.getLineWidth()

getLineWidthFloat

public float getLineWidthFloat()
Description copied from class: Graphics
Returns the current line width.

Specified by:
getLineWidthFloat in class Graphics
Returns:
the line width
See Also:
LineAttributes

getLineMiterLimit

public float getLineMiterLimit()
Description copied from class: Graphics
Returns the line miter limit.

Overrides:
getLineMiterLimit in class Graphics
Returns:
miter limit
See Also:
LineAttributes

getLineDash

public float[] getLineDash()
Since:
3.5

getLineDashOffset

public float getLineDashOffset()
Since:
3.5

getTextAntialias

public int getTextAntialias()
Description copied from class: Graphics
Returns the textual anti-aliasing setting value, which will be one of SWT.DEFAULT, SWT.OFF or SWT.ON. Note that this controls anti-aliasing only for text drawing operations.

Overrides:
getTextAntialias in class Graphics
Returns:
the anti-aliasing setting
See Also:
Graphics.getTextAntialias()

getXORMode

public boolean getXORMode()
Description copied from class: Graphics
Returns true if this graphics object should use XOR mode with painting.

Specified by:
getXORMode in class Graphics
Returns:
whether XOR mode is turned on
See Also:
Graphics.getXORMode()

init

protected void init()
Called by constructor, initializes all State information for currentState


popState

public void popState()
Description copied from class: Graphics
Pops the previous state of this graphics object off the stack (if Graphics.pushState() has previously been called) and restores the current state to that popped state.

Specified by:
popState in class Graphics
See Also:
Graphics.popState()

pushState

public void pushState()
Description copied from class: Graphics
Pushes the current state of this graphics object onto a stack.

Specified by:
pushState in class Graphics
See Also:
Graphics.pushState()

restoreState

public void restoreState()
Description copied from class: Graphics
Restores the previous state of this graphics object.

Specified by:
restoreState in class Graphics
See Also:
Graphics.restoreState()

restoreState

protected void restoreState(org.eclipse.draw2d.SWTGraphics.State s)
Sets all State information to that of the given State, called by restoreState()

Parameters:
s - the State

rotate

public void rotate(float degrees)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
rotate in class Graphics
Parameters:
degrees - the degrees to rotate
See Also:
Graphics.rotate(float)

scale

public void scale(double factor)
Description copied from class: Graphics
Scales this graphics object by the given amount.

Specified by:
scale in class Graphics
Parameters:
factor - the scale factor
See Also:
Graphics.scale(double)

scale

public void scale(float horizontal,
                  float vertical)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
scale in class Graphics
Parameters:
horizontal - the horizontal scaling factor
vertical - the vertical scaling factor
See Also:
Graphics.scale(float, float)

setAlpha

public void setAlpha(int alpha)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
setAlpha in class Graphics
Parameters:
alpha - an alpha value (0-255)
See Also:
Graphics.setAlpha(int)

setAntialias

public void setAntialias(int value)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
setAntialias in class Graphics
Parameters:
value - the anti-alias value
See Also:
Graphics.setAntialias(int)

setAdvanced

public void setAdvanced(boolean value)
Description copied from class: Graphics
Turns advanced graphics mode on or off.

Overrides:
setAdvanced in class Graphics
Parameters:
value -

setBackgroundColor

public void setBackgroundColor(Color color)
Description copied from class: Graphics
Sets the background color.

Specified by:
setBackgroundColor in class Graphics
Parameters:
color - the new background color
See Also:
Graphics.setBackgroundColor(Color)

setBackgroundPattern

public void setBackgroundPattern(Pattern pattern)
Description copied from class: Graphics
Sets the pattern used for fill-type graphics operations. The pattern must not be disposed while it is being used by the graphics.

Overrides:
setBackgroundPattern in class Graphics
Parameters:
pattern - the background pattern
See Also:
Graphics.setBackgroundPattern(Pattern)

setClip

public void setClip(Path path)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
setClip in class Graphics
Parameters:
path - the clipping path
See Also:
Graphics.setClip(Path)

setFillRule

public void setFillRule(int rule)
Description copied from class: Graphics
Sets the fill rule to the given value, which must be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING.

Overrides:
setFillRule in class Graphics
Parameters:
rule - the fill rule
See Also:
Graphics.setFillRule(int)

setFont

public void setFont(Font f)
Description copied from class: Graphics
Sets the font.

Specified by:
setFont in class Graphics
Parameters:
f - the new font
See Also:
Graphics.setFont(Font)

setForegroundColor

public void setForegroundColor(Color color)
Description copied from class: Graphics
Sets the foreground color.

Specified by:
setForegroundColor in class Graphics
Parameters:
color - the new foreground color
See Also:
Graphics.setForegroundColor(Color)

setForegroundPattern

public void setForegroundPattern(Pattern pattern)
Description copied from class: Graphics
Sets the foreground pattern for draw and text operations. The pattern must not be disposed while it is being referenced by the graphics.

Overrides:
setForegroundPattern in class Graphics
Parameters:
pattern - the foreground pattern
See Also:
Graphics.setForegroundPattern(Pattern)

setInterpolation

public void setInterpolation(int interpolation)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
setInterpolation in class Graphics
Parameters:
interpolation - the interpolation
See Also:
Graphics.setInterpolation(int)

setLineAttributes

public void setLineAttributes(LineAttributes lineAttributes)
Description copied from class: Graphics
Sets all line attributes together

Overrides:
setLineAttributes in class Graphics
Parameters:
lineAttributes - the line attributes

setLineCap

public void setLineCap(int value)
Description copied from class: Graphics
Sets the line cap style to the argument, which must be one of the constants SWT.CAP_FLAT, SWT.CAP_ROUND, or SWT.CAP_SQUARE.

Overrides:
setLineCap in class Graphics
Parameters:
value - the line cap
See Also:
Graphics.setLineCap(int)

setLineDash

public void setLineDash(int[] dashes)
Description copied from class: Graphics
Sets the dash pattern when the custom line style is in use. Because this feature is rarely used, the dash pattern may not be preserved when calling Graphics.pushState() and Graphics.popState().

Overrides:
setLineDash in class Graphics
Parameters:
dashes - the pixel pattern
See Also:
Graphics.setLineDash(int[])

setLineDash

public void setLineDash(float[] value)
Description copied from class: Graphics
Sets the dash pattern when the custom line style is in use.

Overrides:
setLineDash in class Graphics
Parameters:
value -
Since:
3.5

setLineDashOffset

public void setLineDashOffset(float value)
Since:
3.5

setLineJoin

public void setLineJoin(int value)
Description copied from class: Graphics
Sets the line join style to the argument, which must be one of the constants SWT.JOIN_MITER, SWT.JOIN_ROUND, or SWT.JOIN_BEVEL.

Overrides:
setLineJoin in class Graphics
Parameters:
value - the join type
See Also:
Graphics.setLineJoin(int)

setLineStyle

public void setLineStyle(int value)
Description copied from class: Graphics
Sets the line style to the argument, which must be one of the constants SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DOT, SWT.LINE_DASHDOT or SWT.LINE_DASHDOTDOT.

Specified by:
setLineStyle in class Graphics
Parameters:
value - the new style
See Also:
Graphics.setLineStyle(int)

setLineWidth

public void setLineWidth(int width)
Description copied from class: Graphics
Sets the line width.

Specified by:
setLineWidth in class Graphics
Parameters:
width - the new width
See Also:
Graphics.setLineWidth(int)

setLineWidthFloat

public void setLineWidthFloat(float value)
Description copied from class: Graphics
Sets the line width.

Specified by:
setLineWidthFloat in class Graphics
Parameters:
value - the new width

setLineMiterLimit

public void setLineMiterLimit(float value)
Specified by:
setLineMiterLimit in class Graphics
Parameters:
value -

setTextAntialias

public void setTextAntialias(int value)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
setTextAntialias in class Graphics
Parameters:
value - the textual anti-alias setting
See Also:
Graphics.setTextAntialias(int)

setXORMode

public void setXORMode(boolean xor)
Description copied from class: Graphics
Sets the XOR mode.

Specified by:
setXORMode in class Graphics
Parameters:
xor - the new XOR mode
See Also:
Graphics.setXORMode(boolean)

shear

public void shear(float horz,
                  float vert)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
shear in class Graphics
Parameters:
horz - the horizontal shearing amount
vert - the vertical shearing amount
See Also:
Graphics.shear(float, float)

translate

public void translate(int dx,
                      int dy)
This method may require advanced graphics support if using a transform, in this case, a check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Specified by:
translate in class Graphics
Parameters:
dx - the horizontal offset
dy - the vertical offset
See Also:
Graphics.translate(int, int)

translate

public void translate(float dx,
                      float dy)
This method requires advanced graphics support. A check should be made to ensure advanced graphics is supported in the user's environment before calling this method. See GC#getAdvanced().

Overrides:
translate in class Graphics
Parameters:
dx - the horizontal offset
dy - the vertical offset
See Also:
Graphics.translate(float, float)

Eclipse Draw2d
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire