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 Graphics

java.lang.Object
  extended by
org.eclipse.draw2d.Graphics
Direct Known Subclasses:
ScaledGraphics, SWTGraphics

public abstract class Graphics
extends java.lang.Object

The Graphics class allows you to draw to a surface. The drawXxx() methods that pertain to shapes draw an outline of the shape, whereas the fillXxx() methods fill in the shape. Also provides for drawing text, lines and images.


Field Summary
static int LINE_CUSTOM
           
static int LINE_DASH
           
static int LINE_DASHDOT
           
static int LINE_DASHDOTDOT
           
static int LINE_DOT
           
static int LINE_SOLID
           
 
Constructor Summary
Graphics ()
           
 
Method Summary
abstract  void clipRect ( Rectangle r)
          Sets the clip region to the given rectangle.
abstract  void dispose ()
          Disposes this object, releasing any resources.
abstract  void drawArc (int x, int y, int w, int h, int offset, int length)
          Draws the outline of an arc located at (x,y) with width w and height h.
 void drawArc ( Rectangle r, int offset, int length)
           
abstract  void drawFocus (int x, int y, int w, int h)
          Draws a focus rectangle.
 void drawFocus ( Rectangle r)
           
abstract  void drawImage (Image srcImage, int x, int y)
          Draws the given Image at the location (x,y).
abstract  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 drawImage (Image image, Point p)
          Draws the given image at a point.
 void drawImage (Image srcImage, Rectangle src, Rectangle dest)
           
abstract  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 drawLine ( Point p1, Point p2)
           
abstract  void drawOval (int x, int y, int w, int h)
          Draws the outline of an ellipse that fits inside the rectangle with the given properties using the foreground color.
 void drawOval ( Rectangle r)
          Draws an oval inside the given rectangle using the current foreground color.
 void drawPath (Path path)
          Draws the given path.
 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.
abstract  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.
abstract  void drawPolyline ( PointList points)
          Draws a polyline defined by the given PointList containing the vertices.
abstract  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 drawRectangle ( Rectangle r)
          Draws the given rectangle using the current foreground color.
abstract  void drawRoundRectangle ( Rectangle r, int arcWidth, int arcHeight)
          Draws a rectangle with rounded corners using the foreground color.
abstract  void drawString (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 void drawString (java.lang.String s, Point p)
           
abstract  void drawText (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, int style)
          Draws a string using the specified styles.
 void drawText (java.lang.String s, Point p)
           
 void drawText (java.lang.String s, Point p, int style)
          Draws a string using the specified styles.
 void drawTextLayout (TextLayout layout, int x, int y)
          Renders the specified TextLayout to this Graphics.
 void drawTextLayout (TextLayout layout, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground)
           
abstract  void fillArc (int x, int y, int w, int h, int offset, int length)
          Fills the interior of an arc located at (x,y) with width w and height h.
 void fillArc ( Rectangle r, int offset, int length)
           
abstract  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 fillGradient ( Rectangle r, boolean vertical)
           
abstract  void fillOval (int x, int y, int w, int h)
          Fills an ellipse that fits inside the rectangle with the given properties using the background color.
 void fillOval ( Rectangle r)
           
 void fillPath (Path path)
          Fills the given path.
 void fillPolygon (int[] points)
          Fills a closed polygon defined by the given Integer array containing the vertices in x,y order.
abstract  void fillPolygon ( PointList points)
          Fills a closed polygon defined by the given PointList containing the vertices.
abstract  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 fillRectangle ( Rectangle r)
          Fills the given rectangle using the current background color.
abstract  void fillRoundRectangle ( Rectangle r, int arcWidth, int arcHeight)
          Fills a rectangle with rounded corners using the background color.
abstract  void fillString (java.lang.String s, int x, int y)
          Draws the given string using the current font and foreground color.
 void fillString (java.lang.String s, Point p)
           
abstract  void fillText (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, Point p)
           
 double getAbsoluteScale ()
          Returns the current absolute scaling which will be applied to the underlying Device when painting to this Graphics.
 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.
abstract  Color getBackgroundColor ()
          Returns the background color used for filling.
abstract   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.
abstract  Font getFont ()
          Returns the font used to draw and fill text.
abstract  FontMetrics getFontMetrics ()
          Returns the font metrics for the current font.
abstract  Color getForegroundColor ()
          Returns the foreground color used to draw lines and text.
 int getInterpolation ()
          Returns the interpolation setting.
 LineAttributes getLineAttributes ()
          Returns the current collection of line attributes.
 int getLineCap ()
          Returns the current line cap style.
 int getLineJoin ()
          Returns the line join style.
 float getLineMiterLimit ()
          Returns the line miter limit.
abstract  int getLineStyle ()
          Returns the line style.
abstract  int getLineWidth ()
          Returns the current line width.
abstract  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.
abstract  boolean getXORMode ()
          Returns true if this graphics object should use XOR mode with painting.
abstract  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.
abstract  void pushState ()
          Pushes the current state of this graphics object onto a stack.
abstract  void restoreState ()
          Restores the previous state of this graphics object.
 void rotate (float degrees)
          Rotates the coordinates by the given counter-clockwise angle.
abstract  void scale (double amount)
          Scales this graphics object by the given amount.
 void scale (float horizontal, float vertical)
          Scales the graphics by the given horizontal and vertical components.
 void setAdvanced (boolean advanced)
          Turns advanced graphics mode on or off.
 void setAlpha (int alpha)
          Sets the alpha to the given value.
 void setAntialias (int value)
          Sets the anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON.
abstract  void setBackgroundColor (Color rgb)
          Sets the background color.
 void setBackgroundPattern (Pattern pattern)
          Sets the pattern used for fill-type graphics operations.
 void setClip (Path path)
          Sets the area which can be affected by drawing operations to the specified Path.
 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.
abstract  void setFont (Font f)
          Sets the font.
abstract  void setForegroundColor (Color rgb)
          Sets the foreground color.
 void setForegroundPattern (Pattern pattern)
          Sets the foreground pattern for draw and text operations.
 void setInterpolation (int interpolation)
          Sets the interpolation setting to the given value, which must be one of SWT.DEFAULT, SWT.NONE, SWT.LOW or SWT.HIGH.
 void setLineAttributes (LineAttributes attributes)
          Sets all line attributes together
 void setLineCap (int cap)
          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[] dash)
          Sets the dash pattern when the custom line style is in use.
 void setLineJoin (int join)
          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.
abstract  void setLineMiterLimit (float miterLimit)
           
abstract  void setLineStyle (int style)
          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.
abstract  void setLineWidth (int width)
          Sets the line width.
abstract  void setLineWidthFloat (float width)
          Sets the line width.
 void setTextAntialias (int value)
          Sets the textual anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON.
abstract  void setXORMode (boolean b)
          Sets the XOR mode.
 void shear (float horz, float vert)
          Modifies the current transformation by shearing the graphics in the specified horizontal and vertical amounts.
 void translate (float dx, float dy)
          Modifies the current transform by translating the given x and y amounts.
abstract  void translate (int dx, int dy)
          Translates the receiver's coordinates by the specified x and y amounts.
 void translate ( Point pt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_CUSTOM

public static final int LINE_CUSTOM
See Also:
SWT#LINE_CUSTOM

LINE_DASH

public static final int LINE_DASH
See Also:
SWT#LINE_DASH

LINE_DASHDOT

public static final int LINE_DASHDOT
See Also:
SWT#LINE_DASHDOT

LINE_DASHDOTDOT

public static final int LINE_DASHDOTDOT
See Also:
SWT#LINE_DASHDOTDOT

LINE_DOT

public static final int LINE_DOT
See Also:
SWT#LINE_DOT

LINE_SOLID

public static final int LINE_SOLID
See Also:
SWT#LINE_SOLID
Constructor Detail

Graphics

public Graphics()
Method Detail

clipRect

public abstract void clipRect(
Rectangle r)
Sets the clip region to the given rectangle. Anything outside this rectangle will not be drawn.

Parameters:
r - the clip rectangle

dispose

public abstract void dispose()
Disposes this object, releasing any resources.


drawArc

public abstract void drawArc(int x,
                             int y,
                             int w,
                             int h,
                             int offset,
                             int length)
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).

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
offset - the start angle
length - the length of the arc

drawArc

public final void drawArc(
Rectangle r,
                          int offset,
                          int length)
See Also:
drawArc(int, int, int, int, int, int)

drawFocus

public abstract void drawFocus(int x,
                               int y,
                               int w,
                               int h)
Draws a focus rectangle.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height

drawFocus

public final void drawFocus(
Rectangle r)
See Also:
drawFocus(int, int, int, int)

drawImage

public abstract void drawImage(Image srcImage,
                               int x,
                               int y)
Draws the given Image at the location (x,y).

Parameters:
srcImage - the Image
x - the x coordinate
y - the y coordinate

drawImage

public abstract 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. 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.

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

drawImage

public final void drawImage(Image image,
                            
Point p)
Draws the given image at a point.

Parameters:
image - the image to draw
p - where to draw the image
See Also:
drawImage(Image, int, int)

drawImage

public final void drawImage(Image srcImage,
                            
Rectangle src,
                            
Rectangle dest)
See Also:
drawImage(Image, int, int, int, int, int, int, int, int)

drawLine

public abstract 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.

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

drawLine

public final void drawLine(
Point p1,
                           
Point p2)
See Also:
drawLine(int, int, int, int)

drawOval

public abstract void drawOval(int x,
                              int y,
                              int w,
                              int h)
Draws the outline of an ellipse that fits inside the rectangle with the given properties using the foreground color.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height

drawOval

public final void drawOval(
Rectangle r)
Draws an oval inside the given rectangle using the current foreground color.

Parameters:
r - the rectangle circumscribing the oval to be drawn
See Also:
drawOval(int, int, int, int)

drawPath

public void drawPath(Path path)
Draws the given path.

Parameters:
path - the path to draw
Since:
3.1

drawPoint

public void drawPoint(int x,
                      int y)
Draws a pixel, using the foreground color, at the specified point (x, y).

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

Parameters:
x - the point's x coordinate
y - the point's y coordinate

drawPolygon

public void drawPolygon(int[] points)
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.

Parameters:
points - the vertices

drawPolygon

public abstract void drawPolygon(
PointList points)
Draws a closed polygon defined by the given PointList containing the vertices. The first and last points in the list will be connected.

Parameters:
points - the vertices

drawPolyline

public void drawPolyline(int[] points)
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.

Parameters:
points - the vertices

drawPolyline

public abstract void drawPolyline(
PointList points)
Draws a polyline defined by the given PointList containing the vertices. The first and last points in the list will not be connected.

Parameters:
points - the vertices

drawRectangle

public abstract 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.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height

drawRectangle

public final void drawRectangle(
Rectangle r)
Draws the given rectangle using the current foreground color.

Parameters:
r - the rectangle to draw
See Also:
drawRectangle(int, int, int, int)

drawRoundRectangle

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

Parameters:
r - the rectangle
arcWidth - the arc width
arcHeight - the arc height

drawString

public abstract void drawString(java.lang.String s,
                                int x,
                                int y)
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.

Parameters:
s - the string
x - the x coordinate
y - the y coordinate

drawString

public final void drawString(java.lang.String s,
                             
Point p)
See Also:
drawString(String, int, int)

drawText

public abstract void drawText(java.lang.String s,
                              int x,
                              int y)
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.

Parameters:
s - the text
x - the x coordinate
y - the y coordinate

drawText

public void drawText(java.lang.String s,
                     int x,
                     int y,
                     int style)
Draws a string using the specified styles. The styles are defined by GC#drawText(String, int, int, int).

Parameters:
s - the String to draw
x - the x location
y - the y location
style - the styles used to render the string
Since:
3.0

drawText

public final void drawText(java.lang.String s,
                           
Point p)
See Also:
drawText(String, int, int)

drawText

public final void drawText(java.lang.String s,
                           
Point p,
                           int style)
Draws a string using the specified styles. The styles are defined by GC#drawText(String, int, int, int).

Parameters:
s - the String to draw
p - the point at which to draw the string
style - the styles used to render the string
Since:
3.0

drawTextLayout

public final void drawTextLayout(TextLayout layout,
                                 int x,
                                 int y)
Renders the specified TextLayout to this Graphics.

Parameters:
layout - the TextLayout
x - the x coordinate
y - the y coordinate
Since:
3.0

drawTextLayout

public void drawTextLayout(TextLayout layout,
                           int x,
                           int y,
                           int selectionStart,
                           int selectionEnd,
                           Color selectionForeground,
                           Color selectionBackground)
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:
drawTextLayout(TextLayout, int, int)

fillArc

public abstract void fillArc(int x,
                             int y,
                             int w,
                             int h,
                             int offset,
                             int length)
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).

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
offset - the start angle
length - the length of the arc

fillArc

public final void fillArc(
Rectangle r,
                          int offset,
                          int length)
See Also:
fillArc(int, int, int, int, int, int)

fillGradient

public abstract 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. If vertical is true, the gradient will go from top to bottom. Otherwise, it will go from left to right. background color.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
vertical - whether the gradient should be vertical

fillGradient

public final void fillGradient(
Rectangle r,
                               boolean vertical)
See Also:
fillGradient(int, int, int, int, boolean)

fillOval

public abstract void fillOval(int x,
                              int y,
                              int w,
                              int h)
Fills an ellipse that fits inside the rectangle with the given properties using the background color.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height

fillOval

public final void fillOval(
Rectangle r)
See Also:
fillOval(int, int, int, int)

fillPath

public void fillPath(Path path)
Fills the given path.

Parameters:
path - the path to fill
Since:
3.1

fillPolygon

public void fillPolygon(int[] points)
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.

Parameters:
points - the vertices

fillPolygon

public abstract void fillPolygon(
PointList points)
Fills a closed polygon defined by the given PointList containing the vertices. The first and last points in the list will be connected.

Parameters:
points - the vertices

fillRectangle

public abstract 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.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height

fillRectangle

public final void fillRectangle(
Rectangle r)
Fills the given rectangle using the current background color.

Parameters:
r - the rectangle to fill
See Also:
fillRectangle(int, int, int, int)

fillRoundRectangle

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

Parameters:
r - the rectangle
arcWidth - the arc width
arcHeight - the arc height

fillString

public abstract void fillString(java.lang.String s,
                                int x,
                                int y)
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.

Parameters:
s - the string
x - the x coordinate
y - the y coordinate

fillString

public final void fillString(java.lang.String s,
                             
Point p)
See Also:
fillString(String, int, int)

fillText

public abstract void fillText(java.lang.String s,
                              int x,
                              int y)
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.

Parameters:
s - the text
x - the x coordinate
y - the y coordinate

fillText

public final void fillText(java.lang.String s,
                           
Point p)
See Also:
fillText(String, int, int)

getAbsoluteScale

public double getAbsoluteScale()
Returns the current absolute scaling which will be applied to the underlying Device when painting to this Graphics. The default value is 1.0.

Returns:
the effective absolute scaling factor
Since:
3.0

getAdvanced

public boolean getAdvanced()
Returns:
true if the underlying graphics device is using advanced graphics mode.
Since:
3.5

getAlpha

public int getAlpha()
Returns the current alpha value of the graphics.

Returns:
the alpha value
Since:
3.1

getAntialias

public int getAntialias()
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.

Returns:
the anti-alias setting
Since:
3.1
See Also:
getTextAntialias()

getBackgroundColor

public abstract Color getBackgroundColor()
Returns the background color used for filling.

Returns:
the background color

getClip

public abstract 
Rectangle getClip(
Rectangle rect)
Modifies the given rectangle to match the clip region and returns that rectangle.

Parameters:
rect - the rectangle to hold the clip region
Returns:
the clip rectangle

getFillRule

public int getFillRule()
Returns the fill rule, which will be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING.

Returns:
the fill rule
Since:
3.1

getFont

public abstract Font getFont()
Returns the font used to draw and fill text.

Returns:
the font

getFontMetrics

public abstract FontMetrics getFontMetrics()
Returns the font metrics for the current font.

Returns:
the font metrics

getForegroundColor

public abstract Color getForegroundColor()
Returns the foreground color used to draw lines and text.

Returns:
the foreground color

getInterpolation

public int getInterpolation()
Returns the interpolation setting.

Returns:
the interpolation setting
Since:
3.1
See Also:
GC

getLineAttributes

public LineAttributes getLineAttributes()
Returns the current collection of line attributes.

Returns:
all attributes used for line drawing
Since:
3.5
See Also:
LineAttributes

getLineCap

public int getLineCap()
Returns the current line cap style.

Returns:
the cap style used for drawing lines
Since:
3.1
See Also:
LineAttributes

getLineJoin

public int getLineJoin()
Returns the line join style.

Returns:
the join style used for drawing lines
Since:
3.1
See Also:
LineAttributes

getLineMiterLimit

public float getLineMiterLimit()
Returns the line miter limit.

Returns:
miter limit
Since:
3.5
See Also:
LineAttributes

getLineStyle

public abstract int getLineStyle()
Returns the line style.

Returns:
the line style
See Also:
LineAttributes

getLineWidth

public abstract int getLineWidth()
Returns the current line width.

Returns:
the line width

getLineWidthFloat

public abstract float getLineWidthFloat()
Returns the current line width.

Returns:
the line width
Since:
3.5
See Also:
LineAttributes

getTextAntialias

public int getTextAntialias()
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.

Returns:
the anti-aliasing setting
Since:
3.1
See Also:
getAntialias()

getXORMode

public abstract boolean getXORMode()
Returns true if this graphics object should use XOR mode with painting.

Returns:
whether XOR mode is turned on

popState

public abstract 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.


pushState

public abstract void pushState()
Pushes the current state of this graphics object onto a stack.


restoreState

public abstract void restoreState()
Restores the previous state of this graphics object.


rotate

public void rotate(float degrees)
Rotates the coordinates by the given counter-clockwise angle. All subsequent painting will be performed in the resulting coordinates. Some functions are illegal when a rotated coordinates system is in use. To restore access to those functions, it is necessary to call restore or pop to return to a non rotated state.

