org.eclipse.swt.graphics
Class GC

java.lang.Object
  |
  +--org.eclipse.swt.graphics.GC

public final class GC
extends Object

Unsafe:


Field Summary
(package private)  GCData data
           
(package private)  Drawable drawable
           
 int handle
          Suppressed: the handle to the OS device context (Warning: This field is platform dependent)
 
Constructor Summary
(package private) GC()
          Prevents uninitialized instances from being created outside the package.
  GC(Drawable drawable)
          Suppressed: Constructs a new instance of this class which has been configured to draw on the specified drawable.
 
Method Summary
 void copyArea(Image image, int x, int y)
          Enabled: Copies a rectangular area of the receiver at the specified position into the image, which must be of type SWT.BITMAP.
 void copyArea(int srcX, int srcY, int width, int height, int destX, int destY)
          Enabled: Copies a rectangular area of the receiver at the source position onto the receiver at the destination position.
(package private)  int createDIB(int width, int height)
           
 void dispose()
          Suppressed: Disposes of the operating system resources associated with the graphics context.
 void drawArc(int x, int y, int width, int height, int startAngle, int endAngle)
          Enabled: Draws the outline of a circular or elliptical arc within the specified rectangular area.
(package private)  void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple)
           
(package private)  void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, org.eclipse.swt.internal.win32.BITMAP bm, int imgWidth, int imgHeight)
           
(package private)  void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, org.eclipse.swt.internal.win32.BITMAP bm, int imgWidth, int imgHeight)
           
(package private)  void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, org.eclipse.swt.internal.win32.BITMAP bm, int imgWidth, int imgHeight)
           
 void drawFocus(int x, int y, int width, int height)
          Suppressed: Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground color.
(package private)  void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple)
           
 void drawImage(Image image, int x, int y)
          Enabled: Draws the given image in the receiver at the specified coordinates.
 void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight)
          Enabled: Copies a rectangular area from the source image into a (potentially different sized) rectangular area in the receiver.
(package private)  void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple)
           
 void drawLine(int x1, int y1, int x2, int y2)
          Enabled: Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
 void drawOval(int x, int y, int width, int height)
          Enabled: Draws the outline of an oval, using the foreground color, within the specified rectangular area.
 void drawPolygon(int[] pointArray)
          Enabled: Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color.
 void drawPolyline(int[] pointArray)
          Enabled: Draws the polyline which is defined by the specified array of integer coordinates, using the receiver's foreground color.
 void drawRectangle(int x, int y, int width, int height)
          Enabled: Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color.
 void drawRectangle(Rectangle rect)
          Enabled: Draws the outline of the specified rectangle, using the receiver's foreground color.
 void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight)
          Enabled: Draws the outline of the round-cornered rectangle specified by the arguments, using the receiver's foreground color.
 void drawString(String string, int x, int y)
          Enabled: Draws the given string, using the receiver's current font and foreground color.
 void drawString(String string, int x, int y, boolean isTransparent)
          Enabled: Draws the given string, using the receiver's current font and foreground color.
 void drawText(String string, int x, int y)
          Enabled: Draws the given string, using the receiver's current font and foreground color.
 void drawText(String string, int x, int y, boolean isTransparent)
          Enabled: Draws the given string, using the receiver's current font and foreground color.
 void drawText(String string, int x, int y, int flags)
          Enabled: Draws the given string, using the receiver's current font and foreground color.
 boolean equals(Object object)
          Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 void fillArc(int x, int y, int width, int height, int startAngle, int endAngle)
          Enabled: Fills the interior of a circular or elliptical arc within the specified rectangular area, with the receiver's background color.
 void fillGradientRectangle(int x, int y, int width, int height, boolean vertical)
          Enabled: Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom progressing from the receiver's foreground color to its background color.
 void fillOval(int x, int y, int width, int height)
          Enabled: Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
 void fillPolygon(int[] pointArray)
          Enabled: Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using the receiver's background color.
 void fillRectangle(int x, int y, int width, int height)
          Enabled: Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
 void fillRectangle(Rectangle rect)
          Enabled: Fills the interior of the specified rectangle, using the receiver's background color.
 void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight)
          Enabled: Fills the interior of the round-cornered rectangle specified by the arguments, using the receiver's background color.
 int getAdvanceWidth(char ch)
          Enabled: Returns the advance width of the specified character in the font which is currently selected into the receiver.
 Color getBackground()
          Enabled: Returns the background color.
 int getCharWidth(char ch)
          Enabled: Returns the width of the specified character in the font selected into the receiver.
 Rectangle getClipping()
          Enabled: Returns the bounding rectangle of the receiver's clipping region.
 void getClipping(Region region)
          Enabled: Sets the region managed by the argument to the current clipping region of the receiver.
