![]() |
![]() |
![]() |
adg-1 reference manual |
![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
struct AdgPath; struct AdgPathClass;void adg_path_append (AdgPath *path
,,
CpmlPrimitiveType type...
);void adg_path_append_array (AdgPath *path
,,
CpmlPrimitiveType typeconst AdgPair **pairs
);void adg_path_append_cpml_path (AdgPath *path
,const
);CpmlPath *cpml_pathvoid adg_path_append_primitive (AdgPath *path
,const AdgPrimitive *primitive
);void adg_path_append_segment (AdgPath *path
,const AdgSegment *segment
);void adg_path_append_valist (AdgPath *path
,,
CpmlPrimitiveType type);
va_list var_argsvoid adg_path_arc (AdgPath *path
,const AdgPair *center
,,
gdouble r,
gdouble start);
gdouble endvoid adg_path_arc_explicit (AdgPath *path
,,
gdouble xc,
gdouble yc,
gdouble r,
gdouble start);
gdouble endvoid adg_path_arc_to (AdgPath *path
,const AdgPair *throught
,const AdgPair *pair
);void adg_path_arc_to_explicit (AdgPath *path
,,
gdouble x1,
gdouble y1,
gdouble x2);
gdouble y2void adg_path_chamfer (AdgPath *path
,,
gdouble delta1);
gdouble delta2void adg_path_close (AdgPath *path
);void adg_path_curve_to (AdgPath *path
,const AdgPair *control1
,const AdgPair *control2
,const AdgPair *pair
);void adg_path_curve_to_explicit (AdgPath *path
,,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3);
gdouble y3void adg_path_fillet (AdgPath *path
,); const AdgPair * adg_path_get_current_point (
gdouble radiusAdgPath *path
);gboolean adg_path_has_current_point (AdgPath *path
); const AdgPrimitive * adg_path_last_primitive (AdgPath *path
);void adg_path_line_to (AdgPath *path
,const AdgPair *pair
);void adg_path_line_to_explicit (AdgPath *path
,,
gdouble x);
gdouble yvoid adg_path_move_to (AdgPath *path
,const AdgPair *pair
);void adg_path_move_to_explicit (AdgPath *path
,,
gdouble x); AdgPath * adg_path_new (
gdouble yvoid
); const AdgPrimitive * adg_path_over_primitive (AdgPath *path
);void adg_path_reflect (AdgPath *path
,const
);CpmlVector *vectorvoid adg_path_reflect_explicit (AdgPath *path
,,
gdouble x);
gdouble y
The AdgPath model represents a virtual
AdgPath overrides the get_cpml_path()
adg_trail_get_cpml_path()
Although some of the provided methods are clearly based on the original cairo path manipulation API, their behavior could be sligthly different. This is intentional, because the ADG provides additional path manipulation algorithms, sometime quite complex, and a more restrictive filter on the path quality is required. Also, the ADG is designed to be used by technicians while cairo targets a broader range of developers.
As an example, following the rule of the less surprise, some
cairo functions guess the current point when it is not defined,
while the AdgPath methods trigger a warning without other effect.
Furthermore, after cairo_path_close_path()
adg_path_close()
the current point is unset.
struct AdgPath;
All fields are private and should not be used directly. Use its public methods instead.
Since 1.0
void adg_path_append (AdgPath *path
,,
CpmlPrimitiveType type...
);
Generic method to append a primitive to path
. The number of AdgPair
pointers to pass as Varargs
depends on type
:
All the needed pairs must be not NULL
|
an AdgPath |
|
a |
|
point data, specified as AdgPair pointers |
Since 1.0
void adg_path_append_array (AdgPath *path
,,
CpmlPrimitiveType typeconst AdgPair **pairs
);
A bindingable version of adg_path_append()
that uses a NULL
Furthermore, because of the list is NULL
pairs
. This allows to embed in a
primitive element more data pairs than requested, something impossible
to do with adg_path_append()
and adg_path_append_valist()
.
|
an AdgPath |
|
a |
|
point data, specified as a NULL |
Since 1.0
void adg_path_append_cpml_path (AdgPath *path
,const
);CpmlPath *cpml_path
Appends a whole path
.
|
an AdgPath |
|
the |
Since 1.0
void adg_path_append_primitive (AdgPath *path
,const AdgPrimitive *primitive
);
Appends primitive
to path
. The primitive to add is considered the
continuation of the current path so the org
component of primitive
is not used. Anyway the current point is
checked against it: they must be equal or the function will fail
without further processing.
|
an AdgPath |
|
the AdgPrimitive to append |
Since 1.0
void adg_path_append_segment (AdgPath *path
,const AdgSegment *segment
);
Appends segment
to path
.
|
an AdgPath |
|
the AdgSegment to append |
Since 1.0
void adg_path_append_valist (AdgPath *path
,,
CpmlPrimitiveType type);
va_list var_args
va_list version of adg_path_append()
.
|
an AdgPath |
|
a |
|
point data, specified as AdgPair pointers |
Since 1.0
void adg_path_arc (AdgPath *path
,const AdgPair *center
,,
gdouble r,
gdouble start);
gdouble end
A more usual way to add an arc to path
. After this call, the current
point will be the computed end point of the arc. The arc will be
rendered in increasing angle, accordling to start
and end
. This means
if start
is less than end
, the arc will be rendered in clockwise
direction (accordling to the default cairo coordinate system) while if
start
is greather than end
, the arc will be rendered in couterclockwise
direction.
By explicitely setting the whole arc data, the start point could be
different from the current point. In this case, if path
has no
current point before the call a path
has a
current point, a
|
an AdgPath |
|
coordinates of the center of the arc |
|
the radius of the arc |
|
the start angle, in radians |
|
the end angle, in radians |
Since 1.0
void adg_path_arc_explicit (AdgPath *path
,,
gdouble xc,
gdouble yc,
gdouble r,
gdouble start);
gdouble end
Convenient function to call adg_path_arc()
using explicit
coordinates instead of AdgPair.
|
an AdgPath |
|
x position of the center of the arc |
|
y position of the center of the arc |
|
the radius of the arc |
|
the start angle, in radians |
|
the end angle, in radians |
Since 1.0
void adg_path_arc_to (AdgPath *path
,const AdgPair *throught
,const AdgPair *pair
);
Adds an arc to the path from the current point to pair
, passing
throught throught
. After this call the current point will be pair
.
If path
has no current point before this call, this function will
trigger a warning without other effect.
|
an AdgPath |
|
an arbitrary point on the arc |
|
the destination coordinates |
Since 1.0
void adg_path_arc_to_explicit (AdgPath *path
,,
gdouble x1,
gdouble y1,
gdouble x2);
gdouble y2
Convenient function to call adg_path_arc_to()
using explicit
coordinates instead of AdgPair.
|
an AdgPath |
|
the x coordinate of an intermediate point |
|
the y coordinate of an intermediate point |
|
the x coordinate of the end of the arc |
|
the y coordinate of the end of the arc |
Since 1.0
void adg_path_chamfer (AdgPath *path
,,
gdouble delta1);
gdouble delta2
A binary action that generates a chamfer between two primitives.
The first primitive involved is the current primitive, the second will
be the next primitive appended to path
after this call. The second
primitive is required: if the chamfer operation is not properly
terminated (by not providing the second primitive), any API accessing
the path in reading mode will raise a warning.
An exception is a chamfer after a
The chamfer operation requires two lengths: delta1
specifies the
"quantity" to trim on the first primitive while delta2
is the same
applied on the second primitive. The term "quantity" means the length
of the portion to cut out from the original primitive (that is the
primitive as would be without the chamfer).
|
an AdgPath |
|
the distance from the intersection point of the current primitive |
|
the distance from the intersection point of the next primitive |
Since 1.0
void adg_path_close (AdgPath *path
);
Adds a line segment to the path from the current point to the
beginning of the current segment, (the most recent point passed
to an adg_path_move_to()
), and closes this segment.
After this call the current point will be unset.
The behavior of adg_path_close()
is distinct from simply calling
adg_line_to()
If path
has no current point before this call, this function will
trigger a warning without other effect.
|
an AdgPath |
Since 1.0
void adg_path_curve_to (AdgPath *path
,const AdgPair *control1
,const AdgPair *control2
,const AdgPair *pair
);
Adds a cubic Bézier curve to the path from the current point to
position pair
, using control1
and control2
as control points.
After this call the current point will be pair
.
If path
has no current point before this call, this function will
trigger a warning without other effect.
|
an AdgPath |
|
the first control point of the curve |
|
the second control point of the curve |
|
the destination coordinates |
Since 1.0
void adg_path_curve_to_explicit (AdgPath *path
,,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble x3);
gdouble y3
Convenient function to call adg_path_curve_to()
using explicit
coordinates instead of AdgPair.
|
an AdgPath |
|
the x coordinate of the first control point |
|
the y coordinate of the first control point |
|
the x coordinate of the second control point |
|
the y coordinate of the second control point |
|
the x coordinate of the end of the curve |
|
the y coordinate of the end of the curve |
Since 1.0
void adg_path_fillet (AdgPath *path
,);
gdouble radius
A binary action that joins to primitives with an arc.
The first primitive involved is the current primitive, the second will
be the next primitive appended to path
after this call. The second
primitive is required: if the fillet operation is not properly
terminated (by not providing the second primitive), any API accessing
the path in reading mode will raise a warning.
An exception is a fillet after a
|
an AdgPath |
|
the radius of the fillet |
Since 1.0
const AdgPair * adg_path_get_current_point (AdgPath *path
);
Gets the current point of path
, which is conceptually the
final point reached by the path so far.
If there is no defined current point, NULL
adg_path_has_current_point()
.
Most AdgPath methods alter the current point and most of them expect a current point to be defined otherwise will fail triggering a warning. Check the description of every method for specific details.
|
an AdgPath |
Returns : |
the current point or NULL |
Since 1.0
gboolean adg_path_has_current_point (AdgPath *path
);
Returns whether a current point is defined on path
.
See adg_path_get_current_point()
for details on the current point.
|
an AdgPath |
Returns : |
whether a current point is defined |
Since 1.0
const AdgPrimitive * adg_path_last_primitive (AdgPath *path
);
Gets the last primitive appended to path
. The returned struct
is owned by path
and should not be freed or modified.
|
an AdgPath |
Returns : |
a pointer to the last appended primitive or NULL |
Since 1.0
void adg_path_line_to (AdgPath *path
,const AdgPair *pair
);
Adds a line to path
from the current point to pair
. After this
call the current point will be pair
.
If path
has no current point before this call, this function will
trigger a warning without other effect.
|
an AdgPath |
|
the destination coordinates |
Since 1.0
void adg_path_line_to_explicit (AdgPath *path
,,
gdouble x);
gdouble y
Convenient function to call adg_path_line_to()
using explicit
coordinates instead of AdgPair.
|
an AdgPath |
|
the new x coordinate |
|
the new y coordinate |
Since 1.0
void adg_path_move_to (AdgPath *path
,const AdgPair *pair
);
Begins a new segment. After this call the current point will be pair
.
|
an AdgPath |
|
the destination coordinates |
Since 1.0
void adg_path_move_to_explicit (AdgPath *path
,,
gdouble x);
gdouble y
Convenient function to call adg_path_move_to()
using explicit
coordinates instead of AdgPair.
|
an AdgPath |
|
the new x coordinate |
|
the new y coordinate |
Since 1.0
AdgPath * adg_path_new (void
);
Creates a new path model. The path should be constructed programmatically by using the methods provided by AdgPath.
Returns : |
the newly created path model |
Since 1.0
const AdgPrimitive * adg_path_over_primitive (AdgPath *path
);
Gets the primitive before the last one appended to path
. The
"over" term comes from forth, where the OVER
adg_path_over_primitive()
works
on path
. The returned struct is owned by path
and should not
be freed or modified.
|
an AdgPath |
Returns : |
a pointer to the primitive before the last appended one
or NULL |
Since 1.0
void adg_path_reflect (AdgPath *path
,const
);CpmlVector *vector
Reflects the first segment or path
around the axis passing
throught (0, 0) and with a vector
slope. The internal segment
is duplicated and the proper transformation (computed from
vector
) to mirror the segment is applied on all its points.
The result is then reversed with cpml_segment_reverse()
adg_path_append_segment()
.
For convenience, if vector
is NULL
|
an AdgPath |
|
the slope of the axis |
Since 1.0
void adg_path_reflect_explicit (AdgPath *path
,,
gdouble x);
gdouble y
Convenient function to call adg_path_reflect()
using explicit
vector components instead of
|
an AdgPath |
|
the vector x component |
|
the vector y component |
Since 1.0