import"evg.idl";
|
| Canvas (unsigned long width, unsigned long height, DOMString pixfmt) |
|
| Canvas (unsigned long width, unsigned long height, DOMString pixfmt, ArrayBuffer data, optional unsigned long stride=0, optional unsigned long stride_uv=0) |
|
void | clear (IRect rc, unsigned long r, unsigned long g, unsigned long b, unsigned long a) |
|
void | clear (IRect rc, DOMString color) |
|
void | clear (IRect rc, DOMString color) |
|
void | clearf (IRect rc, double r, double g, double b, double a) |
|
void | clearf (IRect rc, DOMString color) |
|
void | fill (Stencil stencil) |
|
void | fill (Texture texture) |
|
void | reassign (ArrayBuffer data) |
|
Object | toRGB (optional bool as_array=false, Float y, Float u, Float v, optional Float a=1.0) |
|
Object | toRGB (optional bool as_array=false, Vec4f color) |
|
Object | toYUV (optional bool as_array=false, Float r, Float g, Float b, optional Float a=1.0) |
|
Object | toYUV (optional bool as_array=false, Vec4f color) |
|
The Canvas object is used to draw vectorial 2D path
◆ Canvas() [1/2]
Canvas::Canvas |
( |
unsigned long |
width, |
|
|
unsigned long |
height, |
|
|
DOMString |
pixfmt |
|
) |
| |
Canvas constructor. The canvas memory is owned by the canvas object
- Parameters
-
width | the width in pixels of the canvas |
height | the height in pixels of the canvas |
pixfmt | the pixel fomat of the canvas |
◆ Canvas() [2/2]
Canvas::Canvas |
( |
unsigned long |
width, |
|
|
unsigned long |
height, |
|
|
DOMString |
pixfmt, |
|
|
ArrayBuffer |
data, |
|
|
optional unsigned long |
stride = 0 , |
|
|
optional unsigned long |
stride_uv = 0 |
|
) |
| |
Canvas constructor
- Parameters
-
width | the width in pixels of the canvas |
height | the height in pixels of the canvas |
pixfmt | the pixel fomat of the canvas |
data | the data buffer on which to write. The size shall be greater than the size required for the given size and pixel format. |
stride | horizontal stride in pixel of the data |
stride_uv | horizontal stride in pixel of the data for the U and V planes |
◆ clear() [1/3]
void Canvas::clear |
( |
IRect |
rc, |
|
|
unsigned long |
r, |
|
|
unsigned long |
g, |
|
|
unsigned long |
b, |
|
|
unsigned long |
a |
|
) |
| |
clears the canvas with the given color - see gf_evg_surface_clear
- Note
- Omitting the last values will assume 0xFF for alpha, and 0 for other values.
- Parameters
-
rc | the rectangle to clear, in pixel coordinates |
r | red value, between 0 and 255 |
g | green value, between 0 and 255 |
b | blue value, between 0 and 255 |
a | alpha value, between 0 and 255 |
◆ clear() [2/3]
void Canvas::clear |
( |
IRect |
rc, |
|
|
DOMString |
color |
|
) |
| |
clears the canvas with the given color. See gf_evg_surface_clear
- Parameters
-
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
◆ clear() [3/3]
void Canvas::clear |
( |
IRect |
rc, |
|
|
DOMString |
color |
|
) |
| |
clears the canvas with the given color. See gf_evg_surface_clear
- Parameters
-
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
◆ clearf() [1/2]
void Canvas::clearf |
( |
IRect |
rc, |
|
|
double |
r, |
|
|
double |
g, |
|
|
double |
b, |
|
|
double |
a |
|
) |
| |
clears the canvas with the given color
- Note
- Omitting the last values will assume 1.0 for alpha, and 0.0 for other values. See gf_evg_surface_clear
- Parameters
-
rc | the rectangle to clear, in pixel coordinates |
r | red value, between 0.0 and 1.0 |
g | green value, between 0.0 and 1.0 |
b | blue value, between 0.0 and 1.0 |
a | alpha value, between 0.0 and 1.0 |
◆ clearf() [2/2]
void Canvas::clearf |
( |
IRect |
rc, |
|
|
DOMString |
color |
|
) |
| |
clears the canvas with the given color. See gf_evg_surface_clear
- Parameters
-
rc | the rectangle to clear, in pixel coordinates |
color | an HTML/SVG color name or an HTML color value formated as $RRGGBB, #RRGGBB or 0xRRGGBB |
◆ fill() [1/2]
void Canvas::fill |
( |
Stencil |
stencil | ) |
|
fills the path with the given solid brush or gradient stencil - see gf_evg_surface_fill
- Parameters
-
stencil | the stencil to use |
◆ fill() [2/2]
void Canvas::fill |
( |
Texture |
texture | ) |
|
fills the path with the given texture - see gf_evg_surface_fill
- Parameters
-
texture | the texture to use |
◆ reassign()
void Canvas::reassign |
( |
ArrayBuffer |
data | ) |
|
reassign internal data (typically at each new packet)
- Warning
- This assumes the data layout has not changed (width, height, pixel format, strides). If these are modified, create a new canvas.
- Parameters
-
◆ toRGB() [1/2]
Object Canvas::toRGB |
( |
optional bool |
as_array = false , |
|
|
Float |
y, |
|
|
Float |
u, |
|
|
Float |
v, |
|
|
optional Float |
a = 1.0 |
|
) |
| |
converts YUV color to RGB
- Parameters
-
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
y | Y component value |
u | Cb/U component value |
v | Cr/V component value |
a | alpha value, not modified |
- Returns
- the converted value
◆ toRGB() [2/2]
Object Canvas::toRGB |
( |
optional bool |
as_array = false , |
|
|
Vec4f |
color |
|
) |
| |
converts YUV color to RGB
- Parameters
-
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
color | the YUV value to convert |
- Returns
- the converted value
◆ toYUV() [1/2]
Object Canvas::toYUV |
( |
optional bool |
as_array = false , |
|
|
Float |
r, |
|
|
Float |
g, |
|
|
Float |
b, |
|
|
optional Float |
a = 1.0 |
|
) |
| |
converts RGB color to YUV
- Parameters
-
as_array | if true, the return object is an array of 4 components, otherwise it is Vec4f object |
r | red component value |
g | green component value |
b | blue component value |
a | alpha value, not modified |
- Returns
- the converted value
◆ toYUV() [2/2]
Object Canvas::toYUV |
( |
optional bool |
as_array = false , |
|
|
Vec4f |
color |
|
) |
| |
converts RGB color to YUV
- Parameters
-
as_array | if true, the return object is an array of 4 components, otherwise it is a Vec4f object |
color | the RGB value to convert |
- Returns
- the converted value
◆ centered
attribute boolean Canvas::centered |
indicates if surface coordinates are centered or not - see gf_evg_surface_set_center_coords
◆ path
writeonly Path Canvas::path |
path to draw - see gf_evg_surface_set_path. The path object is either a Path or a Text
◆ matrix
matrix to apply to path - see gf_evg_surface_set_matrix.
- Note
- A same path can be drawn several times with different matrices, null means no matrix.
◆ clipper
writeonly IRect Canvas::clipper |
clipper in pixel coordinates - see gf_evg_surface_set_clipper
- Note
- A same path can be drawn several times with different clipper, null means no clipper. Clipper applies to both fill and clear functions
◆ compositeOperation
attribute unsigned long Canvas::compositeOperation |
composite operation for alpha surfaces - see gf_evg_surface_set_composite_mode
◆ on_alpha
alpha custom callback composite operation for alpha surfaces - see gf_evg_surface_set_alpha_callback Default is undefined at creation time