(package private)  int getCodePage()
           
 Font getFont()
          Enabled: Returns the font currently being used by the receiver to draw and measure text.
 FontMetrics getFontMetrics()
          Enabled: Returns a FontMetrics which contains information about the font currently being used by the receiver to draw and measure text.
 Color getForeground()
          Enabled: Returns the receiver's foreground color.
 int getLineStyle()
          Enabled: Returns the receiver's line style, which will be one of the constants SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DOT, SWT.LINE_DASHDOT or SWT.LINE_DASHDOTDOT.
 int getLineWidth()
          Enabled: Returns the width that will be used when drawing lines for all of the figure drawing operations (that is, drawLine, drawRectangle, drawPolyline, and so forth.
 boolean getXORMode()
          Enabled: Returns true if this GC is drawing in the mode where the resulting color in the destination is the exclusive or of the color values in the source and the destination, and false if it is drawing in the mode where the destination color is being replaced with the source color value.
 int hashCode()
          Suppressed: Returns an integer hash code for the receiver.
(package private)  void init(Drawable drawable, GCData data, int hDC)
           
 boolean isClipped()
          Enabled: Returns true if the receiver has a clipping region set into it, and false otherwise.
 boolean isDisposed()
          Enabled: Returns true if the GC has been disposed, and false otherwise.
 void setBackground(Color color)
          Enabled: Sets the background color.
 void setClipping(int x, int y, int width, int height)
          Enabled: Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the arguments.
 void setClipping(Rectangle rect)
          Enabled: Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the argument.
 void setClipping(Region region)
          Enabled: Sets the area of the receiver which can be changed by drawing operations to the region specified by the argument.
 void setFont(Font font)
          Enabled: Sets the font which will be used by the receiver to draw and measure text to the argument.
 void setForeground(Color color)
          Enabled: Sets the foreground color.
 void setLineStyle(int lineStyle)
          Enabled: Sets the receiver's 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 lineWidth)
          Enabled: Sets the width that will be used when drawing lines for all of the figure drawing operations (that is, drawLine, drawRectangle, drawPolyline, and so forth.
 void setXORMode(boolean xor)
          Enabled: If the argument is true, puts the receiver in a drawing mode where the resulting color in the destination is the exclusive or of the color values in the source and the destination, and if the argument is false, puts the receiver in a drawing mode where the destination color is replaced with the source color value.
 Point stringExtent(String string)
          Enabled: Returns the extent of the given string.
 Point textExtent(String string)
          Enabled: Returns the extent of the given string.
 Point textExtent(String string, int flags)
          Enabled: Returns the extent of the given string.
 String toString()
          Suppressed: Returns a string containing a concise, human-readable description of the receiver.
static GC win32_new(Drawable drawable, GCData data)
          Suppressed: Invokes platform specific functionality to allocate a new graphics context.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

public int handle
Suppressed: the handle to the OS device context (Warning: This field is platform dependent)


drawable

Drawable drawable

data

GCData data
Constructor Detail

GC

GC()
Prevents uninitialized instances from being created outside the package.


GC

public GC(Drawable drawable)
Suppressed: Constructs a new instance of this class which has been configured to draw on the specified drawable. Sets the foreground and background color in the GC to match those in the drawable.

You must dispose the graphics context when it is no longer required.

Parameters:
drawable - the drawable to draw on
Method Detail

copyArea

public void copyArea(Image image,
                     int x,
                     int y)
Enabled: Copies a rectangular area of the receiver at the specified position into the image, which must be of type SWT.BITMAP.

Parameters:
x - the x coordinate in the receiver of the area to be copied
y - the y coordinate in the receiver of the area to be copied

copyArea

public void copyArea(int srcX,
                     int srcY,
                     int width,
                     int height,
                     int destX,
                     int destY)
Enabled: Copies a rectangular area of the receiver at the source position onto the receiver at the destination position.

Parameters:
srcX - the x coordinate in the receiver of the area to be copied
srcY - the y coordinate in the receiver of the area to be copied
width - the width of the area to copy
height - the height of the area to copy
destX - the x coordinate in the receiver of the area to copy to
destY - the y coordinate in the receiver of the area to copy to

createDIB

int createDIB(int width,
              int height)

dispose

public void dispose()
Suppressed: Disposes of the operating system resources associated with the graphics context. Applications must dispose of all GCs which they allocate.


drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int endAngle)
Enabled: Draws the outline of a circular or elliptical arc within the specified rectangular area.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

Parameters:
x - the x coordinate of the upper-left corner of the arc to be drawn
y - the y coordinate of the upper-left corner of the arc to be drawn
width - the width of the arc to be drawn
height - the height of the arc to be drawn
startAngle - the beginning angle

drawFocus

public void drawFocus(int x,
                      int y,
                      int width,
                      int height)
Suppressed: Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground color.

Parameters:
x - the x coordinate of the rectangle
y - the y coordinate of the rectangle
width - the width of the rectangle
height - the height of the rectangle
See Also:
drawRectangle(int, int, int, int)

drawImage

public void drawImage(Image image,
                      int x,
                      int y)
Enabled: Draws the given image in the receiver at the specified coordinates.

Parameters:
image - the image to draw
x - the x coordinate of where to draw
y - the y coordinate of where to draw

drawImage

public void drawImage(Image image,
                      int srcX,
                      int srcY,
                      int srcWidth,
                      int srcHeight,
                      int destX,
                      int destY,
                      int destWidth,
                      int destHeight)
Enabled: Copies a rectangular area from the source image into a (potentially different sized) rectangular area in the receiver. If the source and destination areas are of differing sizes, then the source area will be stretched or shrunk to fit the destination area as it is copied. The copy fails if any part of the source rectangle lies outside the bounds of the source image, or if any of the width or height arguments are negative.

Parameters:
image - the source image
srcX - the x coordinate in the source image to copy from
srcY - the y coordinate in the source image to copy from
srcWidth - the width in pixels to copy from the source
srcHeight - the height in pixels to copy from the source
destX - the x coordinate in the destination to copy to
destY - the y coordinate in the destination to copy to
destWidth - the width in pixels of the destination rectangle
destHeight - the height in pixels of the destination rectangle

drawImage

void drawImage(Image srcImage,
               int srcX,
               int srcY,
               int srcWidth,
               int srcHeight,
               int destX,
               int destY,
               int destWidth,
               int destHeight,
               boolean simple)

drawIcon

void drawIcon(Image srcImage,
              int srcX,
              int srcY,
              int srcWidth,
              int srcHeight,
              int destX,
              int destY,
              int destWidth,
              int destHeight,
              boolean simple)

drawBitmap

void drawBitmap(Image srcImage,
                int srcX,
                int srcY,
                int srcWidth,
                int srcHeight,
                int destX,
                int destY,
                int destWidth,
                int destHeight,
                boolean simple)

drawBitmapAlpha

void drawBitmapAlpha(Image srcImage,
                     int srcX,
                     int srcY,
                     int srcWidth,
                     int srcHeight,
                     int destX,
                     int destY,
                     int destWidth,
                     int destHeight,
                     boolean simple,
                     org.eclipse.swt.internal.win32.BITMAP bm,
                     int imgWidth,
                     int imgHeight)

drawBitmapTransparent

void drawBitmapTransparent(Image srcImage,
                           int srcX,
                           int srcY,
                           int srcWidth,
                           int srcHeight,
                           int destX,
                           int destY,
                           int destWidth,
                           int destHeight,
                           boolean simple,
                           org.eclipse.swt.internal.win32.BITMAP bm,
                           int imgWidth,
                           int imgHeight)

drawBitmap

void drawBitmap(Image srcImage,
                int srcX,
                int srcY,
                int srcWidth,
                int srcHeight,
                int destX,
                int destY,
                int destWidth,
                int destHeight,
                boolean simple,
                org.eclipse.swt.internal.win32.BITMAP bm,
                int imgWidth,
                int imgHeight)

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Enabled: Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).

