[cairo] Always keep text in foreground?
Arjen Nienhuis
a.g.nienhuis at gmail.com
Mon Aug 16 03:02:01 PDT 2010
If you code is like this:
for (x = something with A and B)
{
my_draw_polygon(x);
my_draw_label(x);
}
Change it to:
for (x = *something with A and B*)
{
my_draw_polygon(x);
}
for (x = *something with A and B*)
{
my_draw_label(x);
}
Groeten, Arjen
On Mon, Aug 16, 2010 at 3:06 AM, Daniel Goldman <dagoldman at yahoo.com> wrote:
> Hi,
>
> I make the path for polygon A, stroke it, fill with red, and apply "Long
> Label
> A" using pango. Next, I stroke polygon B, fill with blue, and apply "Label
> B".
> Everything is great, expect the polygon B fill overlaps and hides part of
> "Long
> Label A" text.
>
>
> -----------------------
> | Long Label A |
> | | Label B |
> -----------------------
> A B
>
> How do I always keep the text in the z-order foreground? I already know
> about
> decreasing font size and making the labels appear on multiple lines to
> prevent
> overlaps. I'm looking for something to use when overlap cannot be
> prevented. I
> tried using alpha channel, so the label can show through, but I lose too
> much
> intensity for both text and fill colors.
>
>
> In other words, is there a way to tell cairo / pango "I want this text to
> always
> be foreground", or "I want this fill to always be background".
>
> If not, is it possible (or advisable) to write the polygons to one context
> (I
> guess), write the text to another context (or whatever), and then overlay
> the
> text over the polygons? If this is feasible, could someone sketch out the
> key
> functions to use.
>
> Perhaps I will end up doing all the polygons first, and then doing all the
> labels. It's just inconvenient, since I get all the data for one polygon,
> its
> label and the label positioning, then get all the data for the next
> polygon,
> etc.
>
>
> I'm not saying the default behavior (fill overlays previous text) is wrong.
> I'm
> just hoping I can override it. I looked through the cairo and pango docs
> and
> past postings and couldn't find the answer.
>
>
> Thanks,
> Daniel
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100816/371c0929/attachment.html>
More information about the cairo
mailing list