Description

These wrappers are supposed to make bindings development easier.
This file defines the wrappers and the functions needed for
implementing a GBoxed type, most notably the GBoxedCopyFunc
requested by g_boxed_type_register_static() (the GBoxedFreeFunc
will usually be g_free()).

cpml_primitive_dup ()

Duplicates primitive. This function makes a shallow duplication of
primitives, that is the internal pointers of the resulting primitive
struct refer to the same memory as the original primitive. Check
out cpml_primitive_deep_dup() if it is required also the content
duplication.

cpml_primitive_deep_dup ()

Duplicates primitive. This function makes a deep duplication of
primitive, that is it duplicates also the definition data (both
org and data).

Furthermore, the new segment field will
point to a fake duplicated segment with only its first primitive
set (the first primitive of a segment should be a CPML_MOVE).
This is needed in order to let a CPML_CLOSE work as expected.

All the data is allocated in the same chunk of memory so freeing
the returned pointer releases all the occupied memory.

cpml_segment_dup ()

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
cpml_segment_deep_dup() if it is required also the content
duplication.

cpml_segment_deep_dup ()

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.

cpml_segment_deep_copy ()

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: