[cairo] Alpha channel for text under win32
otaylor at redhat.com
Tue Apr 12 22:20:57 PDT 2005
On Wed, 2005-04-13 at 13:10 +1000, Jason Thomas wrote:
> I have been looking at the alpha channel in the win32 surface, with the
> requirement to do some alpha blending outside of cairo.
> I set the target via:
> cairo_set_target_win32(pCairo, DC);
> I have noticed an issue here, the primatives I am using lines/fills etc. do
> generate an alpha value in the 4th byte of the DC's bitmap, but text
> rendering does not.
> My current fix is to set:
> surface->format = CAIRO_FORMAT_ARGB32;
> cairo_win32_surface_create (HDC hdc)
> but this seems to drop the quality of the text a little on initial review.
Could be ... Windows does not how to render to a ARGB bitmap, whether
text or anything else, so rendering text to ARGB is a bit of a hack.
(Look at the code for details.) Only text rendered onto a solid
background will get the correct gamma correction.
> Is this the best solution?
> Is it possible to pass a flag into cairo_set_target_win32 to select between
> CAIRO_FORMAT_ARGB32 and CAIRO_FORMAT_RGB24 for the surface formats?
I'm rather reluctant to do that... because windows doesn't have the idea
of ARGB device contexts. All the ARGB32 variant would be is an
image surface wrapped in a DC, and the only use of the DC would be when
What sort of alpha blending do you need to do? Can you just use an image
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050413/a9ff8b5e/attachment.pgp
More information about the cairo