[Pixman] Pixman library on wince arm

Jonathan Morton jonathan.morton at movial.com
Sat Sep 18 11:52:07 PDT 2010


> I'm writing a geometry app for windows mobile and I wanted to optimize some cpu intensive operations. My phone is HTC HD2 and it supports neon (I already use some neon code with it). I tried to search for some example code or for neon optimized if there is any and it seem that pixman may have that functionality.
>
> 1) I do argb alpha blending from 32bit src image to 32/24 or rbg565 surface. I downloaded pixman and after digging through test code I was able to get that part working: pixman_image_composite(PIXMAN_OP_OVER, alpha_img, NULL, dest_img, ...); I tried 32-bit destination argb and it works (I didn't try 24bit or rbg565 as destination images, but I assume they work the same way, as there are neon optimized paths for these operations in pixman-arm-neon.c)
>
> 2) I do simple overlays with arbitrary shapes. For example, I have 200x200 pix image (rbg565 or 24bit rgb) and I have a triangle defined by some arbitrary vertices. I do solid fill of that triangle or I also do 40% alpha blending of that triangle (60% from the src image and the rest 40% of some solid color).
> I tried to find how to do that kind of tasks with pixman, but I couldn't find how to do it. In real application I actually need to draw lines and solid-fill or do 40% blending of arbitrary shapes. It looks like some arbitrary shaped fills can be done with pixman_add_traps ( after I viewed test\trap-test.c ), but for that I need t generate alpha plane, and I didn't see how set arbitrary shaped trap and then do pixman_image_composite so that only some part of the image had composited pixels. To tell the trues, it's really not clear to me what trap means and what it does in pixman.

"Trap" is simply short for "trapezoid".  The idea is that you make an
A8-format image using the trapezoid rasteriser to define your shape,
and then supply the A8 image as a mask to your composite operation.

> 3) I had a big problem with zooming. I optimized that part a bit, but it seems that such part could be done better with pixman. In short, I want to stretch from 200x200 to 250x250 some arbitrary image 32/24bit or rgb565. As far as I understood from studying test code, that kind stuff is possible through some sort of transformations, and there is no straight forward scale function.

Yes, the transform is the correct mechanism.  There are functions to
help set up a transform using familiar "scale", "translate", "rotate"
etc. building blocks.

> Currently, I have code that does what I described (using winapi or even plain c code that does alpha blending). So, I'd like to find out how to do such relatively simple tasks with pixman. There seems to be no docs/tutorials on how to use pixman directly.

This is all considerably simplified by using Cairo as a front-end.
Pixman is not really designed to be used directly by applications,
though of course it can be if you really want to.

 - Jonathan Morton


More information about the Pixman mailing list