[Xr] Help: Render error on XrFormatRGB32

Soorya Kuloor skuloor at verano.com
Fri May 2 15:15:38 PDT 2003

On Fri, 2003-05-02 at 15:15, Carl Worth wrote:
> On May 2, Soorya Kuloor wrote:
>  > I am a newbie trying to turn off anti-aliasing in Xr by trying to use
>  > XrFormatRGB32 for the target suface (is this the right way to do
>  > it)?
> This won't quite do the trick for at least a couple of reasons:
> 	1) Geometric objects, (strokes and fills), are pre-composited
>            using an intermediate surface which is currently hard-coded
>            to use XrFormatA8.
> 	2) Eliminating alpha from the target surface affects more than
>            antialiasing. It also prevents you from blending the
>            surface with other surfaces, (eg. this is needed by the
>            intermediate surfaces used in xrknockout).
> So it looks like you'll need some other mechanism to get what you
> want. Probably just a mechanism to control the depth of the
> intermediate surface used for geometric objects.
> Suggestions for an API.

With all the fiddling stuff I am basically trying to get a trade off
between quality and rendering speed. The users of the package that we
are building on top of Xr fall into 2 categories:

1. Large number of 2D objects on the screen with lots of animations.
These people want a lot of speed, but do not mind sacrificing quality,
such as anti-aliasing and alpha.

2. Not a large number of 2D objects or not a lot of animations, but
would like quality.

What would be nice is to have are a set of functions to set some
parameters that would let the users select what they need, similar in
spirit to XrSetTolerance/XrGetTolerance.

Packages such as Java2D and GDI+ provide facilities to set these things
(java.awt.RenderingHints class, see

Functions such as the following would be helpful:

void XrSetAntialiasing(XrState *,
		XrAntialiasType x /* on, off, or different levels */);
void XrGetAntialiasingHint(XrState *);

void XrSetAlphaBlendingOrSomethingLikeThat(XrState *,
XrAlphaFormatOrSomething x);
and so on.

I think Java2D is a well defined API and nice. However, its speed just
sucks and there is no hope in hell that someone is going to write
accelarated drivers for it, due to Java licensing.

Another nice feature would be to provide options to use libic, even if
the X server contains Render extension. This approach may be helpful in
rendering to images to serve Web-browsers (I do not know whether this
will be faster though) and rendering without X server, or port to
Windows :-)).

>  > To test this I modified xrknockout.c under xrtest module to use
>  > XrFormatRGB32 for the surfaces instead of XrFormatARGB32. When I run the
>  > resulting program I get the following error.
> Xr was a little confused.
> I've fixed this now by replacing XrFormatRGB32 with XrFormatRGB24 and
> updating the depth where necessary. It seems much happier now.
> Feel free to update Xr now and give XrFormatRGB24 a try in
> xrknockout. You won't get what you want, but at least it shouldn't
> crash anymore.

Thanks, I tried it and it works as you said.

-- Soorya

> -Carl

More information about the cairo mailing list