[cairo] clipping question
Bill Spitzak
spitzak at d2.com
Tue Jun 27 12:08:55 PDT 2006
Fabien Costantini wrote:
> But using cairo_save/restore api would save the _whole_ context,
> and I only need to deal with the clipping context.
> Furthermore, restoring other undesired context attributes would have side effects on the drawings,
> so I'm afraid it's not usable in my situation.
Actually I think it is ok if pop-clip and pop-transform has undefined
results on the rest of the graphics state. Otherwise it will be quite
impossible to use a gsave/grestore api like Cairo for fltk.
The biggest problem we have is the lack of "hairline" mode in Cairo. We
absolutly need hairlines to draw widgets that don't look like crap.
Currently we are not using Cairo's transforms at all, doing it all
ourselves before sending the coordinates. In theory we cannot use
Cairo's path-construction calls either, as we don't know if they are
going to fill or stroke until after the path is constructed.
I'm mostly of the opinion that we should use Cairo as much as possible,
with as little as possible emulation code, but hairline really is
causing problems.
So again, I really think hairline mode, triggered by 0-width lines (to
match OpenGL and DirectX and X and every other graphics API I have ever
seen) is very useful and in high demand by programmers. I think the
result can be well-defined: horizontal and vertical lines are an integer
number of pixels thick and positioned such that they hide the
antialiasing of the same shape being filled, and below/right in cases
where there is no antialiasing. All other lines at any angle are
positioned to join the horizontal/vertical ones and are antialiased.
Emulating this in current Cairo is a pain, and the fact that we quickly
found it necessary is an indication that lots of other users are going
to find it necessary as well.
More information about the cairo
mailing list