Parameters:
x1 - the first point's x coordinate
y1 - the first point's y coordinate
x2 - the second point's x coordinate
y2 - the second point's y coordinate

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Enabled: Draws the outline of an oval, using the foreground color, within the specified rectangular area.

The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

The oval covers an area that is width + 1 pixels wide and height + 1 pixels tall.

Parameters:
x - the x coordinate of the upper left corner of the oval to be drawn
y - the y coordinate of the upper left corner of the oval to be drawn
width - the width of the oval to be drawn
height - the height of the oval to be drawn

drawPolygon

public void drawPolygon(int[] pointArray)
Enabled: Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color. The array contains alternating x and y values which are considered to represent points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and last pair in the array.

Parameters:
pointArray - an array of alternating x and y values which are the vertices of the polygon

drawPolyline

public void drawPolyline(int[] pointArray)
Enabled: Draws the polyline which is defined by the specified array of integer coordinates, using the receiver's foreground color. The array contains alternating x and y values which are considered to represent points which are the corners of the polyline. Lines are drawn between each consecutive pair, but not between the first pair and last pair in the array.

Parameters:
pointArray - an array of alternating x and y values which are the corners of the polyline

drawRectangle

public void drawRectangle(int x,
                          int y,
                          int width,
                          int height)
Enabled: Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height.

