| net.refractions.udig.ui.graphics.ViewportGraphics
All known Subclasses: net.refractions.udig.ui.graphics.SWTGraphics, net.refractions.udig.ui.graphics.AWTGraphics, net.refractions.udig.ui.graphics.NonAdvancedSWTGraphics,
ViewportGraphics | public interface ViewportGraphics (Code) | | An adapter that allows uDig and plugin writers to write to AWT components and images or SWT
Drawable objects by using this common interface.
author: jeichar |
Field Summary | |
final public static int | ALIGN_BOTTOM | final public static int | ALIGN_LEFT | final public static int | ALIGN_MIDDLE | final public static int | ALIGN_RIGHT | final public static int | ALIGN_TOP | final public static int | LINE_DASH Line drawing style for dashed lines (value is 2). | final public static int | LINE_DASHDOT Line drawing style for alternating dash-dot lines (value is 4). | final public static int | LINE_DASHDOTDOT Line drawing style for dash-dot-dot lines (value is 5). | final public static int | LINE_DOT Line drawing style for dotted lines (value is 3). | final public static int | LINE_SOLID Line drawing style for solid lines (value is 1). |
Method Summary | |
public void | clearRect(int x, int y, int width, int height) Fills the specified rectangle with the background color. | public void | dispose() Disposes of any resources the graphics might be hanging on to. | public void | draw(Shape s) Draws the outline of shape using the color, clip & transform.
Reference description from Graphics2d: Strokes the outline of a Shape
using the settings of the current Graphics2D context. | public void | drawImage(RenderedImage renderedImage, int x, int y) Draws an image. | public void | drawImage(Image awtImage, int x, int y) Draws an
Image . | public void | drawImage(Image awtImage, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) Draws a portion of the image to the target location on the viewport graphics. | public void | drawImage(org.eclipse.swt.graphics.Image swtImage, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) Copies a rectangular area from the source image into a (potentially
different sized) rectangular area in the receiver. | public void | drawImage(org.eclipse.swt.graphics.Image swtImage, int x, int y) Draws an
org.eclipse.swt.graphics.Image . | public void | drawLine(int x1, int y1, int x2, int y2) | public void | drawOval(int x, int y, int width, int height) | public void | drawPath(Path path) Draws the outline of the path using the color, clip and transform. | public void | drawRect(int x, int y, int width, int height) Draws a rectangle - only the boundary. | public void | drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) | public void | drawString(String string, int x, int y, int alignx, int aligny) Draws a string. | public void | fill(Shape s) Fills the interior of a Shape using the foreground color, clip & transform.
Reference description from Graphics2d: Fills the interior of a Shape
using the settings of the Graphics2D context. | public void | fillOval(int x, int y, int width, int height) | public void | fillPath(Path path) Fills the interior of the path with the forground color. | public void | fillRect(int x, int y, int width, int height) Fills a rectangle. | public void | fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) | Color | getBackgroundColor() | Shape | getClip() Gets the area that can be drawn in. | Color | getColor() | public int | getFontAscent() Gets the ascent of the current font, which is the distance the font rises
above its baseline . | public int | getFontHeight() Gets the height of the current font TODO at some point maybe this could be broken out to
getFontMetrics(), and a create FontMetrics object that maps between SWT and AWT. | public Rectangle2D | getStringBounds(String str) Returns the bounds of a String. | public AffineTransform | getTransform() | public void | setBackground(Color c) Sets the background color to draw with. | public void | setClip(Rectangle r) Sets the clip. | void | setClipBounds(Rectangle newBounds) Sets the clip area. | public void | setColor(Color c) Sets the foreground color to draw with. | public void | setStroke(int strokeStyle, int strokeWidth) Sets the stroke color to draw with. | public void | setTransform(AffineTransform transform) Modifies the graphics so that further draws us minX,minY as the origin and maxX and maxY as
the width and height of the display area. | public int | stringWidth(String str) Returns the length in pixels of the given string, or -1 if this operation is not available. | public void | translate(Point offset) Sets the draw offset. |
ALIGN_BOTTOM | final public static int ALIGN_BOTTOM(Code) | | ALIGN_BOTTOM field used to align text
|
ALIGN_LEFT | final public static int ALIGN_LEFT(Code) | | ALIGN_LEFT field used to align text
|
ALIGN_MIDDLE | final public static int ALIGN_MIDDLE(Code) | | ALIGN_MIDDLE field used to align text
|
ALIGN_RIGHT | final public static int ALIGN_RIGHT(Code) | | ALIGN_RIGHT field used to align text
|
ALIGN_TOP | final public static int ALIGN_TOP(Code) | | ALIGN_TOP field used to align text
|
LINE_DASH | final public static int LINE_DASH(Code) | | Line drawing style for dashed lines (value is 2).
|
LINE_DASHDOT | final public static int LINE_DASHDOT(Code) | | Line drawing style for alternating dash-dot lines (value is 4).
|
LINE_DASHDOTDOT | final public static int LINE_DASHDOTDOT(Code) | | Line drawing style for dash-dot-dot lines (value is 5).
|
LINE_DOT | final public static int LINE_DOT(Code) | | Line drawing style for dotted lines (value is 3).
|
LINE_SOLID | final public static int LINE_SOLID(Code) | | Line drawing style for solid lines (value is 1).
|
clearRect | public void clearRect(int x, int y, int width, int height)(Code) | | Fills the specified rectangle with the background color.
Parameters: x - The starting corner's x-coordinate. Parameters: y - The starting corner's y-coordinate. Parameters: width - the width of the rectangle Parameters: height - the height of the rectangle |
dispose | public void dispose()(Code) | | Disposes of any resources the graphics might be hanging on to.
|
draw | public void draw(Shape s)(Code) | | Draws the outline of shape using the color, clip & transform.
Reference description from Graphics2d: Strokes the outline of a Shape
using the settings of the current Graphics2D context. The rendering attributes
applied include the Clip , Transform , Paint ,
Composite and Stroke attributes.
Parameters: s - the Shape to be rendered See Also: fill |
drawImage | public void drawImage(RenderedImage renderedImage, int x, int y)(Code) | | Draws an image.
Parameters: image - The image to draw. Parameters: x - The x coordinate of the image top left corner of the image. Parameters: y - The y coordinate of the image top left corner of the image. |
drawImage | public void drawImage(Image awtImage, int x, int y)(Code) | | Draws an
Image .
Parameters: image - The Image to draw. Parameters: x - The x coordinate of the image top left corner of the image. Parameters: y - The y coordinate of the image top left corner of the image. |
drawImage | public void drawImage(Image awtImage, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)(Code) | | Draws a portion of the image to the target location on the viewport graphics.
Parameters: image - Image to draw Parameters: dx1 - - the x coordinate of the first corner of the destination rectangle. Parameters: dy1 - - the y coordinate of the first corner of the destination rectangle. Parameters: dx2 - - the x coordinate of the second corner of the destination rectangle. Parameters: dy2 - - the y coordinate of the second corner of the destination rectangle. Parameters: sx1 - - the x coordinate of the first corner of the source rectangle. Parameters: sy1 - - the y coordinate of the first corner of the source rectangle. Parameters: sx2 - - the x coordinate of the second corner of the source rectangle. Parameters: sy2 - - the y coordinate of the second corner of the source rectangle. |
drawImage | public void drawImage(org.eclipse.swt.graphics.Image swtImage, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)(Code) | | 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 Parameters: dx1 - - the x coordinate of the first corner of the destination rectangle. Parameters: dy1 - - the y coordinate of the first corner of the destination rectangle. Parameters: dx2 - - the x coordinate of the second corner of the destination rectangle. Parameters: dy2 - - the y coordinate of the second corner of the destination rectangle. Parameters: sx1 - - the x coordinate of the first corner of the source rectangle. Parameters: sy1 - - the y coordinate of the first corner of the source rectangle. Parameters: sx2 - - the x coordinate of the second corner of the source rectangle. Parameters: sy2 - - the y coordinate of the second corner of the source rectangle. |
drawImage | public void drawImage(org.eclipse.swt.graphics.Image swtImage, int x, int y)(Code) | | Draws an
org.eclipse.swt.graphics.Image .
Parameters: image - The org.eclipse.swt.graphics.Image to draw. Parameters: x - The x coordinate of the image top left corner of the image. Parameters: y - The y coordinate of the image top left corner of the image. |
drawLine | public void drawLine(int x1, int y1, int x2, int y2)(Code) | | Draws a line from x1,y1 to x2,y2
Parameters: x1 - Parameters: y1 - Parameters: x2 - Parameters: y2 - |
drawOval | public void drawOval(int x, int y, int width, int height)(Code) | | Draws an Oval - only the boundary
Parameters: x - the starting x coordinate Parameters: y - the starting y coordinate Parameters: width - the width of the Oval. Parameters: height - the height of the Oval. |
drawPath | public void drawPath(Path path)(Code) | | Draws the outline of the path using the color, clip and transform.
|
drawRect | public void drawRect(int x, int y, int width, int height)(Code) | | Draws a rectangle - only the boundary.
Parameters: x - the starting x coordinate Parameters: y - the starting y coordinate Parameters: width - the width of the rectangle. Parameters: height - the height of the rectangle. |
drawRoundRect | public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code) | | Draws a round cornered rectangle
Parameters: x - the x component of the upper left corner Parameters: y - the y component of the upper left corner Parameters: width - the width of the rectangle Parameters: height - the height of the rectangle Parameters: arcWidth - the horizontal diameter of the arc at the four corners. Parameters: arcHeight - the vertical diameter of the arc at the four corners |
fill | public void fill(Shape s)(Code) | | Fills the interior of a Shape using the foreground color, clip & transform.
Reference description from Graphics2d: Fills the interior of a Shape
using the settings of the Graphics2D context. The rendering attributes applied
include the Clip , Transform , Paint , and
Composite .
Parameters: s - the Shape to be filled Parameters: s - the Shape to be rendered See Also: fill |
fillOval | public void fillOval(int x, int y, int width, int height)(Code) | | Fills an Oval
Parameters: x - the starting x coordinate Parameters: y - the starting y coordinate Parameters: width - the width of the Oval. Parameters: height - the height of the Oval. |
fillPath | public void fillPath(Path path)(Code) | | Fills the interior of the path with the forground color.
Parameters: path - the path to fill. |
fillRect | public void fillRect(int x, int y, int width, int height)(Code) | | Fills a rectangle.
Parameters: x - the starting x coordinate Parameters: y - the starting y coordinate Parameters: width - the width of the rectangle. Parameters: height - the height of the rectangle. |
fillRoundRect | public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code) | | Fills a round cornered rectangle using the foreground color
Parameters: x - the x component of the upper left corner Parameters: y - the y component of the upper left corner Parameters: width - the width of the rectangle Parameters: height - the height of the rectangle Parameters: arcWidth - the horizontal diameter of the arc at the four corners. Parameters: arcHeight - the vertical diameter of the arc at the four corners |
getBackgroundColor | Color getBackgroundColor()(Code) | | Gets the current background color value
the current background color value |
getClip | Shape getClip()(Code) | | Gets the area that can be drawn in.
the area that can be drawn in. |
getColor | Color getColor()(Code) | | Gets the current Color value
the current Color value |
getFontAscent | public int getFontAscent()(Code) | | Gets the ascent of the current font, which is the distance the font rises
above its baseline .
|
getFontHeight | public int getFontHeight()(Code) | | Gets the height of the current font TODO at some point maybe this could be broken out to
getFontMetrics(), and a create FontMetrics object that maps between SWT and AWT.
the height of the current font |
getStringBounds | public Rectangle2D getStringBounds(String str)(Code) | | Returns the bounds of a String. Does not expand tabs or newlines
Parameters: str - |
setBackground | public void setBackground(Color c)(Code) | | Sets the background color to draw with.
Parameters: c - The new color. |
setClip | public void setClip(Rectangle r)(Code) | | Sets the clip.
Parameters: r - the rectangle to clip to. |
setClipBounds | void setClipBounds(Rectangle newBounds)(Code) | | Sets the clip area.
Parameters: newBounds - new clip area |
setColor | public void setColor(Color c)(Code) | | Sets the foreground color to draw with.
Parameters: c - The new color. |
setStroke | public void setStroke(int strokeStyle, int strokeWidth)(Code) | | Sets the stroke color to draw with.
Parameters: strokeStyle - The style of line to draw. Parameters: strokeWidth - the width, in pixels, to draw lines with. |
setTransform | public void setTransform(AffineTransform transform)(Code) | | Modifies the graphics so that further draws us minX,minY as the origin and maxX and maxY as
the width and height of the display area.
Parameters: minX - The x-coord that will be used as the origin. Parameters: minY - The y-coord that will be used as the origin. Parameters: width - The width that will be used to draws. Parameters: height - The height that will be used to draws. |
stringWidth | public int stringWidth(String str)(Code) | | Returns the length in pixels of the given string, or -1 if this operation is not available.
Parameters: str - |
translate | public void translate(Point offset)(Code) | | Sets the draw offset.
Parameters: offset - The amount the draw is offset in the graphics. |
|
|