Parameters:
degrees - the degrees to rotate
Since:
3.1

scale

public abstract void scale(double amount)
Scales this graphics object by the given amount.

Parameters:
amount - the scale factor

scale

public void scale(float horizontal,
                  float vertical)
Scales the graphics by the given horizontal and vertical components.

Parameters:
horizontal - the horizontal scaling factor
vertical - the vertical scaling factor
Since:
3.1

setAlpha

public void setAlpha(int alpha)
Sets the alpha to the given value. Values may range from 0 to 255. A value of 0 is completely transparent.

Parameters:
alpha - an alpha value (0-255)
Since:
3.1

setAdvanced

public void setAdvanced(boolean advanced)
Turns advanced graphics mode on or off.

Parameters:
advanced -
Since:
3.5

setAntialias

public void setAntialias(int value)
Sets the anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON. Note that this controls anti-aliasing for all non-text drawing operations.

Parameters:
value - the anti-alias value

setBackgroundColor

public abstract void setBackgroundColor(Color rgb)
Sets the background color.

Parameters:
rgb - the new background color

setBackgroundPattern

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

Parameters:
pattern - the background pattern
Since:
3.1

setClip

public void setClip(Path path)
Sets the area which can be affected by drawing operations to the specified Path.

Parameters:
path - the clipping path
Since:
3.1

setFillRule

public 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.

Parameters:
rule - the fill rule
Since:
3.1

setFont

public abstract void setFont(Font f)
Sets the font.

Parameters:
f - the new font

setForegroundColor

public abstract void setForegroundColor(Color rgb)
Sets the foreground color.

Parameters:
rgb - the new foreground color

setForegroundPattern

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

Parameters:
pattern - the foreground pattern
Since:
3.1

setInterpolation

public void setInterpolation(int interpolation)
Sets the interpolation setting to the given value, which must be one of SWT.DEFAULT, SWT.NONE, SWT.LOW or SWT.HIGH. This setting is relevant when working with Images.

Parameters:
interpolation - the interpolation
Since:
3.1

setLineAttributes

public void setLineAttributes(LineAttributes attributes)
Sets all line attributes together

Parameters:
attributes - the line attributes
Since:
3.5

setLineCap

public void setLineCap(int cap)
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.

Parameters:
cap - the line cap
Since:
3.1

setLineDash

public void setLineDash(int[] dash)
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 pushState() and popState().

Parameters:
dash - the pixel pattern
Since:
3.1

setLineDash

public void setLineDash(float[] value)
Sets the dash pattern when the custom line style is in use.

Parameters:
value - the pixel pattern.
Since:
3.5

setLineJoin

public void setLineJoin(int join)
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.

Parameters:
join - the join type
Since:
3.1

setLineStyle

public abstract void setLineStyle(int style)
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.

Parameters:
style - the new style

setLineWidth

public abstract void setLineWidth(int width)
Sets the line width.

Parameters:
width - the new width

setLineWidthFloat

public abstract void setLineWidthFloat(float width)
Sets the line width.

Parameters:
width - the new width
Since:
3.5

setLineMiterLimit

public abstract void setLineMiterLimit(float miterLimit)
Parameters:
miterLimit -
Since:
3.5

setTextAntialias

public void setTextAntialias(int value)
Sets the textual anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON. Note that this controls anti-aliasing only for all text drawing operations.

Parameters:
value - the textual anti-alias setting
Since:
3.1

shear

public void shear(float horz,
                  float vert)
Modifies the current transformation by shearing the graphics in the specified horizontal and vertical amounts. Shearing can be used to produce effects like Italic fonts.

Parameters:
horz - the horizontal shearing amount
vert - the vertical shearing amount
Since:
3.1

setXORMode

public abstract void setXORMode(boolean b)
Sets the XOR mode.

Parameters:
b - the new XOR mode

translate

public abstract void translate(int dx,
                               int dy)
Translates the receiver's coordinates by the specified x and y amounts. All subsequent painting will be performed in the resulting coordinate system. Integer translation used by itself does not require or start the use of the advanced graphics system in SWT. It is emulated until advanced graphics are triggered.

Parameters:
dx - the horizontal offset
dy - the vertical offset

translate

public void translate(float dx,
                      float dy)
Modifies the current transform by translating the given x and y amounts. All subsequent painting will be performed in the resulting coordinate system.

Parameters:
dx - the horizontal offset
dy - the vertical offset

translate

public final void translate(
Point pt)
See Also:
translate(int, int)

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