libgpac
Documentation of the core library of GPAC
Stencil Interface Reference

import"evg.idl";

+ Collaboration diagram for Stencil:

Public Member Functions

 SolidBrush ()
 
 LinearGradient ()
 
 RadialGradient ()
 
void set_color (Color color)
 
void set_color (DOMString color)
 
void set_color (unsigned long r, unsigned long g, unsigned long b, unsigned long a)
 
void set_colorf (Colorf color)
 
void set_colorf (double r, double g, double b, double a)
 
DOMString get_color ()
 
void set_alpha (unsigned long alpha)
 
void set_alphaf (double alpha)
 
double get_alphaf ()
 
void set_points (Point2D start, optional Point2D end={0, 0})
 
void set_points (Point2D center, Point2D focal, Point2D radius)
 
void set_stop (double pos, DOMString color)
 
void set_stop (double pos, Color color)
 
void set_stop (double pos, unsigned long r, unsigned long g, unsigned long b, unsigned long a)
 
void set_stopf (double pos, Colorf color)
 
void set_stopf (double pos, double r, double g, double b, double a)
 

Data Fields

writeonly unsigned long pad
 
writeonly unsigned long cmx
 
attribute Matrix2D mx
 
attribute readonly boolean solid_brush
 
attribute boolean auto_mx
 

Detailed Description

interface object to solid brush, linear gradient and radial gradient stencils

Member Function Documentation

◆ SolidBrush()

Stencil::SolidBrush ( )

constructor for solid color stencil

◆ LinearGradient()

Stencil::LinearGradient ( )

constructor for linear gradient stencil

◆ RadialGradient()

Stencil::RadialGradient ( )

constructor for radial gradient stencil

◆ set_color() [1/3]

void Stencil::set_color ( Color  color)

set color for solid brush stencil

Parameters
colorthe color to set

◆ set_color() [2/3]

void Stencil::set_color ( DOMString  color)

set color for solid brush stencil

Parameters
coloran HTML/SVG color name or an HTML color value formatted as $RRGGBB, #RRGGBB or 0xRRGGBB

◆ set_color() [3/3]

void Stencil::set_color ( unsigned long  r,
unsigned long  g,
unsigned long  b,
unsigned long  a 
)

set color for solid brush stencil - see gf_evg_stencil_set_brush_color.

Note
Omitting the last values will assume 0xFF for alpha, and 0x00 for other values
Parameters
rred value, between 0 and 255
ggreen value, between 0 and 255
bblue value, between 0 and 255
aalpha value, between 0 and 255

◆ set_colorf() [1/2]

void Stencil::set_colorf ( Colorf  color)

set color for solid brush stencil

Parameters
colorthe color to set

◆ set_colorf() [2/2]

void Stencil::set_colorf ( double  r,
double  g,
double  b,
double  a 
)

set color for solid brush stencil

Note
Omitting the last values will assume 0xFF for alpha, and 0x00 for other values
Parameters
rred value, between 0.0 and 1.0
ggreen value, between 0.0 and 1.0
bblue value, between 0.0 and 1.0
aalpha value, between 0.0 and 1.0

◆ get_color()

DOMString Stencil::get_color ( )

get color for solid brush stencil

Returns
color string

◆ set_alpha()

void Stencil::set_alpha ( unsigned long  alpha)

sets alpha value for stencil. The alpha is multiplied with the alpha component of the solid brush or gradient color

Parameters
alphathe alpha to set, between 0 and 255

◆ set_alphaf()

void Stencil::set_alphaf ( double  alpha)

sets alpha value for stencil. The alpha is multiplied with the alpha component of the solid brush or gradient color

Parameters
alphathe alpha to set, between 0.0 and 1.0

◆ get_alphaf()

double Stencil::get_alphaf ( )

gets alpha value for stencil

Returns
alpha value, between 0.0 and 1.0

◆ set_points() [1/2]

void Stencil::set_points ( Point2D  start,
optional Point2D  end = {0, 0} 
)

sets linear gradient start and end point. If end point is omitted, sets gradient line betwee {0,0} and start. Coordinates are given in surface coordinates, not object coordinates. See gf_evg_stencil_set_linear_gradient

Note
Point2D can be replaced with 2 number x, y, i.e. these syntaxes are all equivalent:
gra.set_points(0, 0, {x:1.0:, y:1.0});
gra.set_points({x:0, y:0}, {x:1.0:, y:1.0});
gra.set_points({x:0, y:0}, 1.0, 1.0);
gra.set_points(0, 0, 1.0, 1.0);
Parameters
startgradient line start point
endgradient line end point

◆ set_points() [2/2]

void Stencil::set_points ( Point2D  center,
Point2D  focal,
Point2D  radius 
)

sets radial graident center, focal and radius points - see gf_evg_stencil_set_radial_gradient

Note
Point2D can be replaced with 2 number x, y, i.e. these syntaxes are all equivalent:
gra.set_points(0, 0, {x:1.0:, y:1.0}, 0, 0);
gra.set_points({x:0, y:0}, 1.0, 1.0, {x:0, y:0});
...
Parameters
centercoordinates of center
focalcoordinates of focal
radiussize of horizintal and vertical radius

◆ set_stop() [1/3]

void Stencil::set_stop ( double  pos,
DOMString  color 
)

defines a new stop color for the gradient. Stops must be declared in order on the gradient. See gf_evg_stencil_push_gradient_interpolation

Parameters
posposition between 0.0 and 1.0
coloran HTML/SVG color name or an HTML color value formatted as $RRGGBB, #RRGGBB or 0xRRGGBB

◆ set_stop() [2/3]

void Stencil::set_stop ( double  pos,
Color  color 
)

defines a new stop color for the gradient. Stops must be declared in order on the gradient. See gf_evg_stencil_push_gradient_interpolation

Parameters
posposition between 0.0 and 1.0
colora color object

◆ set_stop() [3/3]

void Stencil::set_stop ( double  pos,
unsigned long  r,
unsigned long  g,
unsigned long  b,
unsigned long  a 
)

defines a new stop color for the gradient. Stops must be declared in order on the gradient. See gf_evg_stencil_push_gradient_interpolation

Parameters
posposition between 0.0 and 1.0
rred value, between 0 and 255
ggreen value, between 0 and 255
bblue value, between 0 and 255
aalpha value, between 0 and 255

◆ set_stopf() [1/2]

void Stencil::set_stopf ( double  pos,
Colorf  color 
)

defines a new stop color for the gradient. Stops must be declared in order on the gradient. See gf_evg_stencil_push_gradient_interpolation

Parameters
posposition between 0.0 and 1.0
colora color object

◆ set_stopf() [2/2]

void Stencil::set_stopf ( double  pos,
double  r,
double  g,
double  b,
double  a 
)

defines a new stop color for the gradient. Stops must be declared in order on the gradient. See gf_evg_stencil_push_gradient_interpolation

Parameters
posposition between 0.0 and 1.0
rred value, between 0.0 and 1.0
ggreen value, between 0.0 and 1.0
bblue value, between 0.0 and 1.0
aalpha value, between 0.0 and 1.0

Field Documentation

◆ pad

writeonly unsigned long Stencil::pad

padding mode of gradient - see gf_evg_stencil_set_gradient_mode

◆ cmx

writeonly unsigned long Stencil::cmx

color matrix for gradient stencils. Setting to null resets the matrix

◆ mx

attribute Matrix2D Stencil::mx

matrix for gradient stencils. Setting to null resets the matrix

Warning
this is a copy of the associated matrix, not a live object

◆ solid_brush

attribute readonly boolean Stencil::solid_brush

true if stencil is a solid color brush, false for gradient stencils

◆ auto_mx

attribute boolean Stencil::auto_mx

automatic matrix mode, see gf_evg_stencil_set_auto_matrix