[cairo] [RFC] Cairo GLES2 and GL_CLAMP_TO_BORDER
Bill Spitzak
spitzak at gmail.com
Fri Feb 18 11:00:05 PST 2011
I know I've said it before but I would greatly prefer that the
extend-none be done by modifying the mask in Cairo to be intersected
with the transform of the source border rectangle and then using repeat
(or clamp-to-edge) to sample the source image.
The result will be different in that the edge will be an antialiased at
the output resolution, without the "fuzziness" that you claim to want here.
However this is exactly what is wanted in many cases. For image viewers
this is wanted to make the images appear as snapshots on opaque
rectangles while allowing arbitrary scale and zoom (I'm pretty certain
this use is why most users of Cairo complain about the current
behavior). I have found it very useful for drawing pre-rendered font
glyphs at larger sizes, the sharp edges allows a surprisingly large
scale while still looking readable and sharp. And by far the most
important thing is that this avoids double-premultiply if in fact the
result is further clipped to the same shape, this produces frustrating
and counter-intuitive dark edges on shapes.
Also as you can see, the clamp-to-color sampling is not supported by
hardware and GLES. This is because it is totally useless for 3D texture
mapping as it would produce double-premultiply of the edges of objects.
It seems silly for Cairo/Pixman to insist on supporting a graphics
transformation that nobody wants and hardware support is being dropped for.
Anybody actually wanting the fuzzy edge can add a row of transparent
black around the edge themselves. Kind of like your proposed solution
but it is made the responsibility of the user of Cairo instead.
Alexandros Frantzis wrote:
> Hi all,
>
> one of the few things that is remaining in order to make the cairo GL
> backend GLES2 compatible, is the replacement of GL_CLAMP_TO_BORDER with
> a different method for GLES2 (GL_CLAMP_TO_BORDER is used with
> CAIRO_EXTEND_NONE).
More information about the cairo
mailing list