Donnerstag, 22. Mai 2008

Hard times...

AlphaComposite with "extra alpha" gives me a hard time, if possible I would like to solve it without an temporary surface. In the worst case such a surface could be cached, but one composition step is always better than two ;)

The problem as far as I can see is, that XRender allows to specify an alternate alpha-mask which can be used for composition, instead of the alpha-mask embedded in ARGB surfaces.
However AlphaComposite would require not to replace, but to multiply the alpha values of both as far as I've understood.

So with what I've seen the following stuff could be done without a second composition step:
- (Alpha)-Colors, the "extra alpha" value can be simply calculated in the color-value
- Opaque Images, they don't have an alpha mask, so nothing to replace, a 1x1 mask could be used.

things that would need a second composition step:
- Bitmask and Translucent images. I currently treat bitmask-images like translucent ones (ARGB surfaces).
Their importance seems to decline, and ARGB images are guaranteed to be accalerated in almost any case.

I am currently also working on some hackish implementation of XRRenderer, which is responsible for rendering the known primitives like rects, ovals ....

Furthermore I've done some benchmarking for scaling and transformation.
With XRender those operations are a lot faster, but only if executed on a Pixmap, on Screen they suffer from terrible performance.
To-Screen-Rendering seems not really well implemented on todays hw, DirectX9 does not even allow it.
Swing and many games use BufferStrategy, so it shouldn't be a problem.

Keine Kommentare: