AdgSegment — A wrapper for CpmlSegment
typedef AdgSegment; AdgSegment * adg_segment_dup (const AdgSegment *segment); AdgSegment * adg_segment_deep_dup (const AdgSegment *segment); AdgSegment * adg_segment_deep_copy (AdgSegment *segment, const AdgSegment *src);
AdgSegment is a wrapper in GType syntax of the CpmlSegment struct. Furthermore, some dynamic memory functions are provided, such as shallow and deep duplication functions.
typedef CpmlSegment AdgSegment;
Another name for CpmlSegment: check its documentation for the fields description and visibility details.
AdgSegment * adg_segment_dup (const AdgSegment *segment);
Duplicates segment. This function makes a shallow duplication,
that is the internal pointers of the resulting segment struct
refer to the same memory as the original segment. Check out
adg_segment_deep_dup() if it is required also the content
duplication.
|
|
an AdgSegment structure |
|
Returns : |
a shallow duplicate of segment: must be freed
with g_free() when no longer needed.
|
AdgSegment * adg_segment_deep_dup (const AdgSegment *segment);
Duplicates segment. This function makes a deep duplication,
that is it duplicates also the underlying data that defines
the segment. The path field
is set to NULL as data is no
more referring to the original cairo path.
All the data is allocated in the same chunk of memory so freeing the returned pointer releases all the occupied memory.
|
|
an AdgSegment structure |
|
Returns : |
a deep duplicate of segment: must be freed
with g_free() when no longer needed.
|
AdgSegment * adg_segment_deep_copy (AdgSegment *segment, const AdgSegment *src);
Makes a deep copy of src to segment. For a shallow copy, check out
the cpml_segment_copy() API provided by the CPML library.
This could seem a somewhat unusual operation because segment should
be "compatible" with src: it is expected that they have the same
num_data value. Anyway, it is convenient
in some situation, such as when restoring the original data from a
deep duplicated source:
AdgSegment *backup; backup = adg_segment_deep_dup(&segment); // Now &segment can be modified ... adg_segment_deep_copy(&segment, backup); g_free(backup);
The struct fields of segment are left untouched and used only to
check if it is compatible with src.
|
|
an AdgSegment structure |
|
|
the source segment to copy |
|
Returns : |
segment
|
AdgSegmentwas last modified by gtk-doc on Sat 24 Jul 2010 09:35:28 AM CEST