Parameters:
x - the x coordinate of the rectangle to be drawn
y - the y coordinate of the rectangle to be drawn
width - the width of the rectangle to be drawn
height - the height of the rectangle to be drawn

drawRectangle

public void drawRectangle(Rectangle rect)
Enabled: Draws the outline of the specified rectangle, using the receiver's foreground color. The left and right edges of the rectangle are at rect.x and rect.x + rect.width. The top and bottom edges are at rect.y and rect.y + rect.height.

Parameters:
rect - the rectangle to draw

drawRoundRectangle

public void drawRoundRectangle(int x,
                               int y,
                               int width,
                               int height,
                               int arcWidth,
                               int arcHeight)
Enabled: Draws the outline of the round-cornered rectangle specified by the arguments, using the receiver's foreground color. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height. The roundness of the corners is specified by the arcWidth and arcHeight arguments.

Parameters:
x - the x coordinate of the rectangle to be drawn
y - the y coordinate of the rectangle to be drawn
width - the width of the rectangle to be drawn
height - the height of the rectangle to be drawn
arcWidth - the horizontal diameter of the arc at the four corners
arcHeight - the vertical diameter of the arc at the four corners

drawString

public void drawString(String string,
                       int x,
                       int y)
Enabled: Draws the given string, using the receiver's current font and foreground color. No tab expansion or carriage return processing will be performed. The background of the rectangular area where the string is being drawn will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the string is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the string is to be drawn

drawString

public void drawString(String string,
                       int x,
                       int y,
                       boolean isTransparent)
Enabled: Draws the given string, using the receiver's current font and foreground color. No tab expansion or carriage return processing will be performed. If isTransparent is true, then the background of the rectangular area where the string is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the string is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the string is to be drawn
isTransparent - if true the background will be transparent, otherwise it will be opaque

drawText

public void drawText(String string,
                     int x,
                     int y)
Enabled: Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return processing are performed. The background of the rectangular area where the text is being drawn will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the text is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the text is to be drawn

drawText

public void drawText(String string,
                     int x,
                     int y,
                     boolean isTransparent)
Enabled: Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return processing are performed. If isTransparent is true, then the background of the rectangular area where the text is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the text is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the text is to be drawn
isTransparent - if true the background will be transparent, otherwise it will be opaque

drawText

public void drawText(String string,
                     int x,
                     int y,
                     int flags)
Enabled: Draws the given string, using the receiver's current font and foreground color. Tab expansion, line delimiter and mnemonic processing are performed according to the specified flags. If flags includes DRAW_TRANSPARENT, then the background of the rectangular area where the text is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

The parameter flags may be a combination of:

DRAW_DELIMITER
draw multiple lines
DRAW_TAB
expand tabs
DRAW_MNEMONIC
underline the mnemonic character
DRAW_TRANSPARENT
transparent background

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the text is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the text is to be drawn
flags - the flags specifing how to process the text

equals

public boolean equals(Object object)
Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
equals in class Object
Parameters:
object - the object to compare with this object
Returns:
true if the object is the same as this object and false otherwise
See Also:
hashCode()

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int endAngle)
Enabled: Fills the interior of a circular or elliptical arc within the specified rectangular area, with the receiver's background color.

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

Parameters:
x - the x coordinate of the upper-left corner of the arc to be filled
y - the y coordinate of the upper-left corner of the arc to be filled
width - the width of the arc to be filled
height - the height of the arc to be filled
startAngle - the beginning angle
See Also:
drawArc(int, int, int, int, int, int)

fillGradientRectangle

public void fillGradientRectangle(int x,
                                  int y,
                                  int width,
                                  int height,
                                  boolean vertical)
