|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.swtlayeredgraph.proxies.SwtGCImpl
public class SwtGCImpl
This class is provided as a proxy implementation of a SWT GC class. This allows for ease of unit testing classes that use the GC.
Field Summary |
---|
Fields inherited from interface net.sourceforge.swtlayeredgraph.proxies.SwtGC |
---|
BACKGROUND, BACKGROUND_BG, DRAW, DRAW_OFFSET, FILL, FONT, FOREGROUND, LINE_CAP, LINE_DASH, LINE_DASH_ZERO, LINE_DASHDOT, LINE_DASHDOT_ZERO, LINE_DASHDOTDOT, LINE_DASHDOTDOT_ZERO, LINE_DOT, LINE_DOT_ZERO, LINE_JOIN, LINE_MITERLIMIT, LINE_STYLE, LINE_WIDTH |
Constructor Summary | |
---|---|
SwtGCImpl(org.eclipse.swt.graphics.Drawable drawable)
Constructs a new instance of this class which has been configured to draw on the specified drawable. |
|
SwtGCImpl(org.eclipse.swt.graphics.Drawable drawable,
int style)
Constructs a new instance of this class which has been configured to draw on the specified drawable. |
|
SwtGCImpl(org.eclipse.swt.graphics.GC gc)
|
Method Summary | |
---|---|
void |
copyArea(org.eclipse.swt.graphics.Image image,
int x,
int y)
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)
Copies a rectangular area of the receiver at the source position onto the receiver at the destination position. |
void |
copyArea(int srcX,
int srcY,
int width,
int height,
int destX,
int destY,
boolean paint)
Copies a rectangular area of the receiver at the source position onto the receiver at the destination position. |
void |
dispose()
Disposes of the operating system resources associated with this resource. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws the outline of a circular or elliptical arc within the specified rectangular area. |
void |
drawFocus(int x,
int y,
int width,
int height)
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. |
void |
drawImage(org.eclipse.swt.graphics.Image image,
int x,
int y)
Draws the given image in the receiver at the specified coordinates. |
void |
drawImage(org.eclipse.swt.graphics.Image image,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
int destX,
int destY,
int destWidth,
int destHeight)
Copies a rectangular area from the source image into a (potentially different sized) rectangular area in the receiver. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
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)
Draws the outline of an oval, using the foreground color, within the specified rectangular area. |
void |
drawPath(org.eclipse.swt.graphics.Path path)
Draws the path described by the parameter. |
void |
drawPoint(int x,
int y)
Draws a pixel, using the foreground color, at the specified point ( x , y ). |
void |
drawPolygon(int[] pointArray)
Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color. |
void |
drawPolyline(int[] pointArray)
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)
Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. |
void |
drawRectangle(org.eclipse.swt.graphics.Rectangle rect)
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)
Draws the outline of the round-cornered rectangle specified by the arguments, using the receiver's foreground color. |
void |
drawString(java.lang.String string,
int x,
int y)
Draws the given string, using the receiver's current font and foreground color. |
void |
drawString(java.lang.String string,
int x,
int y,
boolean isTransparent)
Draws the given string, using the receiver's current font and foreground color. |
void |
drawText(java.lang.String string,
int x,
int y)
Draws the given string, using the receiver's current font and foreground color. |
void |
drawText(java.lang.String string,
int x,
int y,
boolean isTransparent)
Draws the given string, using the receiver's current font and foreground color. |
void |
drawText(java.lang.String string,
int x,
int y,
int flags)
Draws the given string, using the receiver's current font and foreground color. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
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)
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)
Fills the interior of an oval, within the specified rectangular area, with the receiver's background color. |
void |
fillPath(org.eclipse.swt.graphics.Path path)
Fills the path described by the parameter. |
void |
fillPolygon(int[] pointArray)
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)
Fills the interior of the rectangle specified by the arguments, using the receiver's background color. |
void |
fillRectangle(org.eclipse.swt.graphics.Rectangle rect)
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)
Fills the interior of the round-cornered rectangle specified by the arguments, using the receiver's background color. |
boolean |
getAdvanced()
Returns true if receiver is using the operating system's
advanced graphics subsystem. |
int |
getAdvanceWidth(char ch)
Returns the advance width of the specified character in the font which is currently selected into the receiver. |
int |
getAlpha()
Returns the receiver's alpha value. |
int |
getAntialias()
Returns the receiver's anti-aliasing setting value, which will be one of SWT.DEFAULT , SWT.OFF or SWT.ON . |
org.eclipse.swt.graphics.Color |
getBackground()
Returns the background color. |
org.eclipse.swt.graphics.Pattern |
getBackgroundPattern()
Returns the background pattern. |
int |
getCharWidth(char ch)
Returns the width of the specified character in the font selected into the receiver. |
org.eclipse.swt.graphics.Rectangle |
getClipping()
Returns the bounding rectangle of the receiver's clipping region. |
void |
getClipping(org.eclipse.swt.graphics.Region region)
Sets the region managed by the argument to the current clipping region of the receiver. |
org.eclipse.swt.graphics.Device |
getDevice()
Returns the Device where this resource was created. |
int |
getFillRule()
Returns the receiver's fill rule, which will be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING . |
org.eclipse.swt.graphics.Font |
getFont()
Returns the font currently being used by the receiver to draw and measure text. |
org.eclipse.swt.graphics.FontMetrics |
getFontMetrics()
Returns a FontMetrics which contains information about the font currently being used by the receiver to draw and measure text. |
org.eclipse.swt.graphics.Color |
getForeground()
Returns the receiver's foreground color. |
org.eclipse.swt.graphics.Pattern |
getForegroundPattern()
Returns the foreground pattern. |
org.eclipse.swt.graphics.GCData |
getGCData()
Returns the GCData. |
int |
getInterpolation()
Returns the receiver's interpolation setting, which will be one of SWT.DEFAULT , SWT.NONE , SWT.LOW or
SWT.HIGH . |
org.eclipse.swt.graphics.LineAttributes |
getLineAttributes()
Returns the receiver's line attributes. |
int |
getLineCap()
Returns the receiver's line cap style, which will be one of the constants SWT.CAP_FLAT , SWT.CAP_ROUND , or
SWT.CAP_SQUARE . |
int[] |
getLineDash()
Returns the receiver's line dash style. |
int |
getLineJoin()
Returns the receiver's line join style, which will be one of the constants SWT.JOIN_MITER , SWT.JOIN_ROUND , or
SWT.JOIN_BEVEL . |
int |
getLineStyle()
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()
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. |
int |
getStyle()
Returns the receiver's style information. |
int |
getTextAntialias()
Returns the receiver's text drawing anti-aliasing setting value, which will be one of SWT.DEFAULT , SWT.OFF or
SWT.ON . |
void |
getTransform(org.eclipse.swt.graphics.Transform transform)
Sets the parameter to the transform that is currently being used by the receiver. |
boolean |
getXORMode()
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. |
boolean |
isClipped()
Returns true if the receiver has a clipping region set into
it, and false otherwise. |
boolean |
isDisposed()
Returns true if the GC has been disposed, and
false otherwise. |
void |
setAdvanced(boolean advanced)
Sets the receiver to always use the operating system's advanced graphics subsystem for all graphics operations if the argument is true . |
void |
setAlpha(int alpha)
Sets the receiver's alpha value which must be between 0 (transparent) and 255 (opaque). |
void |
setAntialias(int antialias)
Sets the receiver's anti-aliasing value to the parameter, which must be one of SWT.DEFAULT , SWT.OFF or
SWT.ON . |
void |
setBackground(org.eclipse.swt.graphics.Color color)
Sets the background color. |
void |
setBackgroundPattern(org.eclipse.swt.graphics.Pattern pattern)
Sets the background pattern. |
void |
setClipping(int x,
int y,
int width,
int height)
Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the arguments. |
void |
setClipping(org.eclipse.swt.graphics.Path path)
Sets the area of the receiver which can be changed by drawing operations to the path specified by the argument. |
void |
setClipping(org.eclipse.swt.graphics.Rectangle rect)
Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the argument. |
void |
setClipping(org.eclipse.swt.graphics.Region region)
Sets the area of the receiver which can be changed by drawing operations to the region specified by the argument. |
void |
setFillRule(int rule)
Sets the receiver's fill rule to the parameter, which must be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING . |
void |
setFont(org.eclipse.swt.graphics.Font font)
Sets the font which will be used by the receiver to draw and measure text to the argument. |
void |
setForeground(org.eclipse.swt.graphics.Color color)
Sets the foreground color. |
void |
setForegroundPattern(org.eclipse.swt.graphics.Pattern pattern)
Sets the foreground pattern. |
void |
setInterpolation(int interpolation)
Sets the receiver's interpolation setting to the parameter, which must be one of SWT.DEFAULT , SWT.NONE ,
SWT.LOW or SWT.HIGH . |
void |
setLineAttributes(org.eclipse.swt.graphics.LineAttributes attributes)
Sets the receiver's line attributes. |
void |
setLineCap(int cap)
Sets the receiver's 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(int[] dashes)
Sets the receiver's line dash style to the argument. |
void |
setLineJoin(int join)
Sets the receiver's line join style to the argument, which must be one of the constants SWT.JOIN_MITER , SWT.JOIN_ROUND ,
or SWT.JOIN_BEVEL . |
void |
setLineStyle(int lineStyle)
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)
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 |
setTextAntialias(int antialias)
Sets the receiver's text anti-aliasing value to the parameter, which must be one of SWT.DEFAULT , SWT.OFF or
SWT.ON . |
void |
setTransform(org.eclipse.swt.graphics.Transform transform)
Sets the transform that is currently being used by the receiver. |
void |
setXORMode(boolean xor)
Deprecated. |
org.eclipse.swt.graphics.Point |
stringExtent(java.lang.String string)
Returns the extent of the given string. |
org.eclipse.swt.graphics.Point |
textExtent(java.lang.String string)
Returns the extent of the given string. |
org.eclipse.swt.graphics.Point |
textExtent(java.lang.String string,
int flags)
Returns the extent of the given string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.swtlayeredgraph.proxies.SwtGC |
---|
equals, hashCode, toString |
Constructor Detail |
---|
public SwtGCImpl(org.eclipse.swt.graphics.GC gc)
public SwtGCImpl(org.eclipse.swt.graphics.Drawable drawable)
You must dispose the graphics context when it is no longer required.
drawable
- the drawable to draw on
java.lang.IllegalArgumentException
- org.eclipse.swt.SWTError
- public SwtGCImpl(org.eclipse.swt.graphics.Drawable drawable, int style)
You must dispose the graphics context when it is no longer required.
drawable
- the drawable to draw onstyle
- the style of GC to construct
java.lang.IllegalArgumentException
- org.eclipse.swt.SWTError
- Method Detail |
---|
public void copyArea(org.eclipse.swt.graphics.Image image, int x, int y)
SwtGC
SWT.BITMAP
.
copyArea
in interface SwtGC
image
- the image to copy intox
- the x coordinate in the receiver of the area to be copiedy
- the y coordinate in the receiver of the area to be copiedpublic void copyArea(int srcX, int srcY, int width, int height, int destX, int destY)
SwtGC
copyArea
in interface SwtGC
srcX
- the x coordinate in the receiver of the area to be copiedsrcY
- the y coordinate in the receiver of the area to be copiedwidth
- the width of the area to copyheight
- the height of the area to copydestX
- the x coordinate in the receiver of the area to copy todestY
- the y coordinate in the receiver of the area to copy topublic void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint)
SwtGC
copyArea
in interface SwtGC
srcX
- the x coordinate in the receiver of the area to be copiedsrcY
- the y coordinate in the receiver of the area to be copiedwidth
- the width of the area to copyheight
- the height of the area to copydestX
- the x coordinate in the receiver of the area to copy todestY
- the y coordinate in the receiver of the area to copy topaint
- if true
paint events will be generated for old
and obscured areaspublic void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
SwtGC
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.
drawArc
in interface SwtGC
x
- the x coordinate of the upper-left corner of the arc to be
drawny
- the y coordinate of the upper-left corner of the arc to be
drawnwidth
- the width of the arc to be drawnheight
- the height of the arc to be drawnstartAngle
- the beginning anglearcAngle
- the angular extent of the arc, relative to the start anglepublic void drawFocus(int x, int y, int width, int height)
SwtGC
drawFocus
in interface SwtGC
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width of the rectangleheight
- the height of the rectangleSwtGC.drawRectangle(int, int, int, int)
public void drawImage(org.eclipse.swt.graphics.Image image, int x, int y)
SwtGC
drawImage
in interface SwtGC
image
- the image to drawx
- the x coordinate of where to drawy
- the y coordinate of where to drawpublic void drawImage(org.eclipse.swt.graphics.Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight)
SwtGC
drawImage
in interface SwtGC
image
- the source imagesrcX
- the x coordinate in the source image to copy fromsrcY
- the y coordinate in the source image to copy fromsrcWidth
- the width in pixels to copy from the sourcesrcHeight
- the height in pixels to copy from the sourcedestX
- the x coordinate in the destination to copy todestY
- the y coordinate in the destination to copy todestWidth
- the width in pixels of the destination rectangledestHeight
- the height in pixels of the destination rectanglepublic void drawLine(int x1, int y1, int x2, int y2)
SwtGC
x1
, y1
) and (x2
, y2
).
drawLine
in interface SwtGC
x1
- the first point's x coordinatey1
- the first point's y coordinatex2
- the second point's x coordinatey2
- the second point's y coordinatepublic void drawOval(int x, int y, int width, int height)
SwtGC
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.
drawOval
in interface SwtGC
x
- the x coordinate of the upper left corner of the oval to be
drawny
- the y coordinate of the upper left corner of the oval to be
drawnwidth
- the width of the oval to be drawnheight
- the height of the oval to be drawnpublic void drawPath(org.eclipse.swt.graphics.Path path)
SwtGC
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
drawPath
in interface SwtGC
path
- the path to drawPath
public void drawPoint(int x, int y)
SwtGC
x
, y
).
Note that the receiver's line attributes do not affect this operation.
drawPoint
in interface SwtGC
x
- the point's x coordinatey
- the point's y coordinatepublic void drawPolygon(int[] pointArray)
SwtGC
drawPolygon
in interface SwtGC
pointArray
- an array of alternating x and y values which are the vertices
of the polygonpublic void drawPolyline(int[] pointArray)
SwtGC
drawPolyline
in interface SwtGC
pointArray
- an array of alternating x and y values which are the corners
of the polylinepublic void drawRectangle(int x, int y, int width, int height)
SwtGC
x
and x + width
. The top and bottom
edges are at y
and y + height
.
drawRectangle
in interface SwtGC
x
- the x coordinate of the rectangle to be drawny
- the y coordinate of the rectangle to be drawnwidth
- the width of the rectangle to be drawnheight
- the height of the rectangle to be drawnpublic void drawRectangle(org.eclipse.swt.graphics.Rectangle rect)
SwtGC
rect.x
and rect.x + rect.width
. The top and
bottom edges are at rect.y
and
rect.y + rect.height
.
drawRectangle
in interface SwtGC
rect
- the rectangle to drawpublic void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight)
SwtGC
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, which are respectively the width and height of the ellipse
used to draw the corners.
drawRoundRectangle
in interface SwtGC
x
- the x coordinate of the rectangle to be drawny
- the y coordinate of the rectangle to be drawnwidth
- the width of the rectangle to be drawnheight
- the height of the rectangle to be drawnarcWidth
- the width of the arcarcHeight
- the height of the arcpublic void drawString(java.lang.String string, int x, int y)
SwtGC
drawString
in interface SwtGC
string
- the string to be drawnx
- the x coordinate of the top left corner of the rectangular
area where the string is to be drawny
- the y coordinate of the top left corner of the rectangular
area where the string is to be drawnpublic void drawString(java.lang.String string, int x, int y, boolean isTransparent)
SwtGC
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.
drawString
in interface SwtGC
string
- the string to be drawnx
- the x coordinate of the top left corner of the rectangular
area where the string is to be drawny
- the y coordinate of the top left corner of the rectangular
area where the string is to be drawnisTransparent
- if true
the background will be transparent,
otherwise it will be opaquepublic void drawText(java.lang.String string, int x, int y)
SwtGC
drawText
in interface SwtGC
string
- the string to be drawnx
- the x coordinate of the top left corner of the rectangular
area where the text is to be drawny
- the y coordinate of the top left corner of the rectangular
area where the text is to be drawnpublic void drawText(java.lang.String string, int x, int y, boolean isTransparent)
SwtGC
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.
drawText
in interface SwtGC
string
- the string to be drawnx
- the x coordinate of the top left corner of the rectangular
area where the text is to be drawny
- the y coordinate of the top left corner of the rectangular
area where the text is to be drawnisTransparent
- if true
the background will be transparent,
otherwise it will be opaquepublic void drawText(java.lang.String string, int x, int y, int flags)
SwtGC
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:
drawText
in interface SwtGC
string
- the string to be drawnx
- the x coordinate of the top left corner of the rectangular
area where the text is to be drawny
- the y coordinate of the top left corner of the rectangular
area where the text is to be drawnflags
- the flags specifying how to process the textpublic void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
SwtGC
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.
fillArc
in interface SwtGC
x
- the x coordinate of the upper-left corner of the arc to be
filledy
- the y coordinate of the upper-left corner of the arc to be
filledwidth
- the width of the arc to be filledheight
- the height of the arc to be filledstartAngle
- the beginning anglearcAngle
- the angular extent of the arc, relative to the start angleSwtGC.drawArc(int, int, int, int, int, int)
public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical)
SwtGC
fillGradientRectangle
in interface SwtGC
x
- the x coordinate of the rectangle to be filledy
- the y coordinate of the rectangle to be filledwidth
- 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
rightSwtGC.drawRectangle(int, int, int, int)
public void fillOval(int x, int y, int width, int height)
SwtGC
fillOval
in interface SwtGC
x
- the x coordinate of the upper left corner of the oval to be
filledy
- the y coordinate of the upper left corner of the oval to be
filledwidth
- the width of the oval to be filledheight
- the height of the oval to be filledSwtGC.drawOval(int, int, int, int)
public void fillPath(org.eclipse.swt.graphics.Path path)
SwtGC
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
fillPath
in interface SwtGC
path
- the path to fillPath
public void fillPolygon(int[] pointArray)
SwtGC
fillPolygon
in interface SwtGC
pointArray
- an array of alternating x and y values which are the vertices
of the polygonSwtGC.drawPolygon(int[])
public void fillRectangle(int x, int y, int width, int height)
SwtGC
fillRectangle
in interface SwtGC
x
- the x coordinate of the rectangle to be filledy
- the y coordinate of the rectangle to be filledwidth
- the width of the rectangle to be filledheight
- the height of the rectangle to be filledSwtGC.drawRectangle(int, int, int, int)
public void fillRectangle(org.eclipse.swt.graphics.Rectangle rect)
SwtGC
fillRectangle
in interface SwtGC
rect
- the rectangle to be filledSwtGC.drawRectangle(int, int, int, int)
public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight)
SwtGC
fillRoundRectangle
in interface SwtGC
x
- the x coordinate of the rectangle to be filledy
- the y coordinate of the rectangle to be filledwidth
- the width of the rectangle to be filledheight
- the height of the rectangle to be filledarcWidth
- the width of the arcarcHeight
- the height of the arcSwtGC.drawRoundRectangle(int, int, int, int, int, int)
public int getAdvanceWidth(char ch)
SwtGC
The advance width is defined as the horizontal distance the cursor should move after printing the character in the selected font.
getAdvanceWidth
in interface SwtGC
ch
- the character to measure
public boolean getAdvanced()
SwtGC
true
if receiver is using the operating system's
advanced graphics subsystem. Otherwise, false
is returned to
indicate that normal graphics are in use.
Advanced graphics may not be installed for the operating system. In this
case, false
is always returned. Some operating system have
only one graphics subsystem. If this subsystem supports advanced
graphics, then true
is always returned. If any graphics
operation such as alpha, antialias, patterns, interpolation, paths,
clipping or transformation has caused the receiver to switch from regular
to advanced graphics mode, true
is returned. If the receiver
has been explicitly switched to advanced mode and this mode is supported,
true
is returned.
getAdvanced
in interface SwtGC
SwtGC.setAdvanced(boolean)
public int getAlpha()
SwtGC
getAlpha
in interface SwtGC
public int getAntialias()
SwtGC
SWT.DEFAULT
, SWT.OFF
or SWT.ON
.
Note that this controls anti-aliasing for all non-text drawing
operations.
getAntialias
in interface SwtGC
SwtGC.getTextAntialias()
public org.eclipse.swt.graphics.Color getBackground()
SwtGC
getBackground
in interface SwtGC
public org.eclipse.swt.graphics.Pattern getBackgroundPattern()
SwtGC
null
.
getBackgroundPattern
in interface SwtGC
Pattern
public int getCharWidth(char ch)
SwtGC
The width is defined as the space taken up by the actual character, not including the leading and tailing whitespace or overhang.
getCharWidth
in interface SwtGC
ch
- the character to measure
public org.eclipse.swt.graphics.Rectangle getClipping()
SwtGC
getClipping
in interface SwtGC
public void getClipping(org.eclipse.swt.graphics.Region region)
SwtGC
getClipping
in interface SwtGC
region
- the region to fill with the clipping regionpublic int getFillRule()
SwtGC
SWT.FILL_EVEN_ODD
or SWT.FILL_WINDING
.
getFillRule
in interface SwtGC
public org.eclipse.swt.graphics.Font getFont()
SwtGC
getFont
in interface SwtGC
public org.eclipse.swt.graphics.FontMetrics getFontMetrics()
SwtGC
getFontMetrics
in interface SwtGC
public org.eclipse.swt.graphics.Color getForeground()
SwtGC
getForeground
in interface SwtGC
public org.eclipse.swt.graphics.Pattern getForegroundPattern()
SwtGC
null
.
getForegroundPattern
in interface SwtGC
Pattern
public org.eclipse.swt.graphics.GCData getGCData()
SwtGC
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.
getGCData
in interface SwtGC
GCData
public int getInterpolation()
SwtGC
SWT.DEFAULT
, SWT.NONE
, SWT.LOW
or
SWT.HIGH
.
getInterpolation
in interface SwtGC
public org.eclipse.swt.graphics.LineAttributes getLineAttributes()
SwtGC
getLineAttributes
in interface SwtGC
public int getLineCap()
SwtGC
SWT.CAP_FLAT
, SWT.CAP_ROUND
, or
SWT.CAP_SQUARE
.
getLineCap
in interface SwtGC
public int[] getLineDash()
SwtGC
null
.
getLineDash
in interface SwtGC
public int getLineJoin()
SwtGC
SWT.JOIN_MITER
, SWT.JOIN_ROUND
, or
SWT.JOIN_BEVEL
.
getLineJoin
in interface SwtGC
public int getLineStyle()
SwtGC
SWT.LINE_SOLID
, SWT.LINE_DASH
,
SWT.LINE_DOT
, SWT.LINE_DASHDOT
or
SWT.LINE_DASHDOTDOT
.
getLineStyle
in interface SwtGC
public int getLineWidth()
SwtGC
drawLine
,
drawRectangle
, drawPolyline
, and so forth.
getLineWidth
in interface SwtGC
public int getStyle()
SwtGC
Note that the value which is returned by this method may not match the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles.
getStyle
in interface SwtGC
public int getTextAntialias()
SwtGC
SWT.DEFAULT
, SWT.OFF
or
SWT.ON
. Note that this controls anti-aliasing only
for text drawing operations.
getTextAntialias
in interface SwtGC
SwtGC.getAntialias()
public void getTransform(org.eclipse.swt.graphics.Transform transform)
SwtGC
getTransform
in interface SwtGC
transform
- the destination to copy the transform intoTransform
public boolean getXORMode()
SwtGC
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.
getXORMode
in interface SwtGC
true
true if the receiver is in XOR mode, and false
otherwisepublic boolean isClipped()
SwtGC
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)
.
isClipped
in interface SwtGC
true
if the GC has a clipping region, and
false
otherwisepublic boolean isDisposed()
SwtGC
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.
isDisposed
in interface SwtGC
true
when the GC is disposed and false
otherwisepublic void setAdvanced(boolean advanced)
SwtGC
true
. If the argument is false
, the advanced
graphics subsystem is no longer used, advanced graphics state is cleared
and the normal graphics subsystem is used from now on.
Normally, the advanced graphics subsystem is invoked automatically when any one of the alpha, antialias, patterns, interpolation, paths, clipping or transformation operations in the receiver is requested. When the receiver is switched into advanced mode, the advanced graphics subsystem performs both advanced and normal graphics operations. Because the two subsystems are different, their output may differ. Switching to advanced graphics before any graphics operations are performed ensures that the output is consistent.
Advanced graphics may not be installed for the operating system. In this case, this operation does nothing. Some operating system have only one graphics subsystem, so switching from normal to advanced graphics does nothing. However, switching from advanced to normal graphics will always clear the advanced graphics state, even for operating systems that have only one graphics subsystem.
setAdvanced
in interface SwtGC
advanced
- the new advanced graphics stateSwtGC.setAlpha(int)
,
SwtGC.setAntialias(int)
,
SwtGC.setBackgroundPattern(org.eclipse.swt.graphics.Pattern)
,
SwtGC.setClipping(Path)
,
SwtGC.setForegroundPattern(org.eclipse.swt.graphics.Pattern)
,
SwtGC.setLineAttributes(org.eclipse.swt.graphics.LineAttributes)
,
SwtGC.setInterpolation(int)
,
SwtGC.setTextAntialias(int)
,
SwtGC.setTransform(org.eclipse.swt.graphics.Transform)
,
SwtGC.getAdvanced()
public void setAlpha(int alpha)
SwtGC
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setAlpha
in interface SwtGC
alpha
- the alpha valueSwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setAntialias(int antialias)
SwtGC
SWT.DEFAULT
, SWT.OFF
or
SWT.ON
. Note that this controls anti-aliasing for all
non-text drawing operations.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setAntialias
in interface SwtGC
antialias
- the anti-aliasing settingSwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
,
SwtGC.setTextAntialias(int)
public void setBackground(org.eclipse.swt.graphics.Color color)
SwtGC
setBackground
in interface SwtGC
color
- the new background color for the receiverpublic void setBackgroundPattern(org.eclipse.swt.graphics.Pattern pattern)
SwtGC
null
.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setBackgroundPattern
in interface SwtGC
pattern
- the new background patternPattern
,
SwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setClipping(int x, int y, int width, int height)
SwtGC
setClipping
in interface SwtGC
x
- the x coordinate of the clipping rectangley
- the y coordinate of the clipping rectanglewidth
- the width of the clipping rectangleheight
- the height of the clipping rectanglepublic void setClipping(org.eclipse.swt.graphics.Path path)
SwtGC
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setClipping
in interface SwtGC
path
- the clipping path.Path
,
SwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setClipping(org.eclipse.swt.graphics.Rectangle rect)
SwtGC
null
for the rectangle reverts the receiver's clipping area
to its original value.
setClipping
in interface SwtGC
rect
- the clipping rectangle or null
public void setClipping(org.eclipse.swt.graphics.Region region)
SwtGC
null
for
the region reverts the receiver's clipping area to its original value.
setClipping
in interface SwtGC
region
- the clipping region or null
public void setFillRule(int rule)
SwtGC
SWT.FILL_EVEN_ODD
or SWT.FILL_WINDING
.
setFillRule
in interface SwtGC
rule
- the new fill rulepublic void setFont(org.eclipse.swt.graphics.Font font)
SwtGC
setFont
in interface SwtGC
font
- the new font for the receiver, or null to indicate a default
fontpublic void setForeground(org.eclipse.swt.graphics.Color color)
SwtGC
setForeground
in interface SwtGC
color
- the new foreground color for the receiverpublic void setForegroundPattern(org.eclipse.swt.graphics.Pattern pattern)
SwtGC
null
.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setForegroundPattern
in interface SwtGC
pattern
- the new foreground patternPattern
,
SwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setInterpolation(int interpolation)
SwtGC
SWT.DEFAULT
, SWT.NONE
,
SWT.LOW
or SWT.HIGH
.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setInterpolation
in interface SwtGC
interpolation
- the new interpolation settingSwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setLineAttributes(org.eclipse.swt.graphics.LineAttributes attributes)
SwtGC
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setLineAttributes
in interface SwtGC
attributes
- the line attributesLineAttributes
,
SwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
public void setLineCap(int cap)
SwtGC
SWT.CAP_FLAT
, SWT.CAP_ROUND
, or
SWT.CAP_SQUARE
.
setLineCap
in interface SwtGC
cap
- the cap style to be used for drawing linespublic void setLineDash(int[] dashes)
SwtGC
null
. If the argument is not null
, the
receiver's line style is set to SWT.LINE_CUSTOM
, otherwise
it is set to SWT.LINE_SOLID
.
setLineDash
in interface SwtGC
dashes
- the dash style to be used for drawing linespublic void setLineJoin(int join)
SwtGC
SWT.JOIN_MITER
, SWT.JOIN_ROUND
,
or SWT.JOIN_BEVEL
.
setLineJoin
in interface SwtGC
join
- the join style to be used for drawing linespublic void setLineStyle(int lineStyle)
SwtGC
SWT.LINE_SOLID
, SWT.LINE_DASH
,
SWT.LINE_DOT
, SWT.LINE_DASHDOT
or
SWT.LINE_DASHDOTDOT
.
setLineStyle
in interface SwtGC
lineStyle
- the style to be used for drawing linespublic void setLineWidth(int lineWidth)
SwtGC
drawLine
,
drawRectangle
, drawPolyline
, and so forth.
Note that line width of zero is used as a hint to indicate that the fastest possible line drawing algorithms should be used. This means that the output may be different from line width one.
setLineWidth
in interface SwtGC
lineWidth
- the width of a linepublic void setTextAntialias(int antialias)
SwtGC
SWT.DEFAULT
, SWT.OFF
or
SWT.ON
. Note that this controls anti-aliasing only for all
text drawing operations.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setTextAntialias
in interface SwtGC
antialias
- the anti-aliasing settingSwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
,
SwtGC.setAntialias(int)
public void setTransform(org.eclipse.swt.graphics.Transform transform)
SwtGC
null
, the current transform is set to the
identity transform.
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
setTransform
in interface SwtGC
transform
- the transform to setTransform
,
SwtGC.getAdvanced()
,
SwtGC.setAdvanced(boolean)
@Deprecated public void setXORMode(boolean xor)
SwtGC
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.
Note that this mode in fundamentally unsupportable on certain platforms, notably Carbon (Mac OS X). Clients that want their code to run on all platforms need to avoid this method.
setXORMode
in interface SwtGC
xor
- if true
, then xor mode is used,
otherwise source copy mode is usedpublic org.eclipse.swt.graphics.Point stringExtent(java.lang.String string)
SwtGC
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).
stringExtent
in interface SwtGC
string
- the string to measure
public org.eclipse.swt.graphics.Point textExtent(java.lang.String string)
SwtGC
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).
textExtent
in interface SwtGC
string
- the string to measure
public org.eclipse.swt.graphics.Point textExtent(java.lang.String string, int flags)
SwtGC
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).
textExtent
in interface SwtGC
string
- the string to measureflags
- the flags specifying how to process the text
public void dispose()
SwtGC
dispose
in interface SwtGC
public org.eclipse.swt.graphics.Device getDevice()
SwtGC
Device
where this resource was created.
getDevice
in interface SwtGC
Device
the device of the receiver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |