![]() |
libgpac
Documentation of the core library of GPAC
|
import <evg.idl;
Collaboration diagram for Canvas:Public Member Functions | |
| 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 | fill (GF_EVGMultiTextureMode operand, optional float param=0, Texture texture1, optional Texture texture2=null, optional Texture texture3=null) |
| void | reassign (ArrayBuffer data) |
| void | blit (Texture texture, optional IRect dst_wnd=null, optional IRect src_wnd=null, optional BlitParameters params=null) |
| void | enable_threading (optional int nb_threads=-1) |
| void | enable_3d () |
| 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) |
| void | projection (Float32Buffer projection_matrix) |
| void | modelview (Float32Buffer modelview_matrix) |
| void | draw_array (Int32Buffer indices, Float32Buffer vertices, optional GF_EVGPrimitiveType primitive_type=GF_EVG_TRIANGLES, optional long nb_components=3) |
| void | draw_path (Path path, optional float z=0) |
| void | draw_path (Text text, optional float z=0) |
| void | clear_depth (float depth) |
| void | viewport (long x, long y, long width, long height) |
| void | viewport () |
| Shader | new_shader (ShaderType shader_type) |
Data Fields | |
| attribute boolean | centered |
| writeonly Path | path |
| writeonly Matrix2D | matrix |
| writeonly IRect | clipper |
| readonly boolean | has_clipper |
| attribute unsigned long | compositeOperation |
| attribute unsigned long | level |
| attribute AlphaCallback | on_alpha |
| readonly attribute boolean | is_yuv |
| readonly attribute unsigned long | depth |
| Shader | fragment |
| Shader | vertex |
| writeonly boolean | ccw |
| writeonly boolean | backcull |
| writeonly boolean | antialias |
| writeonly float | min_depth |
| writeonly float | max_depth |
| writeonly float | point_size |
| writeonly boolean | point_smooth |
| writeonly float | line_size |
| writeonly boolean | clip_zero |
| writeonly GF_EVGDepthTest | depth_test |
| writeonly boolean | write_depth |
| Float32Buffer | depth_buffer |
The Canvas object is used to draw vectorial 2D path
| Canvas::Canvas | ( | unsigned long | width, |
| unsigned long | height, | ||
| DOMString | pixfmt | ||
| ) |
Canvas constructor. The canvas memory is owned by the canvas object
| width | the width in pixels of the canvas |
| height | the height in pixels of the canvas |
| pixfmt | the pixel fomat of the canvas |
| 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
| 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 |
| 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
| 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 |
clears the canvas with the given color. See gf_evg_surface_clear
| rc | the rectangle to clear, in pixel coordinates |
| color | an HTML/SVG color name or an HTML color value formatted as $RRGGBB, #RRGGBB or 0xRRGGBB |
clears the canvas with the given color. See gf_evg_surface_clear
| rc | the rectangle to clear, in pixel coordinates |
| color | an HTML/SVG color name or an HTML color value formatted as $RRGGBB, #RRGGBB or 0xRRGGBB |
| void Canvas::clearf | ( | IRect | rc, |
| double | r, | ||
| double | g, | ||
| double | b, | ||
| double | a | ||
| ) |
clears the canvas with the given color
| 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 |
clears the canvas with the given color. See gf_evg_surface_clear
| rc | the rectangle to clear, in pixel coordinates |
| color | an HTML/SVG color name or an HTML color value formatted as $RRGGBB, #RRGGBB or 0xRRGGBB |
| void Canvas::fill | ( | Stencil | stencil | ) |
fills the path with the given solid brush or gradient stencil - see gf_evg_surface_fill
| stencil | the stencil to use |
| void Canvas::fill | ( | Texture | texture | ) |
fills the path with the given texture - see gf_evg_surface_fill
| texture | the texture to use |
| void Canvas::fill | ( | GF_EVGMultiTextureMode | operand, |
| optional float | param = 0, |
||
| Texture | texture1, | ||
| optional Texture | texture2 = null, |
||
| optional Texture | texture3 = null |
||
| ) |
fills the path with the given texture(s) - see gf_evg_surface_multi_fill
| operand | multitexture operand to use |
| param | float or float array used to control multitexture effect |
| texture1 | the texture or stencil to use as main texture |
| texture2 | the texture or stencil to use as secondary texture |
| texture3 | the texture or stencil to use as third texture |
| void Canvas::reassign | ( | ArrayBuffer | data | ) |
reassign internal data (typically at each new packet)
| data | the buffer to use |
| void Canvas::blit | ( | Texture | texture, |
| optional IRect | dst_wnd = null, |
||
| optional IRect | src_wnd = null, |
||
| optional BlitParameters | params = null |
||
| ) |
blits a texture pixel data onto the surface
The blit operations are usually faster than path fill operations, but only operate on axis-aligned rectangles.
| texture | the texture to use for pixel source |
| dst_wnd | the destination rectangle in canvas, must be completely included in canvas. Point{0,0} is top-left and {width,height} is bottom right |
| src_wnd | the source rectangle from the texture, must be completely included in texture. Point{0,0} is top-left and {width,height} is bottom right |
| params | the blit operation parameters. If null, let FFMPEG decide |
| void Canvas::enable_threading | ( | optional int | nb_threads = -1 | ) |
enables threading in rasterizer - see gf_evg_enable_threading
| nb_threads | the number of extra threads to use, negative values means all cores |
| void Canvas::enable_3d | ( | ) |
enables 3D extensions in rasterizer - see gf_evg_surface_enable_3d
| Object Canvas::toRGB | ( | optional bool | as_array = false, |
| Float | y, | ||
| Float | u, | ||
| Float | v, | ||
| optional Float | a = 1.0 |
||
| ) |
converts YUV color to RGB
| 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 |
converts YUV color to RGB
| 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 |
| Object Canvas::toYUV | ( | optional bool | as_array = false, |
| Float | r, | ||
| Float | g, | ||
| Float | b, | ||
| optional Float | a = 1.0 |
||
| ) |
converts RGB color to YUV
| 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 |
converts RGB color to YUV
| 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 |
| void Canvas::projection | ( | Float32Buffer | projection_matrix | ) |
| void Canvas::modelview | ( | Float32Buffer | modelview_matrix | ) |
| void Canvas::draw_array | ( | Int32Buffer | indices, |
| Float32Buffer | vertices, | ||
| optional GF_EVGPrimitiveType | primitive_type = GF_EVG_TRIANGLES, |
||
| optional long | nb_components = 3 |
||
| ) |
draws a set of primitives (see gf_evg_surface_draw_array)
| indices | array of indices in the vertex buffer for the primitives to draw |
| vertices | the vertices to use |
| primitive_type | the type of primitive to draw |
| nb_components | the number of components per vertex (eg, 2, 3) |
| void Canvas::draw_path | ( | Path | path, |
| optional float | z = 0 |
||
| ) |
draws a path (see gf_evg_surface_draw_path)
| path | the path to draw |
| z | the z value to assign to points in the path |
| void Canvas::draw_path | ( | Text | text, |
| optional float | z = 0 |
||
| ) |
draws a text (see gf_evg_surface_draw_path)
| text | the text to draw |
| z | the z value to assign to points in the text's path |
| void Canvas::clear_depth | ( | float | depth | ) |
clears the depth buffer (see gf_evg_surface_clear_depth)
| depth | the depth value to set |
| void Canvas::viewport | ( | long | x, |
| long | y, | ||
| long | width, | ||
| long | height | ||
| ) |
sets the viewport (see gf_evg_surface_viewport)
| x | the horizontal coordinate of the top-left corner of the viewport |
| y | the vertical coordinate of the top-left corner of the viewport |
| width | the width of the viewport |
| height | the height of the viewport |
| void Canvas::viewport | ( | ) |
sets the viewport to full canvas {0,0,width,height} (see gf_evg_surface_viewport)
| Shader Canvas::new_shader | ( | ShaderType | shader_type | ) |
creats a new shader
| shader_type | the desired shader type |
| attribute boolean Canvas::centered |
indicates if surface coordinates are centered or not - see gf_evg_surface_set_center_coords
| writeonly Path Canvas::path |
path to draw - see gf_evg_surface_set_path. The path object is either a Path or a Text
| writeonly Matrix2D Canvas::matrix |
matrix to apply to path - see gf_evg_surface_set_matrix.
| writeonly IRect Canvas::clipper |
clipper in pixel coordinates - see gf_evg_surface_set_clipper
| readonly boolean Canvas::has_clipper |
true if cliper is active on canvas
| attribute unsigned long Canvas::compositeOperation |
composite operation for alpha surfaces - see gf_evg_surface_set_composite_mode
| attribute unsigned long Canvas::level |
AA level of canvas - see gf_evg_surface_get_raster_level and gf_evg_surface_set_raster_level
| attribute AlphaCallback Canvas::on_alpha |
alpha custom callback composite operation for alpha surfaces - see gf_evg_surface_set_alpha_callback Default is undefined at creation time
| readonly attribute boolean Canvas::is_yuv |
set to true of canvas is a YUV-based format, false if RGB-based format
| readonly attribute unsigned long Canvas::depth |
number of bits per component (8, 10, etc)
| Shader Canvas::fragment |
fragment shader to use, set to NULL to disable pixel writing.
| Shader Canvas::vertex |
vertex shader to use, set to NULL to disable vertex shading, in which case the currently defined projection and modelview matrices will be used
| writeonly boolean Canvas::ccw |
set face orientation to counter-clockwise or clockwise (see gf_evg_surface_set_ccw)
| writeonly boolean Canvas::backcull |
backface culling enabled (see gf_evg_surface_set_backcull), default is true
| writeonly boolean Canvas::antialias |
antialiased enabled (see gf_evg_surface_set_antialias), default is true
| writeonly float Canvas::min_depth |
min depth (see gf_evg_surface_set_min_depth), default is 0
| writeonly float Canvas::max_depth |
max depth (see gf_evg_surface_set_max_depth), default is 1.0
| writeonly float Canvas::point_size |
point size (see gf_evg_surface_set_point_size), default is 1.0
| writeonly boolean Canvas::point_smooth |
point smoothing enabled (see gf_evg_surface_set_point_smooth), default is false
| writeonly float Canvas::line_size |
line size (see gf_evg_surface_set_line_size), default is 1.0
| writeonly boolean Canvas::clip_zero |
clip zero enabled (see gf_evg_surface_set_clip_zero), default is false
| writeonly GF_EVGDepthTest Canvas::depth_test |
depth test mode (see gf_evg_set_depth_test), default is GF_EVGDEPTH_LESS
| writeonly boolean Canvas::write_depth |
write depth buffer enabled (see gf_evg_surface_write_depth), default is true
| Float32Buffer Canvas::depth_buffer |
depth buffer (see gf_evg_surface_set_depth_buffer).