Package ro.sync.exml.view.graphics
Interface Graphics
-
@API(type=NOT_EXTENDABLE, src=PRIVATE) public interface Graphics
The graphics interface used to draw Author and Schema Diagram.
-
-
Field Summary
Fields Modifier and Type Field Description static int
FILL_PATTERN_SQUARE
A pattern of squares (of size 1).static int
FILL_PATTERN_SQUARE_BIG
A pattern of big squares (of size 2).static int
ICON_COMMENT_TREE
Icon code for comment nodes.static int
ICON_PROCESSING_INSTRUCTION_TREE
Icon code for processing instruction nodes.static int
ICON_TEXT_TREE
Icon code for text nodes.static int
IMAGE_EXPANSION_BAR_BOTTOM
Image representing the bottom arrow of the expansion bar.static int
IMAGE_EXPANSION_BAR_COLLAPSED
Image representing an arrow for the collapsed expansion bar.static int
IMAGE_EXPANSION_BAR_MIDDLE_GRADIENT
Image representing the middle of the expansion bar gradient.static int
IMAGE_EXPANSION_BAR_TOP
Image representing the top arrow of the expansion bar.static int
STROKE_DASHED
Dotted strokestatic int
STROKE_DOT_DASH
Dot-dash strokestatic int
STROKE_DOT_DOT_DASH
Dot-dot-dash strokestatic int
STROKE_DOTTED
Dotted strokestatic int
STROKE_NORMAL
Normal strokestatic int
STROKE_WAVY
Wavy stroke with endings.static int
STROKE_WAVY_NO_ENDINGS
Wavy stroke without endings.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activateAntialiasing()
Activate the antialiasing mode.Font
deriveSize(Font current, int size)
Derive the size of the fontFont
deriveStyle(Font current, int style)
Derive the style of the fontvoid
disableAntialiasing()
Disable the antialiasing mode.void
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
draws an arc.void
drawIcon(java.lang.Object hostComponent, int iconCode, int x, int y)
Draw the icon at (x,y) coordinates.void
drawImage(java.lang.Object image, int x, int y)
Draw an image object depending on the platformvoid
drawImage(java.lang.Object image, int x, int y, int width, int height)
Draw an image object depending on the platform.void
drawImage(java.lang.Object img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.void
drawLine(int x1, int y1, int x2, int y2)
Draw a line from (x1, y1) to (x2, y2).void
drawOval(int x, int y, int width, int height)
Draw an oval.void
drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draw a closed polygon defined by arrays of x and y coordinates.void
drawPolyline(int[] xpoints, int[] ypoints, int npoints)
Draws a polyline which is not closed if the last point differs from the first.void
drawRect(int x, int y, int width, int height)
Draw a rect with (x,y) top-left corner.void
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Draws an outlined round-cornered rectangle using this graphics context's current color.void
drawShadow(Shape shape, int displacement)
Draws a shadow using the shape of the polygon.void
drawShape(Shape shape)
Draw a shapevoid
drawString(java.lang.String text, int x, int y)
Draw a string.void
drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth)
Draws a string at the specified coordinates.void
drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth, boolean drawAtBaseLine)
Draws a string at the specified coordinates.void
fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Fills an arc.void
fillOval(int x, int y, int width, int height)
Fill an oval with curent fill color.void
fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates.void
fillRect(int x, int y, int width, int height)
Fill a rect with (x,y) top-left corner.void
fillRect(int x, int y, int width, int height, int fillPattern, Color fillColor)
Fills a rectangle with a pattern.void
fillRect(Rectangle rectangle)
Fill a rectangle.void
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Fills the specified rounded corner rectangle.void
fillShape(Shape shape)
Fill a shapevoid
fillWithGradient(Ellipse ellipse, Color startColorCode, Color endColorCode, boolean isVertical)
void
fillWithGradient(Polygon polygon, Color startColorCode, Color endColorCode, boolean isVertical)
void
fillWithGradient(Rectangle rect, Color startColorCode, Color endColorCode, boolean isVertical)
void
fillWithGradient(Shape shape, Color startColorCode, Color endColorCode, boolean isVertical)
java.lang.Object
getAntialiasing()
Rectangle
getClipBounds()
Color
getDrawColor()
Get the current color code.Color
getFillColor()
Get the color code for fill shapes.Font
getFont()
Get current font.FontMetrics
getFontMetrics(Font font)
int
getStrokeType()
int
getStrokeWidth()
void
plainDrawString(java.lang.String text, int x, int y)
Draw a string directly using the graphics, without creating a text layout.void
setAntialiasing(java.lang.Object value)
void
setClipBounds(Rectangle clip)
Set cliping for the graphics.void
setDrawColor(Color colorCode)
Set the color for draw methods.void
setFillColor(Color colorCode)
Set the color for fill methods.void
setFont(Font font)
Set the new font.void
setStroke(int width, int type)
Sets the line width for the stroke.
-
-
-
Field Detail
-
ICON_TEXT_TREE
static final int ICON_TEXT_TREE
Icon code for text nodes.- See Also:
- Constant Field Values
-
ICON_COMMENT_TREE
static final int ICON_COMMENT_TREE
Icon code for comment nodes.- See Also:
- Constant Field Values
-
ICON_PROCESSING_INSTRUCTION_TREE
static final int ICON_PROCESSING_INSTRUCTION_TREE
Icon code for processing instruction nodes.- See Also:
- Constant Field Values
-
IMAGE_EXPANSION_BAR_TOP
static final int IMAGE_EXPANSION_BAR_TOP
Image representing the top arrow of the expansion bar.- See Also:
- Constant Field Values
-
IMAGE_EXPANSION_BAR_BOTTOM
static final int IMAGE_EXPANSION_BAR_BOTTOM
Image representing the bottom arrow of the expansion bar.- See Also:
- Constant Field Values
-
IMAGE_EXPANSION_BAR_MIDDLE_GRADIENT
static final int IMAGE_EXPANSION_BAR_MIDDLE_GRADIENT
Image representing the middle of the expansion bar gradient.- See Also:
- Constant Field Values
-
IMAGE_EXPANSION_BAR_COLLAPSED
static final int IMAGE_EXPANSION_BAR_COLLAPSED
Image representing an arrow for the collapsed expansion bar.- See Also:
- Constant Field Values
-
STROKE_NORMAL
static final int STROKE_NORMAL
Normal stroke- See Also:
- Constant Field Values
-
STROKE_DOTTED
static final int STROKE_DOTTED
Dotted stroke- See Also:
- Constant Field Values
-
STROKE_DASHED
static final int STROKE_DASHED
Dotted stroke- See Also:
- Constant Field Values
-
STROKE_WAVY
static final int STROKE_WAVY
Wavy stroke with endings.- See Also:
- Constant Field Values
-
STROKE_WAVY_NO_ENDINGS
static final int STROKE_WAVY_NO_ENDINGS
Wavy stroke without endings.- See Also:
- Constant Field Values
-
STROKE_DOT_DASH
static final int STROKE_DOT_DASH
Dot-dash stroke- See Also:
- Constant Field Values
-
STROKE_DOT_DOT_DASH
static final int STROKE_DOT_DOT_DASH
Dot-dot-dash stroke- See Also:
- Constant Field Values
-
FILL_PATTERN_SQUARE
static final int FILL_PATTERN_SQUARE
A pattern of squares (of size 1).- See Also:
- Constant Field Values
-
FILL_PATTERN_SQUARE_BIG
static final int FILL_PATTERN_SQUARE_BIG
A pattern of big squares (of size 2).- See Also:
- Constant Field Values
-
-
Method Detail
-
setFont
void setFont(Font font)
Set the new font.- Parameters:
font
- The font to be used.
-
fillPolygon
void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates.- Parameters:
xPoints
- a an array ofx
coordinates.yPoints
- a an array ofy
coordinates.nPoints
- a the total number of points.
-
drawPolygon
void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draw a closed polygon defined by arrays of x and y coordinates.- Parameters:
xPoints
- a an array ofx
coordinates.yPoints
- a an array ofy
coordinates.nPoints
- a the total number of points.
-
getFont
Font getFont()
Get current font.- Returns:
- The current font.
-
drawString
void drawString(java.lang.String text, int x, int y)
Draw a string.- Parameters:
text
- The text to be drawn.x
- The x coordinate.y
- The y coordinate(top-left).
-
plainDrawString
void plainDrawString(java.lang.String text, int x, int y)
Draw a string directly using the graphics, without creating a text layout.- Parameters:
text
- The text to be drawn.x
- The x coordinate.y
- The y coordinate(top-left).
-
getDrawColor
Color getDrawColor()
Get the current color code.- Returns:
- The current color code.
-
drawLine
void drawLine(int x1, int y1, int x2, int y2)
Draw a line from (x1, y1) to (x2, y2).- Parameters:
x1
- x of first point.y1
- y of first point.x2
- x of second point.y2
- y of second point.
-
fillRect
void fillRect(int x, int y, int width, int height)
Fill a rect with (x,y) top-left corner.- Parameters:
x
- The x coordinate.y
- The y coordinate.width
- The rect width.height
- The rect height.
-
fillRect
void fillRect(Rectangle rectangle)
Fill a rectangle.- Parameters:
rectangle
- The rectangle.
-
drawRect
void drawRect(int x, int y, int width, int height)
Draw a rect with (x,y) top-left corner.- Parameters:
x
- The x coordinate.y
- The y coordinate.width
- The rect width.height
- The rect height.
-
drawRoundRect
void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Draws an outlined round-cornered rectangle using this graphics context's current color. The left and right edges of the rectangle are atx
andx + width
, respectively. The top and bottom edges of the rectangle are aty
andy + 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.arcWidth
- the horizontal diameter of the arc at the four corners.arcHeight
- the vertical diameter of the arc at the four corners.
-
fillRoundRect
void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Fills the specified rounded corner rectangle.- 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.
-
drawPolyline
void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
Draws a polyline which is not closed if the last point differs from the first.- Parameters:
xpoints
- The xpoints array.ypoints
- The ypoints array.npoints
- The number of points.
-
drawArc
void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
draws an arc.- 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.arcAngle
- the angular extent of the arc, relative to the start angle.
-
fillArc
void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Fills an arc.- 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.arcAngle
- the angular extent of the arc, relative to the start angle.
-
setStroke
void setStroke(int width, int type)
Sets the line width for the stroke. The line is solid, no dashes.- Parameters:
width
- The width value.type
- The stroke type.
-
getStrokeWidth
int getStrokeWidth()
- Returns:
- the value of the stroke width.
-
getStrokeType
int getStrokeType()
- Returns:
- the value of the stroke type.
-
getClipBounds
Rectangle getClipBounds()
- Returns:
- the clipping rectangle.
-
setClipBounds
void setClipBounds(Rectangle clip)
Set cliping for the graphics.- Parameters:
clip
- The clip bounds to be set.
-
setFillColor
void setFillColor(Color colorCode)
Set the color for fill methods.- Parameters:
colorCode
- The color code used by fill methods.
-
setDrawColor
void setDrawColor(Color colorCode)
Set the color for draw methods.- Parameters:
colorCode
- The color code used by draw methods.
-
drawIcon
void drawIcon(java.lang.Object hostComponent, int iconCode, int x, int y)
Draw the icon at (x,y) coordinates.- Parameters:
hostComponent
- Icon implementations may use the HostComponent argument to get properties useful for painting, e.g. the foreground or background color.iconCode
- The icon code.x
- The x coordinate.y
- The y coordinate.
-
drawOval
void drawOval(int x, int y, int width, int height)
Draw an oval.- Parameters:
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.
-
getFillColor
Color getFillColor()
Get the color code for fill shapes.- Returns:
- The color code for fill shapes.
-
fillOval
void fillOval(int x, int y, int width, int height)
Fill an oval with curent fill color.- Parameters:
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.
-
fillWithGradient
void fillWithGradient(Rectangle rect, Color startColorCode, Color endColorCode, boolean isVertical)
- Parameters:
rect
- The rect to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.
-
fillWithGradient
void fillWithGradient(Polygon polygon, Color startColorCode, Color endColorCode, boolean isVertical)
- Parameters:
polygon
- The polygon to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.
-
fillShape
void fillShape(Shape shape)
Fill a shape- Parameters:
shape
- The shape
-
drawShape
void drawShape(Shape shape)
Draw a shape- Parameters:
shape
- The shape
-
getFontMetrics
FontMetrics getFontMetrics(Font font)
- Parameters:
font
- The font- Returns:
- The font metrics
-
deriveStyle
Font deriveStyle(Font current, int style)
Derive the style of the font- Parameters:
current
- Current fontstyle
- New style- Returns:
- The new font
-
deriveSize
Font deriveSize(Font current, int size)
Derive the size of the font- Parameters:
current
- Current fontsize
- New size- Returns:
- The new font
-
drawImage
void drawImage(java.lang.Object image, int x, int y)
Draw an image object depending on the platform- Parameters:
image
- The image datax
- image Xy
- image Y
-
drawImage
void drawImage(java.lang.Object image, int x, int y, int width, int height)
Draw an image object depending on the platform. The image is scaled to the width and height specified.- Parameters:
image
- The image datax
- image Xy
- image Ywidth
- image widthheight
- image height
-
drawImage
void drawImage(java.lang.Object img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. Transparent pixels do not affect whatever pixels are already there.- Parameters:
img
- the specified image to be drawn. This method does nothing ifimg
is null.dx1
- the x coordinate of the first corner of the destination rectangle.dy1
- the y coordinate of the first corner of the destination rectangle.dx2
- the x coordinate of the second corner of the destination rectangle.dy2
- the y coordinate of the second corner of the destination rectangle.sx1
- the x coordinate of the first corner of the source rectangle.sy1
- the y coordinate of the first corner of the source rectangle.sx2
- the x coordinate of the second corner of the source rectangle.sy2
- the y coordinate of the second corner of the source rectangle.- Since:
- 14.0
-
fillRect
void fillRect(int x, int y, int width, int height, int fillPattern, Color fillColor)
Fills a rectangle with a pattern.- Parameters:
x
- The left corner x coordinate.y
- The left corner y coordinatewidth
- The width of the rectangle.height
- The hight of the rectangle.fillPattern
- One this class constants that begin with FILL_PATTERN_fillColor
- The color for building the pattern.
-
drawShadow
void drawShadow(Shape shape, int displacement)
Draws a shadow using the shape of the polygon. The shadow will move to the right and down, with the size of the shadow.- Parameters:
shape
- The shape of the real object.displacement
- The size of the shadow. This is the displacement to the original object, on X and Y.
-
fillWithGradient
void fillWithGradient(Ellipse ellipse, Color startColorCode, Color endColorCode, boolean isVertical)
- Parameters:
ellipse
- The ellipse to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.
-
fillWithGradient
void fillWithGradient(Shape shape, Color startColorCode, Color endColorCode, boolean isVertical)
- Parameters:
shape
- The shape to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.
-
setAntialiasing
void setAntialiasing(java.lang.Object value)
- Parameters:
value
- The antialising value to be set depending on the platform.
-
getAntialiasing
java.lang.Object getAntialiasing()
- Returns:
- The antialising value to be set depending on the platform.
-
activateAntialiasing
void activateAntialiasing()
Activate the antialiasing mode.
-
disableAntialiasing
void disableAntialiasing()
Disable the antialiasing mode.
-
drawWrappedString
void drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth, boolean drawAtBaseLine)
Draws a string at the specified coordinates. Takes into account the wrapping width and newline characters.- Parameters:
aStr
- The text, as an attributed string.x
- The x coordinate.y
- The y coordinate.wrappingWidth
- The maximum width of the wrapped text.drawAtBaseLine
-true
if we should draw directly at the specified Y
-
drawWrappedString
void drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth)
Draws a string at the specified coordinates. Takes into account the wrapping width and newline characters.- Parameters:
aStr
- The text, as an attributed string.x
- The x coordinate.y
- The y coordinate.wrappingWidth
- The maximum width of the wrapped text.
-
-