libgpac
Documentation of the core library of GPAC
|
Vector Graphics rendering of GPAC. More...
Data Structures | |
struct | GF_EVGFragmentParam |
struct | GF_EVGVertexParam |
Typedefs | |
typedef struct _gf_evg_base_stencil | GF_EVGStencil |
typedef struct _gf_evg_surface | GF_EVGSurface |
typedef void(* | gf_evg_texture_callback) (void *cbk, u32 x, u32 y, Float *r, Float *g, Float *b, Float *a) |
typedef u8(* | gf_evg_get_alpha) (void *udta, u8 src_alpha, s32 x, s32 y) |
typedef Bool(* | gf_evg_fragment_shader) (void *udta, GF_EVGFragmentParam *fragp) |
typedef Bool(* | gf_evg_fragment_shader_init) (void *udta, GF_EVGFragmentParam *fragp, u32 th_id, Bool is_cleanup) |
typedef Bool(* | gf_evg_vertex_shader) (void *udta, GF_EVGVertexParam *vertp) |
GPAC uses a software rasterizer for vector graphics based on FreeType's "ftgray" anti-aliased renderer.
The rasterizer supports
The rasterizer is only capable of filling a given GF_Path object
The rasterizer also supports experimental drawing of 3D primitives (point, lines, triangles). This is obviously not intended to replace GPU rendering, but can be useful to draw simple primitives over an existing video source. The following constraints apply in 3D mode:
struct GF_EVGFragmentParam |
Parameters for the fragment callback
Data Fields | ||
---|---|---|
Float | screen_x |
screen x in pixels - input param |
Float | screen_y |
screen y in pixels - input param |
Float | screen_z |
screen z in NDC - input param |
Float | depth |
depth - input and output param - 3D shaders only |
u32 | prim_index |
primitive index in the current gf_evg_surface_draw_array call, 0 being the first primitive - input param - 3D shaders only |
u32 | idx1 |
index of first vertex in the current primitive - input param - 3D shaders only |
u32 | idx2 |
index of second vertex in the current primitive (for lines or triangles/quads) - input param - 3D shaders only |
u32 | idx3 |
index of third vertex in the current primitive (for triangles/quads) - input param - 3D shaders only |
GF_EVGPrimitiveType | ptype |
primitive type - input param - 3D shaders only |
GF_Vec4 | color |
fragment color, must be written if fragment is not discarded - output value |
u32 | color_pack |
fragment color in pack 32 bit ARGB/AYUV |
u64 | color_pack_wide |
fragment color in pack 64 bit ARGB/AYUV |
GF_EVGFragmentType | frag_valid |
fragment valid state - output value |
Float | pbc1 |
perspective corrected barycentric, eg bc1/q1, bc2/q2, bc3/q3 - 3D shaders only |
Float | pbc2 | |
Float | pbc3 | |
Float | persp_denum |
perspective divider - 3D shaders only
|
void * | shader_udta | |
u32 | tx_x |
horizontal texture coordinate, 0 is left of image - 2D shaders only |
u32 | tx_y |
vertical texture coordinate, 0 is top of image - 2D shaders only |
u32 | tx_width |
texture width - 2D shaders only |
u32 | tx_height |
texture height - 2D shaders only |
u8 | coverage |
coverage value between 0 and 0xFF - 2D shaders only |
u8 | odd_flag |
odd / even flag for path drawn with zero/non-zero fill rule - 2D shaders only |
struct GF_EVGVertexParam |
Parameters for the vertex callback
Data Fields | ||
---|---|---|
GF_Vec4 | in_vertex |
input vertex - input param |
u32 | prim_index |
primitive index in the current gf_evg_surface_draw_array call, 0 being the first primitive - input param |
u32 | vertex_idx |
index of the vertex - input param |
u32 | vertex_idx_in_prim |
index of the vertex in the current primitive - input param |
u32 | ptype |
primitive type - input param |
GF_Vec4 | out_vertex |
transformed vertex to use, must be written - output values |
typedef struct _gf_evg_base_stencil GF_EVGStencil |
stencil type used for all stencils
typedef struct _gf_evg_surface GF_EVGSurface |
surface type
typedef void(* gf_evg_texture_callback) (void *cbk, u32 x, u32 y, Float *r, Float *g, Float *b, Float *a) |
callback function prototype for parametric textures
cbk | user data callback |
x | horizontal coordinate in texture, ranging between 0 and width-1, (0,0) being top-left pixel, or horizontal coordinate of destination pixel on surface |
y | vertical coordinate in texture, ranging between 0 and height-1, (0,0) being top-left pixel, or vertical coordinate of destination pixel on surface |
r | set to the red value (not initialized before call) |
g | set to the green value (not initialized before call) |
b | set to the blue value (not initialized before call) |
a | set to the alpha value (not initialized before call) |
callback type for alpha override
udta | opaque data passed back to caller |
src_alpha | alpha value about to be blended |
x | horizontal coordinate of pixel to be drawn, {0,0} being top-left, positive Y go down |
y | vertical coordinate of pixel to be drawn, {0,0} being top-left, positive Y go down |
typedef Bool(* gf_evg_fragment_shader) (void *udta, GF_EVGFragmentParam *fragp) |
callback type for fragment shader
udta | opaque data passed back to caller |
fragp | fragment paramters |
typedef Bool(* gf_evg_fragment_shader_init) (void *udta, GF_EVGFragmentParam *fragp, u32 th_id, Bool is_cleanup) |
callback type for fragment shader init, called once before each primitive - may be NULL
udta | opaque data passed back to caller |
fragp | fragment paramters |
th_id | index of thread context |
is_cleanup | if TRUE indicates and of primitive rendering, otherwise begin |
typedef Bool(* gf_evg_vertex_shader) (void *udta, GF_EVGVertexParam *vertp) |
callback type for vertex shader
udta | opaque data passed back to caller |
vertp | vertex paramters |
enum GF_StencilType |
enum GF_GradientMode |
enum GF_TextureMapFlags |
enum GF_TextureFilter |
filter levels for texturing - up to the graphics engine but the following levels are used by the client
enum GF_RasterQuality |
Operands for multitexture operations
enum GF_EVGCompositeMode |
Composition mode used for ARGB surfaces - cf Canvas2D modes
enum GF_EVGPrimitiveType |
Primitive types for 3D software rasterize - see OpenGL terminology
enum GF_EVGDepthTest |
Depth test modes
enum GF_EVGFragmentType |
enum GF_EVGMaskMode |
global alpha mask values
GF_EVGStencil* gf_evg_stencil_new | ( | GF_StencilType | type | ) |
common constructor for all stencil types
type | the stencil type |
void gf_evg_stencil_delete | ( | GF_EVGStencil * | stencil | ) |
common destructor for all stencils
stencil | the target stencil |
GF_Err gf_evg_stencil_set_matrix | ( | GF_EVGStencil * | stencil, |
GF_Matrix2D * | mat | ||
) |
sets stencil transformation matrix
stencil | the target stencil |
mat | the 2D matrix to set |
Bool gf_evg_stencil_get_matrix | ( | GF_EVGStencil * | stencil, |
GF_Matrix2D * | mat | ||
) |
gets stencil transformation matrix
stencil | the target stencil |
mat | the 2D matrix to fetch |
GF_Err gf_evg_stencil_set_auto_matrix | ( | GF_EVGStencil * | stencil, |
Bool | auto_on | ||
) |
sets stencil transformation matrix auto mode.
When auto matrix mode is activated, the stencil matrix only describes texture mapping transform in uv space (normalized UV coordinates, OpenGL like), and final transformation to raster coordinates is done internally. When auto matrix mode is not activated,, the stencil matrix must describe the complete transformation from uv space to raster coordinates (consequently, the matrix usually includes the final path transformation).
Stencils are by default created in auto matrix mode.
stencil | the target stencil |
auto_on | If true, the surface current matrix will be added to the stencil matrix when drawing, otherwise the stencil matrix is in final surface coordinates |
Bool gf_evg_stencil_get_auto_matrix | ( | GF_EVGStencil * | stencil | ) |
sets stencil transformation matrix auto mode.
stencil | the target stencil |
GF_StencilType gf_evg_stencil_type | ( | GF_EVGStencil * | stencil | ) |
gets stencil type
stencil | the target stencil |
GF_Err gf_evg_stencil_set_brush_color | ( | GF_EVGStencil * | stencil, |
GF_Color | color | ||
) |
sets color for solid brush stencil
stencil | the target stencil |
color | the color to set |
GF_Color gf_evg_stencil_get_brush_color | ( | GF_EVGStencil * | stencil | ) |
gets color for solid brush stencil
stencil | the target stencil |
GF_Err gf_evg_stencil_set_gradient_mode | ( | GF_EVGStencil * | stencil, |
GF_GradientMode | mode | ||
) |
sets gradient repeat mode for a gradient stencil
stencil | the target stencil |
mode | the gradient mode |
GF_Err gf_evg_stencil_set_linear_gradient | ( | GF_EVGStencil * | stencil, |
Fixed | start_x, | ||
Fixed | start_y, | ||
Fixed | end_x, | ||
Fixed | end_y | ||
) |
sets linear gradient direction for a gradient stencil Gradient line is defined by start and end. For example, {0,0}, {1,0} defines an horizontal gradient
stencil | the target stencil |
start_x | horizontal coordinate of starting point |
start_y | vertical coordinate of starting point |
end_x | horizontal coordinate of ending point |
end_y | vertical coordinate of ending point |
GF_Err gf_evg_stencil_set_radial_gradient | ( | GF_EVGStencil * | stencil, |
Fixed | cx, | ||
Fixed | cy, | ||
Fixed | fx, | ||
Fixed | fy, | ||
Fixed | x_radius, | ||
Fixed | y_radius | ||
) |
sets radial gradient center point, focal point and radius for a gradient stencil
stencil | the target stencil |
cx | horizontal coordinate of center |
cy | vertical coordinate of center |
fx | horizontal coordinate of focal point |
fy | vertical coordinate of focal point |
x_radius | horizontal radius |
y_radius | vertical radius |
GF_Err gf_evg_stencil_set_gradient_interpolation | ( | GF_EVGStencil * | stencil, |
Fixed * | pos, | ||
GF_Color * | col, | ||
u32 | count | ||
) |
sets color interpolation for a gradient stencil
stencil | the target stencil |
pos | interpolation positions. Each position gives the distance from (center for radial, start for linear) expressed between 0 and 1 (1 being the gradient bounds) - may be NULL when count is 0 |
col | colors at the given position - may be NULL when count is 0 |
count | number of colors and position. A value of 0 resets the gradient colors |
GF_Err gf_evg_stencil_push_gradient_interpolation | ( | GF_EVGStencil * | stencil, |
Fixed | pos, | ||
GF_Color | col | ||
) |
pushes a single color interpolation for a gradient stencil
stencil | the target stencil |
pos | interpolation position. A position gives the distance from (center for radial, start for linear) expressed between 0 and 1 (1 being the gradient bounds) |
col | color at the given position |
GF_Err gf_evg_stencil_set_alpha | ( | GF_EVGStencil * | stencil, |
u8 | alpha | ||
) |
sets global alpha blending level for a stencil The alpha channel will be combined with the color matrix if any
stencil | the target stencil |
alpha | the alpha value between 0 (full transparency) and 255 (full opacityy) |
u8 gf_evg_stencil_get_alpha | ( | GF_EVGStencil * | stencil | ) |
gets global alpha blending level of a stencil
stencil | the target stencil |
Bool gf_evg_texture_format_ok | ( | GF_PixelFormat | pixelFormat | ) |
checks if pixel format is supported for a texture stencil
pixelFormat | the target pixel format |
GF_Err gf_evg_stencil_set_texture | ( | GF_EVGStencil * | stencil, |
u8 * | pixels, | ||
u32 | width, | ||
u32 | height, | ||
u32 | stride, | ||
GF_PixelFormat | pixelFormat | ||
) |
sets pixel data for a texture stencil
stencil | the target stencil |
pixels | texture data starting from top row |
width | texture width in pixels |
height | texture height in pixels |
stride | texture horizontal pitch (bytes to skip to get to next row) |
pixelFormat | texture pixel format |
GF_Err gf_evg_stencil_set_texture_planes | ( | GF_EVGStencil * | stencil, |
u32 | width, | ||
u32 | height, | ||
GF_PixelFormat | pixelFormat, | ||
const u8 * | y_or_rgb, | ||
u32 | stride, | ||
const u8 * | u_plane, | ||
const u8 * | v_plane, | ||
u32 | uv_stride, | ||
const u8 * | alpha_plane, | ||
u32 | alpha_stride | ||
) |
sets pixel planes data for a texture stencil
stencil | the target stencil |
width | texture width in pixels |
height | texture height in pixels |
pixelFormat | texture pixel format |
y_or_rgb | Y plane or RGB plane |
stride | stride of the Y or RGB plane |
u_plane | U plane or UV plane for semi-planar YUV formats |
v_plane | V plane for planar YUV format, NULL for semi-planar YUV formats |
uv_stride | stride of the U and V or UV plane |
alpha_plane | alpha plane |
alpha_stride | stride of the alpha plane; if 0 and alpha plane is not NULL, the stride is assumed to be the same as the Y plane stride |
GF_Err gf_evg_stencil_set_palette | ( | GF_EVGStencil * | stencil, |
const u8 * | palette, | ||
u32 | pix_fmt, | ||
u32 | nb_cols | ||
) |
sets texture palette, only for greyscale textures.
stencil | the target stencil |
palette | palette data |
pix_fmt | palette pixel format, must be RGB/BGR or any RGBA format |
nb_cols | number of colors in palette |
GF_Err gf_evg_stencil_set_texture_parametric | ( | GF_EVGStencil * | stencil, |
u32 | width, | ||
u32 | height, | ||
GF_PixelFormat | pixelFormat, | ||
gf_evg_texture_callback | callback, | ||
void * | cbk_udta, | ||
Bool | use_screen_coords | ||
) |
sets parametric callback on a texture stencil. A parametric texture gets its pixel values from a callback function, the resulting value being blended according to the antialiasing level of the pixel. This allows creating rather complex custom textures, in a fashion similar to fragment shaders.
stencil | the target stencil |
width | texture width in pixels |
height | texture height in pixels |
pixelFormat | texture pixel format, indicates if the returned values are in RGB or YUV |
callback | the callback function to use |
cbk_udta | user data to pass to the callback function |
use_screen_coords | if set, the coordinates passed to the callback function are screen coordinates rather than texture coordinates |
GF_Err gf_evg_stencil_set_mapping | ( | GF_EVGStencil * | stencil, |
GF_TextureMapFlags | map_mode | ||
) |
sets texture mapping options for a texture stencil
stencil | the target stencil |
map_mode | texture mapping flags to set |
GF_Err gf_evg_stencil_set_pad_color | ( | GF_EVGStencil * | stencil, |
GF_Color | pad_color | ||
) |
sets padding color in RGBA If texture repeat is disabled and pad color is set, this color is used when outside of image, otherwise pixel is fetch from image border
stencil | the target stencil |
pad_color | color to use , 0 disables color padding |
u32 gf_evg_stencil_get_pad_color | ( | GF_EVGStencil * | stencil | ) |
gets padding color in RGBA
stencil | the target stencil |
GF_Err gf_evg_stencil_set_filter | ( | GF_EVGStencil * | stencil, |
GF_TextureFilter | filter_mode | ||
) |
sets filtering mode for a texture stencil
stencil | the target stencil |
filter_mode | texture filtering mode to set |
GF_Err gf_evg_stencil_set_color_matrix | ( | GF_EVGStencil * | stencil, |
GF_ColorMatrix * | cmat | ||
) |
sets color matrix of a stencil
stencil | the target stencil |
cmat | the color matrix to use. If NULL, resets current color matrix |
GF_Err gf_evg_stencil_get_color_matrix | ( | GF_EVGStencil * | stencil, |
GF_ColorMatrix * | cmat | ||
) |
gets color matrix of a stencil
stencil | the target stencil |
cmat | filled with current color matrix of stencil |
u32 gf_evg_stencil_get_pixel | ( | GF_EVGStencil * | stencil, |
s32 | x, | ||
s32 | y | ||
) |
gets pixel at given position in ARGB format
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
u32 gf_evg_stencil_get_pixel_yuv | ( | GF_EVGStencil * | stencil, |
s32 | x, | ||
s32 | y | ||
) |
gets pixel at given position in AYUV format
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
u64 gf_evg_stencil_get_pixel_wide | ( | GF_EVGStencil * | stencil, |
s32 | x, | ||
s32 | y | ||
) |
gets pixel at given position in ARGB format for more than 8 bits textures
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
u64 gf_evg_stencil_get_pixel_yuv_wide | ( | GF_EVGStencil * | stencil, |
s32 | x, | ||
s32 | y | ||
) |
gets pixel at given position in AYUV format for more than 8 bits textures
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
GF_Vec4 gf_evg_stencil_get_pixel_f | ( | GF_EVGStencil * | stencil, |
Float | x, | ||
Float | y | ||
) |
gets ARGB pixel at a given position The position is given as normalize coordinates (between 0.0 and 1.0), {0.0,0.0} is top-left, {1.0,1.0} is bottom-right
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
GF_Vec4 gf_evg_stencil_get_pixel_yuv_f | ( | GF_EVGStencil * | stencil, |
Float | x, | ||
Float | y | ||
) |
gets AYUV pixel at a given position The position is given as normalize coordinates (between 0.0 and 1.0), {0.0,0.0} is top-left, {1.0,1.0} is bottom-right
stencil | the target stencil |
x | horizontal coord |
y | vertical coord |
GF_EVGSurface* gf_evg_surface_new | ( | Bool | center_coords | ) |
creates a canvas surface object
center_coords | if GF_TRUE, indicates mathematical-like coord system (0,0) at the center of the canvas, otherwise indicates computer-like coord system (0,0) top-left corner |
void gf_evg_surface_delete | ( | GF_EVGSurface * | surf | ) |
deletes a surface object
surf | the surface object |
GF_Err gf_evg_enable_threading | ( | GF_EVGSurface * | surf, |
s32 | nb_threads | ||
) |
enables threading on a canvas surface object (can only be called once per surface)
surf | the target surface |
nb_threads | number of additional threads to use for rendering. -1 use all availables core |
GF_Err gf_evg_surface_attach_to_texture | ( | GF_EVGSurface * | surf, |
GF_EVGStencil * | sten | ||
) |
attaches a surface object to a texture stencil object
surf | the surface object |
sten | the stencil object (shll be a texture stencil) |
Bool gf_evg_surface_format_ok | ( | GF_PixelFormat | pixelFormat | ) |
checks if pixel format is supported for a surface
pixelFormat | the target pixel format |
GF_Err gf_evg_surface_attach_to_buffer | ( | GF_EVGSurface * | surf, |
u8 * | pixels, | ||
u32 | width, | ||
u32 | height, | ||
s32 | pitch_x, | ||
s32 | pitch_y, | ||
GF_PixelFormat | pixelFormat | ||
) |
attaches a surface object to a memory buffer
surf | the surface object |
pixels | texture data |
width | texture width in pixels |
height | texture height in pixels |
pitch_x | texture horizontal pitch (bytes to skip to get to next pixel). O means linear frame buffer (eg pitch_x==bytes per pixel) |
pitch_y | texture vertical pitch (bytes to skip to get to next line) |
pixelFormat | texture pixel format |
GF_Err gf_evg_surface_set_raster_level | ( | GF_EVGSurface * | surf, |
GF_RasterQuality | level | ||
) |
sets rasterizer precision
surf | the surface object |
level | the raster quality level |
GF_RasterQuality gf_evg_surface_get_raster_level | ( | GF_EVGSurface * | surf | ) |
gets rasterizer precision
surf | the surface object |
GF_Err gf_evg_surface_force_aa | ( | GF_EVGSurface * | surf | ) |
Force next path fill to use antialias, reset at each gf_evg_surface_set_path
surf | the surface object |
GF_Err gf_evg_surface_set_matrix | ( | GF_EVGSurface * | surf, |
GF_Matrix2D * | mat | ||
) |
sets the given matrix as the current transformations for all drawn paths
surf | the surface object |
mat | the matrix to set; if NULL, resets the current transformation |
GF_Err gf_evg_surface_set_matrix_3d | ( | GF_EVGSurface * | surf, |
GF_Matrix * | mat | ||
) |
sets the given matrix as the current transformations for all drawn paths. The matrix shall be a projection matrix (ortho or perspective) with normalized coordinates in [-1,1]. It may also contain a modelview part.
Perspective correct mapping is supported for textures and gradients:
surf | the surface object |
mat | the matrix to set; if NULL, resets the current transformation |
GF_Err gf_evg_surface_set_clipper | ( | GF_EVGSurface * | surf, |
GF_IRect * | rc | ||
) |
sets the given rectangle as a clipper When a clipper is enabled, nothing is drawn outside of the clipper. The clipper is not affected by the surface matrix
surf | the surface object |
rc | the clipper to set, in pixel coordinates of the surface; if NULL, disables clipper |
Bool gf_evg_surface_use_clipper | ( | GF_EVGSurface * | surf | ) |
checks if clipper is active
surf | the surface object |
GF_Err gf_evg_surface_set_path | ( | GF_EVGSurface * | surf, |
GF_Path * | path | ||
) |
sets the given path as the current one for drawing
surf | the surface object |
path | the target path to rasterize |
GF_Err gf_evg_surface_fill | ( | GF_EVGSurface * | surf, |
GF_EVGStencil * | stencil | ||
) |
draw (filling) the current path on a surface using the given stencil and current clipper if any. If the stencil is a solid brush and its alpha value is 0, the surface is cleared if it has an alpha component, otherwise the call is ignored.
surf | the surface object |
stencil | the stencil to use to fill a path, if NULL uses 2D shader if setup |
GF_Err gf_evg_surface_multi_fill | ( | GF_EVGSurface * | surf, |
GF_EVGMultiTextureMode | operand, | ||
GF_EVGStencil * | sten1, | ||
GF_EVGStencil * | sten2, | ||
GF_EVGStencil * | sten3, | ||
Float | params[4] | ||
) |
draw (filling) the current path on a surface using a compinaison of stencils and current clipper if any.
surf | the surface object |
operand | stencil combine effect |
sten1 | the first stencil to use, if NULL assumes shader and ignores operand |
sten2 | the second stencil to use, may be NULL depending on operand |
sten3 | the third stencil to use, may be NULL depending on operand |
params | the parameters to control the operand |
GF_Err gf_evg_surface_clear | ( | GF_EVGSurface * | surf, |
GF_IRect * | rc, | ||
GF_Color | col | ||
) |
clears given pixel rectangle on a surface with the given color
surf | the surface object |
rc | the rectangle in pixel coordinates to clear. This may lay outside the surface, and shall not be NULL |
col | the color used to clear the canvas. The alpha component is discarded if the surface does not have alpha, otherwise it is used |
void gf_evg_surface_set_center_coords | ( | GF_EVGSurface * | surf, |
Bool | center_coords | ||
) |
sets center coord mode of a surface
surf | the surface object |
center_coords | if GF_TRUE, indicates mathematical-like coord system (0,0) at the center of the canvas, otherwise indicates computer-like coord system (0,0) top-left corner |
void gf_evg_surface_set_composite_mode | ( | GF_EVGSurface * | surf, |
GF_EVGCompositeMode | comp_mode | ||
) |
sets surface composite mode, as defined in Canvas2D - only used for ARGB surfaces
surf | the surface object |
comp_mode | the composition mode to use |
void gf_evg_surface_set_alpha_callback | ( | GF_EVGSurface * | surf, |
gf_evg_get_alpha | get_alpha, | ||
void * | cbk | ||
) |
sets alpha callback function. This allows finer control over the blending, but does not allow for pixel color modification
surf | the surface object |
get_alpha | the callback function to alter the alpha value |
cbk | opaque data for the callback function |
GF_Err gf_evg_surface_enable_3d | ( | GF_EVGSurface * | surf | ) |
enables 3D software rasterizer for surface
surf | the target 3D surface |
GF_Err gf_evg_surface_set_projection | ( | GF_EVGSurface * | surf, |
GF_Matrix * | mx | ||
) |
sets projection matrix
surf | the target 3D surface |
mx | the target projection matrix |
GF_Err gf_evg_surface_set_modelview | ( | GF_EVGSurface * | surf, |
GF_Matrix * | mx | ||
) |
sets modelview matrix
surf | the target 3D surface |
mx | the target modelview matrix |
GF_Err gf_evg_surface_draw_array | ( | GF_EVGSurface * | surf, |
u32 * | indices, | ||
u32 | nb_indices, | ||
Float * | vertices, | ||
u32 | nb_vertices, | ||
u32 | nb_comp, | ||
GF_EVGPrimitiveType | prim_type | ||
) |
draws a set of primitive using vertices and an index buffer modelview matrix
surf | the target 3D surface |
indices | the array of indices to use in the vertex buffer |
nb_indices | the number of indices |
vertices | the array of vertices to use |
nb_vertices | the number of vertices |
nb_comp | the number of component per vertices (eg, 2, 3) |
prim_type | the primitive type to use |
GF_Err gf_evg_surface_clear_depth | ( | GF_EVGSurface * | surf, |
Float | depth | ||
) |
clears the depth buffer
surf | the target 3D surface |
depth | the depth value to use |
sets the surface viewport to convert from projected coordiantes to screen coordinates
surf | the target 3D surface |
x | the top-left coordinate of the viewport in pixels |
y | the top-left coordinate of the viewport in pixels |
w | the width of the viewport in pixels |
h | the height of the viewport in pixels |
GF_Err gf_evg_surface_draw_path | ( | GF_EVGSurface * | surf, |
GF_Path * | path, | ||
Float | z | ||
) |
draws path on a 3D surface with the given z.
The vertex shader is ignored (surface matrix must be set), and the fragment shader is called using perspective interpolation weights derived from the path bounds, using path bounds (top-left, top-right, bottom-right) vertices.
surf | the target 3D surface |
path | the path to draw |
z | the z value to assign to the path in local coordinate system |
GF_Err gf_evg_set_depth_test | ( | GF_EVGSurface * | surf, |
GF_EVGDepthTest | mode | ||
) |
sets depth buffer test
surf | the target 3D surface |
mode | the desired depth test mode |
GF_Err gf_evg_surface_set_fragment_shader | ( | GF_EVGSurface * | surf, |
gf_evg_fragment_shader | shader, | ||
gf_evg_fragment_shader_init | shader_init, | ||
void * | shader_udta | ||
) |
assigns fragment shader to the rasterizer.
surf | the target 3D surface |
shader | the fragment shader callback to use |
shader_init | the fragment shader init callback to use |
shader_udta | opaque data to pass to the callback function |
GF_Err gf_evg_surface_set_vertex_shader | ( | GF_EVGSurface * | surf, |
gf_evg_vertex_shader | shader, | ||
void * | shader_udta | ||
) |
assigns vertex shader to the rasterizer
surf | the target 3D surface |
shader | the vertex shader callback to use |
shader_udta | opaque data to pass to the callback function |
GF_Err gf_evg_surface_set_ccw | ( | GF_EVGSurface * | surf, |
Bool | is_ccw | ||
) |
sets face orientation for the primitives
surf | the target 3D surface |
is_ccw | if GF_TRUE, face are given in counter-clockwise order, otherwise in clockwise order |
GF_Err gf_evg_surface_set_backcull | ( | GF_EVGSurface * | surf, |
Bool | backcull | ||
) |
enables/disables backface culling
surf | the target 3D surface |
backcull | if GF_TRUE, faces with normals poiting away from camera will not be drawn |
GF_Err gf_evg_surface_set_antialias | ( | GF_EVGSurface * | surf, |
Bool | antialias | ||
) |
enables/disables anti-aliased rendering
surf | the target 3D surface |
antialias | if GF_TRUE, edges will be anti-aliased |
GF_Err gf_evg_surface_set_min_depth | ( | GF_EVGSurface * | surf, |
Float | min_depth | ||
) |
sets minimum depth value for coordinates normalization - see OpenGL glDepthRange
surf | the target 3D surface |
min_depth | the minimum depth value |
GF_Err gf_evg_surface_set_max_depth | ( | GF_EVGSurface * | surf, |
Float | max_depth | ||
) |
sets maximum depth value for coordinates normalization - see OpenGL glDepthRange
surf | the target 3D surface |
max_depth | the maximum depth value |
GF_Err gf_evg_surface_set_clip_zero | ( | GF_EVGSurface * | surf, |
Bool | clip_zero | ||
) |
indicates that the clip space after projection is [0,1] and not [-1, 1]
surf | the target 3D surface |
clip_zero | if GF_TRUE, the projected vertices depth are in [0, 1], otherwise in [-1, 1] |
GF_Err gf_evg_surface_set_point_size | ( | GF_EVGSurface * | surf, |
Float | size | ||
) |
sets point size value for points primitives
surf | the target 3D surface |
size | the desired point size in pixels |
GF_Err gf_evg_surface_set_line_size | ( | GF_EVGSurface * | surf, |
Float | size | ||
) |
sets line size (width) value for points primitives
surf | the target 3D surface |
size | the desired line size in pixels |
GF_Err gf_evg_surface_set_point_smooth | ( | GF_EVGSurface * | surf, |
Bool | smooth | ||
) |
enables point smoothing. When point smoothing is enabled, the geometry drawn is a circle, otherwise a square
surf | the target 3D surface |
smooth | if GF_TRUE, point smoothing is enabled |
GF_Err gf_evg_surface_disable_early_depth | ( | GF_EVGSurface * | surf, |
Bool | disable | ||
) |
disables early depth test If your fragment shader modifies the depth of the fragment, you must call this function to avoid early depth test (fragment discarded before calling the shader)
surf | the target 3D surface |
disable | if GF_TRUE, early depth test is disabled |
GF_Err gf_evg_surface_write_depth | ( | GF_EVGSurface * | surf, |
Bool | do_write | ||
) |
disables depth buffer write
surf | the target 3D surface |
do_write | if GF_TRUE, depth values are written to the depth buffer (default when creating the rasterizer) |
GF_Err gf_evg_surface_set_depth_buffer | ( | GF_EVGSurface * | surf, |
Float * | depth | ||
) |
sets depth buffer The 3D rasterizer does not allocate any surface (depth or color buffers), it is the user responsibility to set these buffers
surf | the target 3D surface |
depth | the depth buffer to use. Its size shall be Float*width*height |
GF_Err gf_gf_evg_rgb_to_yuv_f | ( | GF_EVGSurface * | surf, |
Float | r, | ||
Float | g, | ||
Float | b, | ||
Float * | y, | ||
Float * | cb, | ||
Float * | cr | ||
) |
performs RGB to YUV conversion
surf | the target surface |
r | the source red component |
g | the source green component |
b | the source blue component |
y | the output Y component |
cb | the output U/Cb component |
cr | the output V/Cr component |
GF_Err gf_evg_yuv_to_rgb_f | ( | GF_EVGSurface * | surf, |
Float | y, | ||
Float | cb, | ||
Float | cr, | ||
Float * | r, | ||
Float * | g, | ||
Float * | b | ||
) |
performs YUV to RGB conversion
surf | the target surface |
y | the source Y component |
cb | the source U/Cb component |
cr | the source V/Cr component |
r | the output red component |
g | the output green component |
b | the output blue component |
void gf_evg_rgb_to_yuv | ( | GF_EVGSurface * | surf, |
GF_Color | col, | ||
u8 * | y, | ||
u8 * | cb, | ||
u8 * | cr | ||
) |
converts RGB to YUV
surf | the target surface |
col | the source RGBA color |
y | the output Y value |
cb | the output Cb/U value |
cr | the output Cr/V value |
GF_Color gf_evg_argb_to_ayuv | ( | GF_EVGSurface * | surf, |
GF_Color | col | ||
) |
converts ARGB to AYUV
surf | the target surface |
col | the source ARGB color |
GF_Color gf_evg_ayuv_to_argb | ( | GF_EVGSurface * | surf, |
GF_Color | col | ||
) |
converts AYUV to ARGB
surf | the target surface |
col | the source AYUV color |
u64 gf_evg_argb_to_ayuv_wide | ( | GF_EVGSurface * | surf, |
u64 | col | ||
) |
converts ARGB to AYUV for wide colors
surf | the target surface |
col | the source ARGB color |
u64 gf_evg_ayuv_to_argb_wide | ( | GF_EVGSurface * | surf, |
u64 | col | ||
) |
converts AYUV to ARGB for wide color
surf | the target surface |
col | the source AYUV color |
GF_Err gf_evg_surface_set_mask_mode | ( | GF_EVGSurface * | surf, |
GF_EVGMaskMode | mask_mode | ||
) |
sets global alpha mask mode
The global alpha mask is an 8-bit alpha channel the size of the surface. Any resize operation on the surface will reset the alpha mask Typcial usage for the alpha mask is to setup the surface, use GF_EVGMASK_DRAW to draw your mask then GF_EVGMASK_USE to apply the mask on your draw calls
Whenever the mask mode is changed to GF_EVGMASK_DRAW, the alpha masked is cleared
surf | the target surface |
mask_mode | the current mask mode |
GF_EVGMaskMode gf_evg_surface_get_mask_mode | ( | GF_EVGSurface * | surf | ) |
gets global alpha mask mode
surf | the target surface |