[cairo] API Shakeup: cairo_current_path -> cairo_copy_path_data

Øyvind Kolås islewind at gmail.com
Tue Mar 15 06:42:42 PST 2005


On Mon, 14 Mar 2005 21:15:56 -0800, Bill Spitzak <spitzak at d2.com> wrote:
> typedef union {
>    struct {
>      enum {
>        ...
>      } type;
>      int length;
>    } header;
>    double value;
> } cairo_path_data_t;
>
> In this case a moveto would use 3 entries, the header followed by the x
> and y value.
>
> One reason is that sizeof(header)==sizeof(value) on most systems, so
> there is no wasted space.

At the expense of slightly more obfuscated usage, ease of use and less surprise
for developers is a good thing.

> The far more important reason is this will allow commands with an odd
> number of arguments, which may be common if 3D is going to be supported.

My understanding of cairo's aims is to provide an assembly language for
resolution independent drawing with a sufficiently high level of abstraction.

According to this understanding calculation of affine transformations,
points etc belong in higher level wrappings, along with stroking of
variable width lines, etc.

/Øyvind K.



More information about the cairo mailing list