@API(type=NOT_EXTENDABLE,
src=PRIVATE)
public interface Graphics
Modifier and Type | Field and 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 stroke
|
static int |
STROKE_DOT_DASH
Dot-dash stroke
|
static int |
STROKE_DOT_DOT_DASH
Dot-dot-dash stroke
|
static int |
STROKE_DOTTED
Dotted stroke
|
static int |
STROKE_NORMAL
Normal stroke
|
static int |
STROKE_WAVY
Wavy stroke with endings.
|
static int |
STROKE_WAVY_NO_ENDINGS
Wavy stroke without endings.
|
Modifier and Type | Method and Description |
---|---|
void |
activateAntialiasing()
Activate the antialiasing mode.
|
Font |
deriveSize(Font current,
int size)
Derive the size of the font
|
Font |
deriveStyle(Font current,
int style)
Derive the style of the font
|
void |
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 platform
|
void |
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 shape
|
void |
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 shape
|
void |
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.
|
static final int ICON_TEXT_TREE
static final int ICON_COMMENT_TREE
static final int ICON_PROCESSING_INSTRUCTION_TREE
static final int IMAGE_EXPANSION_BAR_TOP
static final int IMAGE_EXPANSION_BAR_BOTTOM
static final int IMAGE_EXPANSION_BAR_MIDDLE_GRADIENT
static final int IMAGE_EXPANSION_BAR_COLLAPSED
static final int STROKE_NORMAL
static final int STROKE_DOTTED
static final int STROKE_DASHED
static final int STROKE_WAVY
static final int STROKE_WAVY_NO_ENDINGS
static final int STROKE_DOT_DASH
static final int STROKE_DOT_DOT_DASH
static final int FILL_PATTERN_SQUARE
static final int FILL_PATTERN_SQUARE_BIG
void setFont(Font font)
font
- The font to be used.void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.Font getFont()
void drawString(java.lang.String text, int x, int y)
text
- The text to be drawn.x
- The x coordinate.y
- The y coordinate(top-left).void plainDrawString(java.lang.String text, int x, int y)
text
- The text to be drawn.x
- The x coordinate.y
- The y coordinate(top-left).Color getDrawColor()
void drawLine(int x1, int y1, int x2, int y2)
x1
- x of first point.y1
- y of first point.x2
- x of second point.y2
- y of second point.void fillRect(int x, int y, int width, int height)
x
- The x coordinate.y
- The y coordinate.width
- The rect width.height
- The rect height.void fillRect(Rectangle rectangle)
rectangle
- The rectangle.void drawRect(int x, int y, int width, int height)
x
- The x coordinate.y
- The y coordinate.width
- The rect width.height
- The rect height.void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and x + width
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height
.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.void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
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.void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
xpoints
- The xpoints array.ypoints
- The ypoints array.npoints
- The number of points.void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
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.void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
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.void setStroke(int width, int type)
width
- The width value.type
- The stroke type.int getStrokeWidth()
int getStrokeType()
Rectangle getClipBounds()
void setClipBounds(Rectangle clip)
clip
- The clip bounds to be set.void setFillColor(Color colorCode)
colorCode
- The color code used by fill methods.void setDrawColor(Color colorCode)
colorCode
- The color code used by draw methods.void drawIcon(java.lang.Object hostComponent, int iconCode, int x, int y)
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.void drawOval(int x, int y, int width, int height)
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.Color getFillColor()
void fillOval(int x, int y, int width, int height)
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.void fillWithGradient(Rectangle rect, Color startColorCode, Color endColorCode, boolean isVertical)
rect
- The rect to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.void fillWithGradient(Polygon polygon, Color startColorCode, Color endColorCode, boolean isVertical)
polygon
- The polygon to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.void fillShape(Shape shape)
shape
- The shapevoid drawShape(Shape shape)
shape
- The shapeFontMetrics getFontMetrics(Font font)
font
- The fontFont deriveStyle(Font current, int style)
current
- Current fontstyle
- New styleFont deriveSize(Font current, int size)
current
- Current fontsize
- New sizevoid drawImage(java.lang.Object image, int x, int y)
image
- The image datax
- image Xy
- image Yvoid drawImage(java.lang.Object image, int x, int y, int width, int height)
image
- The image datax
- image Xy
- image Ywidth
- image widthheight
- image heightvoid drawImage(java.lang.Object img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
img
- the specified image to be drawn. This method does
nothing if img
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.void fillRect(int x, int y, int width, int height, int fillPattern, Color fillColor)
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.void drawShadow(Shape shape, int displacement)
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.void fillWithGradient(Ellipse ellipse, Color startColorCode, Color endColorCode, boolean isVertical)
ellipse
- The ellipse to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.void fillWithGradient(Shape shape, Color startColorCode, Color endColorCode, boolean isVertical)
shape
- The shape to fill with a gradientstartColorCode
- Start color of gradientendColorCode
- End color of gradient.isVertical
- True if the gradient should be vertical.void setAntialiasing(java.lang.Object value)
value
- The antialising value to be set depending on the platform.java.lang.Object getAntialiasing()
void activateAntialiasing()
void disableAntialiasing()
void drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth, boolean drawAtBaseLine)
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 Yvoid drawWrappedString(AttributedString aStr, int x, int y, int wrappingWidth)
aStr
- The text, as an attributed string.x
- The x coordinate.y
- The y coordinate.wrappingWidth
- The maximum width of the wrapped text.© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.