RGBA support in pangocairo



I noticed that when the foreground and background tags of the Pango markup language are used in a layout created by pango_cairo, the marked up text is automatically in an opaque color.  For example the string

"The <span foreground='#ff0000'>quick</span> brown fox"

causes the word "quick" to always be in an opaque red even if the surrounding text has an alpha coefficient less than 1. 

Looking at the source code, it seems this is caused by a lack of support for rgba.  In the file pangocairo_render.c, using the cairo_set_source_rgb function to implement the set_color function seems to be the culprit.  Perhaps this function could use cairo_set_source_rgba instead.  I would like to submit a patch to address this.

The question then is, where should the alpha coefficient come from?    Could a new function "pango_cairo_context_set_default_alpha" be added and the alpha value is picked up from the context with default being 1?  Or should there be full support for rgba by adding the alpha value to the PangoColor structure, with the corresponding change to the mark up language?

Regards, 

Kari Lentz


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]