[cairo] Transparency

Kalle Vahlman kalle.vahlman at gmail.com
Sat Jul 14 06:25:35 PDT 2007


2007/7/14, Jose Hevia <jose.francisco.hevia at gmail.com>:
> Hello,
> I just want to confirm if those are bugs:
> I want to clear a surface with cairo,so the screen displays a color
> background with transparency, so I do:
>
>   cairo_set_source_rgba (new->cr, 0,1,1,0.1);
>
>   cairo_set_source_surface (new->cr,new->surface, 0, 0);
>   cairo_set_operator (new->cr, CAIRO_OPERATOR_CLEAR);
>   cairo_paint(new->cr);
>
> where new->suface is a "cairo_surface_t" and new->cr "cairo_t". Then I
> paste little images with CAIRO_OPERATOR_OVER.
>
> BUG: I can't change clearing color. Is always(0,0,0,0). Is this a bug?

OPERATOR_CLEAR doesn't care about sources, it just clears everything to zero.

> I can clear the surface manually,without cairo, then dispay with
> CAIRO_OPERATOR_SOURCE,but:
>
> ANOTHER BUG:Transparency seems a function of the screen luminosity
> ((R+G+B)/3), instead of alpha--->(255,255.255,0) is always opaque
> white, no matter what is behind the window.
>
> Black (0,0,0,255) is opaque through.

I'm not sure what you mean here, but perhaps the FAQ entry about
clearing will help:

  http://cairographics.org/FAQ/#clear_a_surface

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


More information about the cairo mailing list