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
FieldsModifier and TypeFieldDescriptionstatic final int
A pattern of squares (of size 1).static final int
A pattern of big squares (of size 2).static final int
Icon code for comment nodes.static final int
Icon code for processing instruction nodes.static final int
Icon code for text nodes.static final int
Image representing the bottom arrow of the expansion bar.static final int
Image representing an arrow for the collapsed expansion bar.static final int
Image representing the middle of the expansion bar gradient.static final int
Image representing the top arrow of the expansion bar.static final int
Dotted strokestatic final int
Dot-dash strokestatic final int
Dot-dot-dash strokestatic final int
Dotted strokestatic final int
Normal strokestatic final int
Wavy stroke with endings.static final int
Wavy stroke without endings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Activate the antialiasing mode.deriveSize
(Font current, int size) Derive the size of the fontderiveStyle
(Font current, int style) Derive the style of the fontvoid
Disable the antialiasing mode.void
drawArc
(int x, int y, int width, int height, int startAngle, int arcAngle) draws an arc.void
Draw the icon at (x,y) coordinates.void
Draw an image object depending on the platformvoid
Draw an image object depending on the platform.void
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
Draw a shapevoid
drawString
(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
Fills a rectangle with a pattern.void
Fill a rectangle.void
fillRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight) Fills the specified rounded corner rectangle.void
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) Get the current color code.Get the color code for fill shapes.getFont()
Get current font.getFontMetrics
(Font font) int
int
void
plainDrawString
(String text, int x, int y) Draw a string directly using the graphics, without creating a text layout.void
setAntialiasing
(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
Set the new font.void
setStroke
(int width, int type) Sets the line width for the stroke.
-
Field Details
-
ICON_TEXT_TREE
static final int ICON_TEXT_TREEIcon code for text nodes.- See Also:
-
ICON_COMMENT_TREE
static final int ICON_COMMENT_TREEIcon code for comment nodes.- See Also:
-
ICON_PROCESSING_INSTRUCTION_TREE
static final int ICON_PROCESSING_INSTRUCTION_TREEIcon code for processing instruction nodes.- See Also:
-
IMAGE_EXPANSION_BAR_TOP
static final int IMAGE_EXPANSION_BAR_TOPImage representing the top arrow of the expansion bar.- See Also:
-
IMAGE_EXPANSION_BAR_BOTTOM
static final int IMAGE_EXPANSION_BAR_BOTTOMImage representing the bottom arrow of the expansion bar.- See Also:
-
IMAGE_EXPANSION_BAR_MIDDLE_GRADIENT
static final int IMAGE_EXPANSION_BAR_MIDDLE_GRADIENTImage representing the middle of the expansion bar gradient.- See Also:
-
IMAGE_EXPANSION_BAR_COLLAPSED
static final int IMAGE_EXPANSION_BAR_COLLAPSEDImage representing an arrow for the collapsed expansion bar.- See Also:
-
STROKE_NORMAL
static final int STROKE_NORMALNormal stroke- See Also:
-
STROKE_DOTTED
static final int STROKE_DOTTEDDotted stroke- See Also:
-
STROKE_DASHED
static final int STROKE_DASHEDDotted stroke- See Also:
-
STROKE_WAVY
static final int STROKE_WAVYWavy stroke with endings.- See Also:
-
STROKE_WAVY_NO_ENDINGS
static final int STROKE_WAVY_NO_ENDINGSWavy stroke without endings.- See Also:
-
STROKE_DOT_DASH
static final int STROKE_DOT_DASHDot-dash stroke- See Also:
-
STROKE_DOT_DOT_DASH
static final int STROKE_DOT_DOT_DASHDot-dot-dash stroke- See Also:
-
FILL_PATTERN_SQUARE
static final int FILL_PATTERN_SQUAREA pattern of squares (of size 1).- See Also:
-
FILL_PATTERN_SQUARE_BIG
static final int FILL_PATTERN_SQUARE_BIGA pattern of big squares (of size 2).- See Also:
-
-
Method Details
-
setFont
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
Draw a string.- Parameters:
text
- The text to be drawn.x
- The x coordinate.y
- The y coordinate(top-left).
-
plainDrawString
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
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
Set cliping for the graphics.- Parameters:
clip
- The clip bounds to be set.
-
setFillColor
Set the color for fill methods.- Parameters:
colorCode
- The color code used by fill methods.
-
setDrawColor
Set the color for draw methods.- Parameters:
colorCode
- The color code used by draw methods.
-
drawIcon
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
- 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
Fill a shape- Parameters:
shape
- The shape
-
drawShape
Draw a shape- Parameters:
shape
- The shape
-
getFontMetrics
- Parameters:
font
- The font- Returns:
- The font metrics
-
deriveStyle
Derive the style of the font- Parameters:
current
- Current fontstyle
- New style- Returns:
- The new font
-
deriveSize
Derive the size of the font- Parameters:
current
- Current fontsize
- New size- Returns:
- The new font
-
drawImage
Draw an image object depending on the platform- Parameters:
image
- The image datax
- image Xy
- image Y
-
drawImage
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
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
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
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
- 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
- Parameters:
value
- The antialising value to be set depending on the platform.
-
getAntialiasing
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
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.
-