[Pixman] font rendering
Søren Sandmann
sandmann at cs.au.dk
Thu Mar 7 08:52:26 PST 2013
Gerd Hoffmann <kraxel at redhat.com> writes:
> Is there documentation somewhere describing what the pixman ops exactly do?
Unfortunately, pixman doesn't have as much documentation as it should.
> Background: I'm trying to figure the best way to do font rendering with
> pixman. Use case is the qemu vga text mode emulation. I have 4 pixman
> images involved:
>
> (1) The (virtual) vga framebuffer, in PIXMAN_x8r8g8b8
> (2) The vgafont glyph, in PIXMAN_a8r8g8b8,
> with 0xffffffff / 0x00000000 for font/background pixels.
> (3) The foreground (font) color, created using
> pixman_image_create_solid_fill()
> (4) The background color, likewise created using
> pixman_image_create_solid_fill()
>
> What I'm trying now is this:
>
> pixman_image_composite(PIXMAN_OP_SRC, bg, NULL, vgafb, ...);
> pixman_image_composite(PIXMAN_OP_OVER, fg, glyph, vgafb, ...);
>
> So the first op fills with the background color, and the second renders
> the character. Comes close to what I want. Except that the second
> blends the foreground color with the background color instead of
> replacing it.
If I understand correctly, what you are doing now should work. Blending
of the foreground and background colors should only happen if the
foreground color has alpha != 0xff, or if a glyph pixel has alpha that
is neither 0x00 nor 0xff. In either case, blending is presumably what
you want?
Søren
More information about the Pixman
mailing list