libgpac
Documentation of the core library of GPAC
Path Interface Reference

import"evg.idl";

+ Collaboration diagram for Path:

Public Member Functions

 Path ()
 
boolean point_over (Point2D pt)
 
boolean point_over (double x, double y)
 
Path get_flatten ()
 
Path flatten ()
 
Path add_path (Path subpath, optional Matrix2D mx=null)
 
Path arc (double radius, double start, double end, optional unsigned long close=0)
 
Path arc_svg (double end_x, double end_y, double r_x, double r_y)
 
Path arc_svg (double end_x, double end_y, double r_x, double r_y, optional double x_axis_rotation=0, optional boolean large_arc_flag=false, optional boolean sweep_flag=false)
 
Path arc_bifs (double end_x, double end_y, double fa_x, double fa_y, double fb_x, double fb_y, optional boolean cw=false)
 
Path n_bezier (Point2D pt1, Point2D pt2, Point2D pt3,...)
 
Path ellipse (double cx, double cy, double a_axis, double b_axis)
 
Path ellipse (Point2D center, double a_axis, double b_axis)
 
Path rectangle (double ox, double oy, double width, double height, optional boolean centered=false)
 
Path rectangle (Point2D o, double width, double height, optional boolean centered=false)
 
Path quadratic_to (double c_x, double c_y, double x, double y)
 
*Path cubic_to (double c1_x, double c1_y, double c2_x, double c2_y, double x, double y)
 
Path line_to (double x, double y)
 
Path move_to (double x, double y)
 
Path close ()
 
Path reset ()
 
Path clone ()
 
*Path outline (PenSettings ps)
 
Path transform (Matrix2D mx)
 

Data Fields

readonly attribute boolean empty
 
readonly attribute boolean zero_fill
 
readonly attribute boolean even_fill
 
readonly attribute Rect bounds
 
readonly attribute Rect ctrl_bounds
 
readonly attribute boolean is_rectangle
 

Detailed Description

Path object to describe vector graphics. Most path functions return the path object itself, so that the operations can be chained:

path.move_to(0,0).line_to(0,100).line_to(10, 10).close();

Constructor & Destructor Documentation

◆ Path()

Path::Path ( )

Constructor

Member Function Documentation

◆ point_over() [1/2]

boolean Path::point_over ( Point2D  pt)

checks if point is over a path - see gf_path_point_over

Parameters
ptpoint to test
Returns
true if over

◆ point_over() [2/2]

boolean Path::point_over ( double  x,
double  y 
)

checks if point is over a path - see gf_path_point_over

Parameters
xx-coord of point to test
yy-coord of point to test
Returns
true if over

◆ get_flatten()

Path Path::get_flatten ( )

gets a flatten version of the path - see gf_path_get_flatten

Returns
the created flatten path

◆ flatten()

Path Path::flatten ( )

flattens the path - see gf_path_flatten

Returns
the path

◆ add_path()

Path Path::add_path ( Path  subpath,
optional Matrix2D  mx = null 
)

adds a path to the path - see gf_path_add_subpath

Parameters
subpathpath to add
mxmatrix to apply to path
Returns
the path

◆ arc()

Path Path::arc ( double  radius,
double  start,
double  end,
optional unsigned long  close = 0 
)

adds an arc to the path - see gf_path_add_arc

Parameters
radiusradius of the arc
startstart angle of the arc in radians
endend angle of the arc in radians
closeclosing type: 0 for open arc, 1 for close arc, 2 for pie
Returns
the path

◆ arc_svg() [1/2]

Path Path::arc_svg ( double  end_x,
double  end_y,
double  r_x,
double  r_y 
)

adds an SVG arc to the path - see gf_path_add_svg_arc_to

Parameters
end_xx-coordinate of the arc end point
end_yy-coordinate of the arc end point
r_xx-axis radius
r_yy-axis radius
Returns
the path

◆ arc_svg() [2/2]

Path Path::arc_svg ( double  end_x,
double  end_y,
double  r_x,
double  r_y,
optional double  x_axis_rotation = 0,
optional boolean  large_arc_flag = false,
optional boolean  sweep_flag = false 
)

adds an SVG arc to the path - see gf_path_add_svg_arc_to

Parameters
end_xx-coordinate of the arc end point
end_yy-coordinate of the arc end point
r_xx-axis radius
r_yy-axis radius
x_axis_rotationangle for the x-axis
large_arc_flaglarge or short arc selection
sweep_flagif 1, the arc will be clockwise, otherwise counter-clockwise.
Returns
the path

◆ arc_bifs()

Path Path::arc_bifs ( double  end_x,
double  end_y,
double  fa_x,
double  fa_y,
double  fb_x,
double  fb_y,
optional boolean  cw = false 
)

adds an arc to the path - see gf_path_add_arc_to

Parameters
end_xx-coordinate of the arc end point
end_yy-coordinate of the arc end point
fa_xx-coordinate of the arc first focal point
fa_yy-coordinate of the arc first focal point
fb_xx-coordinate of the arc second focal point
fb_yy-coordinate of the arc second focal point
cwif 1, the arc will be clockwise, otherwise counter-clockwise.
Returns
the path