Enabled: Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom progressing from the receiver's foreground color to its background color.

Parameters:
x - the x coordinate of the rectangle to be filled
y - the y coordinate of the rectangle to be filled
width - the width of the rectangle to be filled, may be negative (inverts direction of gradient if horizontal)
height - the height of the rectangle to be filled, may be negative (inverts direction of gradient if vertical)
vertical - if true sweeps from top to bottom, else sweeps from left to right
See Also:
drawRectangle(int, int, int, int)

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Enabled: Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.

Parameters:
x - the x coordinate of the upper left corner of the oval to be filled
y - the y coordinate of the upper left corner of the oval to be filled
width - the width of the oval to be filled
height - the height of the oval to be filled
See Also:
drawOval(int, int, int, int)

fillPolygon

public void fillPolygon(int[] pointArray)
Enabled: Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using the receiver's background color. The array contains alternating x and y values which are considered to represent points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and last pair in the array.

Parameters:
pointArray - an array of alternating x and y values which are the vertices of the polygon
See Also:
drawPolygon(int[])

fillRectangle

public void fillRectangle(int x,
                          int y,
                          int width,
                          int height)
Enabled: Fills the interior of the rectangle specified by the arguments, using the receiver's background color.

Parameters:
x - the x coordinate of the rectangle to be filled
y - the y coordinate of the rectangle to be filled
width - the width of the rectangle to be filled
height - the height of the rectangle to be filled
See Also:
drawRectangle(int, int, int, int)

fillRectangle

public void fillRectangle(Rectangle rect)
Enabled: Fills the interior of the specified rectangle, using the receiver's background color.

See Also:
drawRectangle(int, int, int, int)

fillRoundRectangle

public void fillRoundRectangle(int x,
                               int y,
                               int width,
                               int height,
                               int arcWidth,
                               int arcHeight)
Enabled: Fills the interior of the round-cornered rectangle specified by the arguments, using the receiver's background color.

Parameters:
x - the x coordinate of the rectangle to be filled
y - the y coordinate of the rectangle to be filled
width - the width of the rectangle to be filled
height - the height of the rectangle to be filled
arcWidth - the horizontal diameter of the arc at the four corners
arcHeight - the vertical diameter of the arc at the four corners
See Also:
drawRoundRectangle(int, int, int, int, int, int)

getAdvanceWidth

public int getAdvanceWidth(char ch)
Enabled: Returns the advance width of the specified character in the font which is currently selected into the receiver.

The advance width is defined as the horizontal distance the cursor should move after printing the character in the selected font.

Parameters:
ch - the character to measure
Returns:
the distance in the x direction to move past the character before painting the next

getBackground

public Color getBackground()
Enabled: Returns the background color.

Returns:
the receiver's background color

getCharWidth

public int getCharWidth(char ch)
Enabled: Returns the width of the specified character in the font selected into the receiver.

The width is defined as the space taken up by the actual character, not including the leading and tailing whitespace or overhang.

Parameters:
ch - the character to measure
Returns:
the width of the character

getClipping

public Rectangle getClipping()
Enabled: Returns the bounding rectangle of the receiver's clipping region. If no clipping region is set, the return value will be a rectangle which covers the entire bounds of the object the receiver is drawing on.

Returns:
the bounding rectangle of the clipping region

getClipping

public void getClipping(Region region)
Enabled: Sets the region managed by the argument to the current clipping region of the receiver.

Parameters:
region - the region to fill with the clipping region

getCodePage

int getCodePage()

getFont

public Font getFont()
Enabled: Returns the font currently being used by the receiver to draw and measure text.

Returns:
the receiver's font

getFontMetrics

public FontMetrics getFontMetrics()
Enabled: Returns a FontMetrics which contains information about the font currently being used by the receiver to draw and measure text.

Returns:
font metrics for the receiver's font

getForeground

public Color getForeground()
Enabled: Returns the receiver's foreground color.

Returns:
the color used for drawing foreground things

getLineStyle

public int getLineStyle()
Enabled: Returns the receiver's line style, which will be one of the constants SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DOT, SWT.LINE_DASHDOT or SWT.LINE_DASHDOTDOT.

Returns:
the style used for drawing lines

getLineWidth

