[cairo] clarification on some misc pattern documents?

Uli Schlachter psychon at znc.in
Sun May 11 12:08:11 PDT 2014


On 11.05.2014 07:07, jimmy frasche wrote:
> - cairo_pattern_get_color_stop_rgba:
> "Gets the color and offset information at the given index for a
> gradient pattern. Values of index are 0 to 1 less than the number
> returned by cairo_pattern_get_color_stop_count()."
> Is this just saying that the colors stops range from 0 to n-1 where n
> is the result of cairo_pattenr_get_color_stop_count?


> - cairo_pattern_create_mesh
> After the Gouraud-shaded triangle example, when talking about
> overlapping patches, the docs begin talking about u and v coordinates
> without defining them.
> Skimming the referenced ISO spec for PDFs it appears they refer to the
> axes of the square being deformed, but I wanted to make sure. If so
> perhaps that could be made clearer.

I looked for the word "overlap". Do you mean the following text?

 * When two patches overlap, the last one that has been added is drawn
 * over the first one.
 * When a patch folds over itself, points are sorted depending on
 * their parameter coordinates inside the patch. The v coordinate
 * ranges from 0 to 1 when moving from side 3 to side 1; the u
 * coordinate ranges from 0 to 1 when going from side 0 to side
 * 2. Points with higher v coordinate hide points with lower v
 * coordinate. When two points have the same v coordinate, the one
 * with higher u coordinate is above. This means that points nearer to
 * side 1 are above points nearer to side 3; when this is not
 * sufficient to decide which point is above (for example when both
 * points belong to side 1 or side 3) points nearer to side 2 are
 * above points nearer to side 0.

I think this tries to define the coordinates when it talks to "range from 0 to 1
when moving from side 3 to side 1".

I feel like I do understand this description. However, feel free to submit
enhancements which you think are necessary.

"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.

More information about the cairo mailing list