◆ n_bezier()

Path Path::n_bezier ( Point2D  pt1,
Point2D  pt2,
Point2D  pt3,
  ... 
)

adds N-1 bezier curve - see gf_path_add_bezier. The function can take any number of points

Parameters
pt1first control point of the bezier curve
pt2second control point of the bezier curve
pt3last point of the curve if last point defined, otherwise next control point
Returns
the path

◆ ellipse() [1/2]

Path Path::ellipse ( double  cx,
double  cy,
double  a_axis,
double  b_axis 
)

adds an ellipse - see gf_path_add_ellipse

Parameters
cxx-coordinate of the ellipse center
cyy-coordinate of the ellipse center
a_axislength of the horizontal ellipse axis
b_axislength of the vertical ellipse axis
Returns
the path

◆ ellipse() [2/2]

Path Path::ellipse ( Point2D  center,
double  a_axis,
double  b_axis 
)

adds an ellipse - see gf_path_add_ellipse

Parameters
centerellipse center
a_axislength of the horizontal ellipse axis
b_axislength of the vertical ellipse axis
Returns
the path

◆ rectangle() [1/2]

Path Path::rectangle ( double  ox,
double  oy,
double  width,
double  height,
optional boolean  centered = false 
)

adds a rectangle - see gf_path_add_rect and gf_path_add_rect_center

Parameters
oxx-coordinate of the rectangle center or top-left
oyy-coordinate of the rectangle center or top-left
widthwidth of the rectangle
heightheight of the rectangle
centeredindicates if the given coordinates are the top-left one (false) or the center ones (true)
Returns
the path

◆ rectangle() [2/2]

Path Path::rectangle ( Point2D  o,
double  width,
double  height,
optional boolean  centered = false 
)

adds a rectangle - see gf_path_add_rect and gf_path_add_rect_center

Parameters
orectangle center or top-left
widthwidth of the rectangle
heightheight of the rectangle
centeredindicates if the given coordinates are the top-left one (false) or the center ones (true)
Returns
the path

◆ quadratic_to()

Path Path::quadratic_to ( double  c_x,
double  c_y,
double  x,
double  y 
)

adds a quadratic see gf_path_add_quadratic_to

Parameters
c_xx-coordinate of the control point of the quadratic curve
c_yy-coordinate of the control point of the quadratic curve
xx-coordinate of the end point of the cubic quadratic
yy-coordinate of the end point of the cubic quadratic
Returns
the path

◆ cubic_to()

* Path Path::cubic_to ( double  c1_x,
double  c1_y,
double  c2_x,
double  c2_y,
double  x,
double  y 
)

adds a cubic bezier curve to the current contour, starting from the current path point - see gf_path_add_cubic_to

Parameters
c1_xx-coordinate of the first control point of the cubic curve
c1_yy-coordinate of the first control point of the cubic curve
c2_xx-coordinate of the second control point of the cubic curve
c2_yy-coordinate of the second control point of the cubic curve
xx-coordinate of the end point of the cubic curve
yy-coordinate of the end point of the cubic curve
Returns
the path

◆ line_to()

Path Path::line_to ( double  x,
double  y 
)

adds a line - see gf_path_add_line_to

Parameters
xx-coordinate of the point
yy-coordinate of the point
Returns
the path

◆ move_to()

Path Path::move_to ( double  x,
double  y 
)

adds a move to - see gf_path_add_move_to

Parameters
xx-coordinate of the point
yy-coordinate of the point
Returns
the path

◆ close()

Path Path::close ( )

close the path - see gf_path_close

Returns
the path

◆ reset()

Path Path::reset ( )

reset the path - see gf_path_reset

Returns
the path

◆ clone()

Path Path::clone ( )

clone the path - see gf_path_clone

Returns
the cloned path

◆ outline()

* Path Path::outline ( PenSettings  ps)

generates a path outline - see gf_path_get_outline

Parameters
psthe pen settings used to produce the outline
Returns
the outline path

◆ transform()

Path Path::transform ( Matrix2D  mx)

transforms a path - see gf_path_add_subpath

Parameters
mxmatrix to apply to path
Returns
the new transformed path

Field Documentation

◆ empty

readonly attribute boolean Path::empty

empty path flag - see gf_path_is_empty

◆ zero_fill

readonly attribute boolean Path::zero_fill

if true, path will use zero_non_zero fill rule otherwise odd/even rule

◆ even_fill

readonly attribute boolean Path::even_fill

if true, path will use odd/even rule but fill only even parts

◆ bounds

readonly attribute Rect Path::bounds

bounds of path - see gf_path_get_bounds

◆ ctrl_bounds

readonly attribute Rect Path::ctrl_bounds

control bounds of path - see gf_path_get_control_bounds

◆ is_rectangle

readonly attribute boolean Path::is_rectangle

set to true if path is a rectangle/square