API / geotoolkit / renderer / Surface / Surface
Define interface for a raster surface. This surface can be rendered to context
Constructors
Methods
Methods
▸ Abstract beginPaint(tr?, offset?, rect?, clearArea?): RenderingContext
Begin paint
| Name | Type | Description |
|---|---|---|
Optional tr | Transformation | transformation |
Optional offset | Point | The offset of the surface relative to device. |
Optional rect | Rect | The rectangle area to be cleared |
Optional clearArea | boolean | clear rendering area |
a node rendering context
▸ Abstract clear(): void
Clear surface
void
▸ Abstract createPixmap(width, height): Pixmap
Create pixmap object with the specified dimensions
| Name | Type | Description |
|---|---|---|
width | number | width of the image data |
height | number | height of the image data |
▸ Abstract drawImage(image, dx, dy): void
Draw image to surface
| Name | Type | Description |
|---|---|---|
image | Surface | IBaseImage | image to draw |
dx | number | the x coordinate of the upper-left corner of the destination rectangle |
dy | number | the y coordinate of the upper-left corner of the destination rectangle |
void
▸ Abstract endPaint(): void
End paint
void
▸ Abstract flipHorizontal(): Surface
Flip surface content horizontally
this
▸ Abstract flipVertical(): Surface
Flip surface content vertically
this
▸ getBase64(): string
Returns base64 representation
string
▸ Abstract getHeight(): number
Return height of the surface
number
▸ getPixelsCount(): number
Returns canvas surface pixels amount
number
▸ Abstract getPixmap(x, y, width, height): Pixmap
Get pixmap object representing the underlying pixel data for the area of the surface denoted by the rectangle which starts at (x, y) and has width and height.
| Name | Type | Description |
|---|---|---|
x | number | The x coordinate of the upper left corner of the rectangle from which the Pixmap will be extracted. |
y | number | The y coordinate of the upper left corner of the rectangle from which the Pixmap will be extracted. |
width | number | width of the image data |
height | number | height of the image data |
▸ Abstract getWidth(): number
Return width of the surface
number
▸ Abstract isValid(contextAttributes?): boolean
Check if surface is valid. If it was created for different pixel scale it is marked as invalid
| Name | Type |
|---|---|
Optional contextAttributes | CanvasRenderingContext2DSettings |
boolean
▸ Abstract putPixmap(pixmap, srcX, srcY, dstX?, dstY?, dstWidth?, dstHeight?): void
Renders data from the given Pixmap object onto the surface. If a dirty rectangle is provided, only the pixels from that rectangle are rendered.
| Name | Type | Description |
|---|---|---|
pixmap | Pixmap | pixmap, which contains pixels to be rendered |
srcX | number | horizontal position (x-coordinate) of the upper-left corner of the pixmap data rectangle in the target surface. |
srcY | number | vertical position (y-coordinate) of the upper-left corner of the pixmap data rectangle in the target surface |
Optional dstX | number | horizontal position (x-coordinate) where to place the image on the surface. Defaults to the top left of the whole pixmap. |
Optional dstY | number | vertical position (y-coordinate) where to place the image on the surface. Defaults to the top left of the whole image data. |
Optional dstWidth | number | width of the rectangle to be rendered, in the origin image data. Defaults to the width of the image data. |
Optional dstHeight | number | width of the rectangle to be rendered, in the origin image data. Defaults to the width of the image data. |
void
▸ Abstract release(): void
Release surface
void
▸ Abstract render(context, x, y, dstW?, dstH?, xImg?, yImg?, imgW?, imgH?): void
Render a surface at specified position of the target device. This method ignores transformation, which is set on context.
| Name | Type | Description |
|---|---|---|
context | RenderingContext | context to render surface |
x | number | the x coordinate of the upper-left corner of the destination rectangle |
y | number | the y coordinate of the upper-left corner of the destination rectangle |
Optional dstW | number | device width |
Optional dstH | number | device height |
Optional xImg | number | xPosition of the image to start rendering |
Optional yImg | number | yPosition of the image to start rendering |
Optional imgW | number | width of the image to draw |
Optional imgH | number | height of the image to draw |
void
▸ Abstract setDevicePixel(devicePixel): Surface
Sets device pixel
| Name | Type | Description |
|---|---|---|
devicePixel | boolean | If set to true, width and height will be used as 'device' pixels. |
this
▸ Abstract setSize(width, height): Surface
Sets surface size
| Name | Type | Description |
|---|---|---|
width | number | width of canvas |
height | number | height of canvas |
this