public int getLineWidth()
Enabled: Returns the width that will be used when drawing lines for all of the figure drawing operations (that is, drawLine, drawRectangle, drawPolyline, and so forth.

Returns:
the receiver's line width

getXORMode

public boolean getXORMode()
Enabled: Returns true if this GC is drawing in the mode where the resulting color in the destination is the exclusive or of the color values in the source and the destination, and false if it is drawing in the mode where the destination color is being replaced with the source color value.

Returns:
true true if the receiver is in XOR mode, and false otherwise

init

void init(Drawable drawable,
          GCData data,
          int hDC)

hashCode

public int hashCode()
Suppressed: Returns an integer hash code for the receiver. Any two objects which return true when passed to equals must return the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

isClipped

public boolean isClipped()
Enabled: Returns true if the receiver has a clipping region set into it, and false otherwise. If this method returns false, the receiver will draw on all available space in the destination. If it returns true, it will draw only in the area that is covered by the region that can be accessed with getClipping(region).

Returns:
true if the GC has a clipping region, and false otherwise

isDisposed

public boolean isDisposed()
Enabled: Returns true if the GC has been disposed, and false otherwise.

This method gets the dispose state for the GC. When a GC has been disposed, it is an error to invoke any other method using the GC.

Returns:
true when the GC is disposed and false otherwise

setBackground

public void setBackground(Color color)
Enabled: Sets the background color. The background color is used for fill operations and as the background color when text is drawn.

Parameters:
color - the new background color for the receiver

setClipping

public void setClipping(int x,
                        int y,
                        int width,
                        int height)
Enabled: Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the arguments.

Parameters:
x - the x coordinate of the clipping rectangle
y - the y coordinate of the clipping rectangle
width - the width of the clipping rectangle
height - the height of the clipping rectangle

setClipping

public void setClipping(Rectangle rect)
Enabled: Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the argument.

Parameters:
rect - the clipping rectangle

setClipping

public void setClipping(Region region)
Enabled: Sets the area of the receiver which can be changed by drawing operations to the region specified by the argument.


setFont

public void setFont(Font font)
Enabled: Sets the font which will be used by the receiver to draw and measure text to the argument. If the argument is null, then a default font appropriate for the platform will be used instead.

Parameters:
font - the new font for the receiver, or null to indicate a default font

setForeground

public void setForeground(Color color)
Enabled: Sets the foreground color. The foreground color is used for drawing operations including when text is drawn.

Parameters:
color - the new foreground color for the receiver

setLineStyle

public void setLineStyle(int lineStyle)
Enabled: Sets the receiver's 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:
lineStyle - the style to be used for drawing lines

setLineWidth

public void setLineWidth(int lineWidth)
Enabled: Sets the width that will be used when drawing lines for all of the figure drawing operations (that is, drawLine, drawRectangle, drawPolyline, and so forth.

Parameters:
lineWidth - the width of a line

setXORMode

public void setXORMode(boolean xor)
Enabled: If the argument is true, puts the receiver in a drawing mode where the resulting color in the destination is the exclusive or of the color values in the source and the destination, and if the argument is false, puts the receiver in a drawing mode where the destination color is replaced with the source color value.

Parameters:
xor - if true, then xor mode is used, otherwise source copy mode is used

stringExtent

public Point stringExtent(String string)
Enabled: Returns the extent of the given string. No tab expansion or carriage return processing will be performed.

The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font (in this case, the current font in the receiver).

Parameters:
string - the string to measure
Returns:
a point containing the extent of the string

textExtent

public Point textExtent(String string)
Enabled: Returns the extent of the given string. Tab expansion and carriage return processing are performed.

The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font (in this case, the current font in the receiver).

Parameters:
string - the string to measure
Returns:
a point containing the extent of the string

textExtent

public Point textExtent(String string,
                        int flags)
Enabled: Returns the extent of the given string. Tab expansion, line delimiter and mnemonic processing are performed according to the specified flags, which can be a combination of:
DRAW_DELIMITER
draw multiple lines
DRAW_TAB
expand tabs
DRAW_MNEMONIC
underline the mnemonic character
DRAW_TRANSPARENT
transparent background

The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font (in this case, the current font in the receiver).

Parameters:
string - the string to measure
flags - the flags specifing how to process the text
Returns:
a point containing the extent of the string

toString

public String toString()
Suppressed: Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a string representation of the receiver

win32_new

public static GC win32_new(Drawable drawable,
                           GCData data)
Suppressed: Invokes platform specific functionality to allocate a new graphics context.

IMPORTANT: This method is not part of the public API for GC. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

Parameters:
drawable - the Drawable for the receiver.
data - the data for the receiver.
Returns:
a new GC


comments?