|
Eclipse Draw2d 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.Graphics
org.eclipse.draw2d.ScaledGraphics
A Graphics object able to scale all operations based on the current scale factor.
Nested Class Summary | |
protected static class |
ScaledGraphics.State
The internal state of the scaled graphics. |
Field Summary |
Fields inherited from class org.eclipse.draw2d.Graphics |
LINE_CUSTOM, LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID |
Constructor Summary | |
ScaledGraphics(Graphics g)
Constructs a new ScaledGraphics based on the given Graphics object. |
Method Summary | |
void |
clipRect(Rectangle r)
Sets the clip region to the given rectangle. |
void |
dispose()
Disposes this object, releasing any resources. |
void |
drawArc(int x,
int y,
int w,
int h,
int offset,
int sweep)
Draws the outline of an arc located at (x,y) with width w and height h. |
void |
drawFocus(int x,
int y,
int w,
int h)
Draws a focus rectangle. |
void |
drawImage(Image srcImage,
int x,
int y)
Draws the given Image at the location (x,y). |
void |
drawImage(Image srcImage,
int sx,
int sy,
int sw,
int sh,
int tx,
int ty,
int tw,
int th)
Draws a rectangular section of the given Image to the specified rectangular reagion on the canvas. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line between the points (x1,y1) and (x2,y2) using the
foreground color. |
void |
drawOval(int x,
int y,
int w,
int h)
Draws the outline of an ellipse that fits inside the rectangle with the given properties using the foreground color. |
void |
drawPoint(int x,
int y)
Draws a pixel, using the foreground color, at the specified point ( x ,
y ).
|
void |
drawPolygon(int[] points)
Draws a closed polygon defined by the given Integer array containing the vertices in x,y order. |
void |
drawPolygon(PointList points)
Draws a closed polygon defined by the given PointList containing the
vertices. |
void |
drawPolyline(int[] points)
Draws a polyline defined by the given Integer array containing the vertices in x,y order. |
void |
drawPolyline(PointList points)
Draws a polyline defined by the given PointList containing the vertices.
|
void |
drawRectangle(int x,
int y,
int w,
int h)
Draws a rectangle whose top-left corner is located at the point (x,y) with the given width and height. |
void |
drawRoundRectangle(Rectangle r,
int arcWidth,
int arcHeight)
Draws a rectangle with rounded corners using the foreground color. |
void |
drawString(String s,
int x,
int y)
Draws the given string using the current font and foreground color. |
void |
drawText(String s,
int x,
int y)
Draws the given string using the current font and foreground color. |
void |
drawText(String s,
int x,
int y,
int style)
Draws a string using the specified styles. |
void |
drawTextLayout(TextLayout layout,
int x,
int y,
int selectionStart,
int selectionEnd,
Color selectionForeground,
Color selectionBackground)
|
void |
fillArc(int x,
int y,
int w,
int h,
int offset,
int sweep)
Fills the interior of an arc located at (x,y) with width w and height h. |
void |
fillGradient(int x,
int y,
int w,
int h,
boolean vertical)
Fills the the given rectangle with a gradient from the foreground color to the background color. |
void |
fillOval(int x,
int y,
int w,
int h)
Fills an ellipse that fits inside the rectangle with the given properties using the background color. |
void |
fillPolygon(int[] points)
Fills a closed polygon defined by the given Integer array containing the vertices in x,y order. |
void |
fillPolygon(PointList points)
Fills a closed polygon defined by the given PointList containing the
vertices. |
void |
fillRectangle(int x,
int y,
int w,
int h)
Fills a rectangle whose top-left corner is located at the point (x,y) with the given width and height. |
void |
fillRoundRectangle(Rectangle r,
int arcWidth,
int arcHeight)
Fills a rectangle with rounded corners using the background color. |
void |
fillString(String s,
int x,
int y)
Draws the given string using the current font and foreground color. |
void |
fillText(String s,
int x,
int y)
Draws the given string using the current font and foreground color. |
double |
getAbsoluteScale()
Returns the current absolute scaling which will be applied to the underlying Device when painting to this Graphics. |
int |
getAlpha()
Returns the current alpha value of the graphics. |
int |
getAntialias()
Returns the anti-aliasing setting value, which will be one of SWT.DEFAULT ,
SWT.OFF or SWT.ON . |
Color |
getBackgroundColor()
Returns the background color used for filling. |
Rectangle |
getClip(Rectangle rect)
Modifies the given rectangle to match the clip region and returns that rectangle. |
int |
getFillRule()
Returns the fill rule, which will be one of SWT.FILL_EVEN_ODD or
SWT.FILL_WINDING . |
Font |
getFont()
Returns the font used to draw and fill text. |
FontMetrics |
getFontMetrics()
Returns the font metrics for the current font. |
Color |
getForegroundColor()
Returns the foreground color used to draw lines and text. |
int |
getInterpolation()
Returns the interpolation setting, which will be one of SWT.DEFAULT ,
SWT.NONE , SWT.LOW or SWT.HIGH . |
int |
getLineCap()
Returns the current line cap style, which will be one of the constants SWT.CAP_FLAT , SWT.CAP_ROUND , or SWT.CAP_SQUARE . |
int |
getLineJoin()
Returns the line join style, which will be one of the constants SWT.JOIN_MITER , SWT.JOIN_ROUND , or
SWT.JOIN_BEVEL . |
int |
getLineStyle()
Returns the line style. |
int |
getLineWidth()
Returns the current line width. |
int |
getTextAntialias()
Returns the textual anti-aliasing setting value, which will be one of SWT.DEFAULT , SWT.OFF or SWT.ON . |
boolean |
getXORMode()
Returns true if this graphics object should use XOR mode with painting. |
void |
popState()
Pops the previous state of this graphics object off the stack (if pushState()
has previously been called) and restores the current state to that popped state. |
void |
pushState()
Pushes the current state of this graphics object onto a stack. |
void |
restoreState()
Restores the previous state of this graphics object. |
void |
scale(double amount)
Scales this graphics object by the given amount. |
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 . |
void |
setBackgroundColor(Color rgb)
Sets the background color. |
void |
setClip(Rectangle r)
Sets the clip rectangle. |
void |
setFillRule(int rule)
Sets the fill rule to the given value, which must be one of SWT.FILL_EVEN_ODD or SWT.FILL_WINDING . |
void |
setFont(Font f)
Sets the font. |
void |
setForegroundColor(Color rgb)
Sets the foreground color. |
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 |
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(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 . |
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 . |
void |
setLineWidth(int 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 . |
void |
setXORMode(boolean b)
Sets the XOR mode. |
void |
translate(int dx,
int dy)
Translates the receiver's coordinates by the specified x and y amounts. |
Methods inherited from class org.eclipse.draw2d.Graphics |
drawArc, drawFocus, drawImage, drawImage, drawLine, drawOval, drawPath, drawRectangle, drawString, drawText, drawText, drawTextLayout, fillArc, fillGradient, fillOval, fillPath, fillRectangle, fillString, fillText, rotate, scale, setBackgroundPattern, setClip, setForegroundPattern, shear, translate, translate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ScaledGraphics(Graphics g)
g
- the base graphics objectMethod Detail |
public void clipRect(Rectangle r)
Graphics
clipRect
in class Graphics
r
- the clip rectangleGraphics.clipRect(Rectangle)
public void dispose()
Graphics
dispose
in class Graphics
Graphics.dispose()
public void drawArc(int x, int y, int w, int h, int offset, int sweep)
Graphics
drawArc
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightoffset
- the start anglesweep
- the length of the arcGraphics.drawArc(int, int, int, int, int, int)
public void drawFocus(int x, int y, int w, int h)
Graphics
drawFocus
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightGraphics.drawFocus(int, int, int, int)
public void drawImage(Image srcImage, int x, int y)
Graphics
drawImage
in class Graphics
srcImage
- the Imagex
- the x coordinatey
- the y coordinateGraphics.drawImage(Image, int, int)
public void drawImage(Image srcImage, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
Graphics
drawImage
in class Graphics
srcImage
- the imagesx
- the x coordinate of the sourcesy
- the y coordinate of the sourcesw
- the width of the sourcesh
- the height of the sourcetx
- the x coordinate of the destinationty
- the y coordinate of the destinationtw
- the width of the destinationth
- the height of the destinationGraphics.drawImage(Image, int, int, int, int, int, int, int, int)
public void drawLine(int x1, int y1, int x2, int y2)
Graphics
(x1,y1)
and (x2,y2)
using the
foreground color.
drawLine
in class Graphics
x1
- the x coordinate for the first pointy1
- the y coordinate for the first pointx2
- the x coordinate for the second pointy2
- the y coordinate for the second pointGraphics.drawLine(int, int, int, int)
public void drawOval(int x, int y, int w, int h)
Graphics
drawOval
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightGraphics.drawOval(int, int, int, int)
public void drawPoint(int x, int y)
Graphics
x
,
y
).
Note that the current line attributes do not affect this operation.
drawPoint
in class Graphics
x
- the point's x coordinatey
- the point's y coordinateGraphics.drawPoint(int, int)
public void drawPolygon(int[] points)
Graphics
drawPolygon
in class Graphics
points
- the verticesGraphics.drawPolygon(int[])
public void drawPolygon(PointList points)
Graphics
PointList
containing the
vertices. The first and last points in the list will be connected.
drawPolygon
in class Graphics
points
- the verticesGraphics.drawPolygon(PointList)
public void drawPolyline(int[] points)
Graphics
drawPolyline
in class Graphics
points
- the verticesGraphics.drawPolyline(int[])
public void drawPolyline(PointList points)
Graphics
PointList
containing the vertices.
The first and last points in the list will not be connected.
drawPolyline
in class Graphics
points
- the verticesGraphics.drawPolyline(PointList)
public void drawRectangle(int x, int y, int w, int h)
Graphics
drawRectangle
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightGraphics.drawRectangle(int, int, int, int)
public void drawRoundRectangle(Rectangle r, int arcWidth, int arcHeight)
Graphics
drawRoundRectangle
in class Graphics
r
- the rectanglearcWidth
- the arc widtharcHeight
- the arc heightGraphics.drawRoundRectangle(Rectangle, int, int)
public void drawString(String s, int x, int y)
Graphics
drawString
in class Graphics
s
- the stringx
- the x coordinatey
- the y coordinateGraphics.drawString(String, int, int)
public void drawText(String s, int x, int y)
Graphics
drawText
in class Graphics
s
- the textx
- the x coordinatey
- the y coordinateGraphics.drawText(String, int, int)
public void drawText(String s, int x, int y, int style)
Graphics
GC.drawText(String, int, int, int)
.
drawText
in class Graphics
s
- the String to drawx
- the x locationy
- the y locationstyle
- the styles used to render the stringGraphics.drawText(String, int, int, int)
public void drawTextLayout(TextLayout layout, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground)
drawTextLayout
in class Graphics
x
- the x locationy
- the y locationlayout
- the TextLayout being renderedselectionStart
- the start of selectionselectionEnd
- the end of selectionselectionForeground
- the foreground selection colorselectionBackground
- the background selection colorGraphics.drawTextLayout(TextLayout, int, int, int, int, Color, Color)
public void fillArc(int x, int y, int w, int h, int offset, int sweep)
Graphics
fillArc
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightoffset
- the start anglesweep
- the length of the arcGraphics.fillArc(int, int, int, int, int, int)
public void fillGradient(int x, int y, int w, int h, boolean vertical)
Graphics
true
, the gradient will go from
top to bottom. Otherwise, it will go from left to right.
background color.
fillGradient
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightvertical
- whether the gradient should be verticalGraphics.fillGradient(int, int, int, int, boolean)
public void fillOval(int x, int y, int w, int h)
Graphics
fillOval
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightGraphics.fillOval(int, int, int, int)
public void fillPolygon(int[] points)
Graphics
fillPolygon
in class Graphics
points
- the verticesGraphics.fillPolygon(int[])
public void fillPolygon(PointList points)
Graphics
PointList
containing the
vertices. The first and last points in the list will be connected.
fillPolygon
in class Graphics
points
- the verticesGraphics.fillPolygon(PointList)
public void fillRectangle(int x, int y, int w, int h)
Graphics
fillRectangle
in class Graphics
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightGraphics.fillRectangle(int, int, int, int)
public void fillRoundRectangle(Rectangle r, int arcWidth, int arcHeight)
Graphics
fillRoundRectangle
in class Graphics
r
- the rectanglearcWidth
- the arc widtharcHeight
- the arc heightGraphics.fillRoundRectangle(Rectangle, int, int)
public void fillString(String s, int x, int y)
Graphics
fillString
in class Graphics
s
- the stringx
- the x coordinatey
- the y coordinateGraphics.fillString(String, int, int)
public void fillText(String s, int x, int y)
Graphics
fillText
in class Graphics
s
- the textx
- the x coordinatey
- the y coordinateGraphics.fillText(String, int, int)
public double getAbsoluteScale()
Graphics
getAbsoluteScale
in class Graphics
Graphics.getAbsoluteScale()
public int getAlpha()
Graphics
getAlpha
in class Graphics
Graphics.getAlpha()
public int getAntialias()
Graphics
SWT.DEFAULT
,
SWT.OFF
or SWT.ON
. Note that this controls anti-aliasing for
all non-text drawing operations.
getAntialias
in class Graphics
Graphics.getAntialias()
public Color getBackgroundColor()
Graphics
getBackgroundColor
in class Graphics
Graphics.getBackgroundColor()
public Rectangle getClip(Rectangle rect)
Graphics
getClip
in class Graphics
rect
- the rectangle to hold the clip region
Graphics.getClip(Rectangle)
public int getFillRule()
Graphics
SWT.FILL_EVEN_ODD
or
SWT.FILL_WINDING
.
getFillRule
in class Graphics
Graphics.getFillRule()
public Font getFont()
Graphics
getFont
in class Graphics
Graphics.getFont()
public FontMetrics getFontMetrics()
Graphics
getFontMetrics
in class Graphics
Graphics.getFontMetrics()
public Color getForegroundColor()
Graphics
getForegroundColor
in class Graphics
Graphics.getForegroundColor()
public int getInterpolation()
Graphics
SWT.DEFAULT
,
SWT.NONE
, SWT.LOW
or SWT.HIGH
.
getInterpolation
in class Graphics
Graphics.getInterpolation()
public int getLineCap()
Graphics
SWT.CAP_FLAT
, SWT.CAP_ROUND
, or SWT.CAP_SQUARE
.
getLineCap
in class Graphics
Graphics.getLineCap()
public int getLineJoin()
Graphics
SWT.JOIN_MITER
, SWT.JOIN_ROUND
, or
SWT.JOIN_BEVEL
.
getLineJoin
in class Graphics
Graphics.getLineJoin()
public int getLineStyle()
Graphics
getLineStyle
in class Graphics
Graphics.getLineStyle()
public int getLineWidth()
Graphics
getLineWidth
in class Graphics
Graphics.getLineWidth()
public int getTextAntialias()
Graphics
SWT.DEFAULT
, SWT.OFF
or SWT.ON
. Note that this
controls anti-aliasing only for text drawing operations.
getTextAntialias
in class Graphics
Graphics.getTextAntialias()
public boolean getXORMode()
Graphics
true
if this graphics object should use XOR mode with painting.
getXORMode
in class Graphics
Graphics.getXORMode()
public void popState()
Graphics
Graphics.pushState()
has previously been called) and restores the current state to that popped state.
popState
in class Graphics
Graphics.popState()
public void pushState()
Graphics
pushState
in class Graphics
Graphics.pushState()
public void restoreState()
Graphics
restoreState
in class Graphics
Graphics.restoreState()
public void scale(double amount)
Graphics
scale
in class Graphics
amount
- the scale factorGraphics.scale(double)
public void setAlpha(int alpha)
Graphics
setAlpha
in class Graphics
alpha
- an alpha value (0-255)Graphics.setAlpha(int)
public void setAntialias(int value)
Graphics
SWT.DEFAULT
, SWT.OFF
or SWT.ON
. Note that this
controls anti-aliasing for all non-text drawing operations.
setAntialias
in class Graphics
value
- the anti-alias valueGraphics.setAntialias(int)
public void setBackgroundColor(Color rgb)
Graphics
setBackgroundColor
in class Graphics
rgb
- the new background colorGraphics.setBackgroundColor(Color)
public void setClip(Rectangle r)
Graphics
setClip
in class Graphics
r
- the new clip rectangleGraphics.setClip(Rectangle)
public void setFillRule(int rule)
Graphics
SWT.FILL_EVEN_ODD
or SWT.FILL_WINDING
.
setFillRule
in class Graphics
rule
- the fill ruleGraphics.setFillRule(int)
public void setFont(Font f)
Graphics
setFont
in class Graphics
f
- the new fontGraphics.setFont(Font)
public void setForegroundColor(Color rgb)
Graphics
setForegroundColor
in class Graphics
rgb
- the new foreground colorGraphics.setForegroundColor(Color)
public void setInterpolation(int interpolation)
Graphics
SWT.DEFAULT
, SWT.NONE
, SWT.LOW
or
SWT.HIGH
. This setting is relevant when working with Images.
setInterpolation
in class Graphics
interpolation
- the interpolationGraphics.setInterpolation(int)
public void setLineCap(int cap)
Graphics
SWT.CAP_FLAT
, SWT.CAP_ROUND
, or SWT.CAP_SQUARE
.
setLineCap
in class Graphics
cap
- the line capGraphics.setLineCap(int)
public void setLineDash(int[] dash)
Graphics
Graphics.pushState()
and Graphics.popState()
.
setLineDash
in class Graphics
dash
- the pixel patternGraphics.setLineDash(int[])
public void setLineJoin(int join)
Graphics
SWT.JOIN_MITER
, SWT.JOIN_ROUND
, or
SWT.JOIN_BEVEL
.
setLineJoin
in class Graphics
join
- the join typeGraphics.setLineJoin(int)
public void setLineStyle(int style)
Graphics
SWT.LINE_SOLID
, SWT.LINE_DASH
, SWT.LINE_DOT
,
SWT.LINE_DASHDOT
or SWT.LINE_DASHDOTDOT
.
setLineStyle
in class Graphics
style
- the new styleGraphics.setLineStyle(int)
public void setLineWidth(int width)
Graphics
setLineWidth
in class Graphics
width
- the new widthGraphics.setLineWidth(int)
public void setTextAntialias(int value)
Graphics
SWT.DEFAULT
, SWT.OFF
or SWT.ON
. Note that this
controls anti-aliasing only for all text drawing operations.
setTextAntialias
in class Graphics
value
- the textual anti-alias settingGraphics.setTextAntialias(int)
public void setXORMode(boolean b)
Graphics
setXORMode
in class Graphics
b
- the new XOR modeGraphics.setXORMode(boolean)
public void translate(int dx, int dy)
Graphics
translate
in class Graphics
dx
- the horizontal offsetdy
- the vertical offsetGraphics.translate(int, int)
|
Eclipse Draw2d 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |