API / geotoolkit / renderer / Graphics / Graphics
Graphics
Graphics
Constructors
Methods
Methods
▸ Abstract arcTo(x1, y1, x2, y2, radius): Graphics
Draws an arc to the target point as part of a path.
| Name | Type | Description |
|---|---|---|
x1 | number | coordinate of destination |
y1 | number | coordinate of destination |
x2 | number | coordinate |
y2 | number | coordinate |
radius | number | radius of arc |
this
▸ Abstract beginPath(): Graphics
Begin path
this
▸ Abstract bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): Graphics
Draws a cubic B\u00e9zier curve from the current point to the point (x, y), with control points (cp1x, cp1y) and (cp2x, cp2y).
| Name | Type | Description |
|---|---|---|
cp1x | number | the x coordinate of the first control point |
cp1y | number | the y coordinate of the first control point |
cp2x | number | the x coordinate of the second control point |
cp2y | number | the y coordinate of the second control point |
x | number | the x coordinate of the end point |
y | number | the y coordinate of the end point |
this
▸ Abstract closePath(): Graphics
Do nothing if the context has no subpaths. Otherwise, it marks the last subpath as closed, create a new subpath whose first point is the same as the previous subpath's first point, and finally add this new subpath to the path.
this
▸ Abstract drawAnnulusArc(x, y, innerRadius, outerRadius, startAngle, endAngle, sweepAngle?): Graphics
Draws a portion of an annulus clockwise ranging from startAngle to endAngle. If endAngle exceeds startAngle by Math.PI * 2 or more than annulus is drawn. Will fill in between the two arcs if fillStyle exists.
| Name | Type | Description |
|---|---|---|
x | number | x-coordinate of the center of the arc. |
y | number | y-coordinate of the center of the arc. |
innerRadius | number | inner radius of the arc |
outerRadius | number | outer radius of the arc |
startAngle | number | angle in radians measured from x-axis to the starting point of the arc (clockwise means positive angle; counterclockwise - otherwise). |
endAngle | number | Angle in radians measured from x-axis to ending point of the arc. |
Optional sweepAngle | number | Defines the sweep of the arc |
this
▸ Abstract drawArc(x, y, width, height, startAngle, endAngle, sweepAngle?, suppressLineToCenter?): Graphics
Draws an arc clockwise from startAngle to endAngle. If endAngle exceeds startAngle by Math.PI * 2 or more than ellipse is drawn. If fillStyle is not null, will fill the arc area using a direct line to close the path between start and end of arc. By default, this function renders a "pie" shape, using given fill and stroke style. In order to draw a real arc, set suppressLineToCenter=true.
| Name | Type | Description |
|---|---|---|
x | number | x-coordinate of the upper-left corner of the rectangle that bounds the ellipse. |
y | number | y-coordinate of the upper-left corner of the rectangle that bounds the ellipse. |
width | number | width of the rectangle that bounds the ellipse. |
height | number | height of the rectangle that bounds the ellipse. |
startAngle | number | angle in radians measured clockwise from positive x-axis to the starting point of the arc. |
endAngle | number | Angle in radians measured clockwise from positive x-axis to the ending point of the arc. |
Optional sweepAngle | number | Defines the sweep of the arc in radians. This parameter used if and only if startAngle == endAngle |
Optional suppressLineToCenter | boolean | Does not draw lines from the edges of arc to center point |
this
▸ Abstract drawEllipse(x, y, width, height): Graphics
Draw and fill ellipse
| Name | Type | Description |
|---|---|---|
x | number | x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse |
y | number | y--coordinate of the upper-left corner of the bounding rectangle that defines the ellipse |
width | number | width of the bounding rectangle that defines the ellipse. |
height | number | height of the bounding rectangle that defines the ellipse. |
this
▸ Abstract drawImage(image, srcX, srcY, srcW?, srcH?, dstX?, dstY?, dstW?, dstH?): Graphics
Draw an image onto the graphics context
Example
// Draw image can be used it the three different ways
// Provide only destination x and y
graphics.drawImage(image, dstX, dstY);
// Provide destination x and y and destination width and height
graphics.drawImage(image, dstX, dstY, dstW, dstW);
// Provide source x, y, width, height and destination x and y and destination width and height
graphics.drawImage(image, srcX, srcY, srcW, srcH, dstX, dstY, dstW, dstW);| Name | Type | Description |
|---|---|---|
image | Surface | IBaseImage | image to be rendered |
srcX | number | The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. Use the 7- or 9-argument syntax to use it as a source or the x-axis coordinate in the destination context at which to place the top-left corner of the source image. Use the 3- or 5-argument syntax to apply this argument as destination position. |
srcY | number | The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. Use the 7- or 9-argument syntax to use it as a source or the y-axis coordinate in the destination context at which to place the top-left corner of the source image. Use the 3- or 5-argument syntax to apply this argument as destination position. |
Optional srcW | number | source width if 7- or 9-argument is used or image width for other cases |
Optional srcH | number | source height if y-argument | image height for other cases |
Optional dstX | number | destination x position |
Optional dstY | number | destination y position |
Optional dstW | number | destination width This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn. |
Optional dstH | number | destination height. If not specified, the image is not scaled in height when drawn. |
this
▸ Abstract drawLine(x1, y1, x2, y2): Graphics
Draw line
| Name | Type | Description |
|---|---|---|
x1 | number | x-position of start point |
y1 | number | y-position of start point |
x2 | number | x-position of end point |
y2 | number | y-position of end point |
this
▸ drawPath(path): Graphics
Apply geometry on the rendering context. The method stroke must be called to draw path outlines or fillPath to fill the geometry
| Name | Type | Description |
|---|---|---|
path | GraphicsPath | path to draw |
this
▸ Abstract drawPolygon(x, array, start?, end?): Graphics
Draw and fill polygon. If fill style is null then it draws outline only.
| Name | Type | Description |
|---|---|---|
x | number[] | array of x coordinates of points |
array | number[] | of y coordinates of points |
Optional start | number | index of the first point in the array |
Optional end | number | index of the last point in the array |
this
▸ Abstract drawPolyline(x, y, start?, end?, multiDirection?): Graphics
Draw polyline
| Name | Type | Description |
|---|---|---|
x | number[] | array of x coordinates of points |
y | number[] | array of y coordinates of points |
Optional start | number | index of the first point in the array |
Optional end | number | index of the last point in the array |
Optional multiDirection | boolean | false for one direction array |
this
▸ Abstract drawRectangle(x, y?, width?, height?): Graphics
Draw and fill rectangle with the current style. If fill style is null then it draws outline only.
| Name | Type | Description |
|---|---|---|
x | number | Rect | X coordinate of the start point |
Optional y | number | Y coordinate of the start point |
Optional width | number | Width of rectangle |
Optional height | number | Height of rectangle |
this
▸ Abstract drawText(x, y, text): Graphics
Draw text
| Name | Type | Description |
|---|---|---|
x | number | x anchor position |
y | number | y anchor position |
text | string | text to draw |
this
▸ Abstract fillPath(): Graphics
Fill all the subpaths of the current path, using fillStyle, and using the non-zero winding number rule. Open subpaths will be implicitly closed when being filled (without affecting the actual subpaths).
this
▸ Abstract lineTo(x, y): Graphics
Draw line from the current position to the specified position
| Name | Type | Description |
|---|---|---|
x | number | x position |
y | number | y position |
this
▸ Abstract moveTo(x, y): Graphics
Move current position to x,y. Create a new subpath with the specified point as its first (and only) point.
| Name | Type | Description |
|---|---|---|
x | number | x position |
y | number | y position |
this
▸ Abstract setClip(geometry, operation?, isModel?, evenOdd?): Graphics
Sets clipping
| Name | Type | Description |
|---|---|---|
geometry | Rect | GraphicsPath | Region | geometry to clip |
Optional operation | GeometryOperation | operation to be applied for a new clipping |
Optional isModel | boolean | model coordinates flag |
Optional evenOdd | boolean | Defines if clipping to apply is even-odd |
this
▸ Abstract setFillPattern(pattern): Graphics
Set fill pattern
| Name | Type | Description |
|---|---|---|
pattern | Pattern | pattern to fill the area |
this
▸ Abstract setFillStyle(style, area?): Graphics
Set fill style
this
▸ Abstract setLineStyle(style, area?): Graphics
Set line style
| Name | Type | Description |
|---|---|---|
style | LineStyle | GradientStyle | a line style |
Optional area | Rect | area to apply fill property of line style |
this
▸ Abstract setTextStyle(textStyle): Graphics
Set text style
| Name | Type | Description |
|---|---|---|
textStyle | TextStyle | style |
this
▸ Abstract stroke(): Graphics
Calculate the strokes of all the subpaths of the current path
this