Re: [Vala] [clutter] Clutter gradient and text




Hi,

On Sam Wilson <tecywiz121 hotmail com> wrote:
Hello, I hate to bother you all with trivial stuff like this, but I am
having some serious trouble finding the error in my program.

Essentially, I want to render a shape with a gradient background and a
text label, so I created an actor that has a single Text actor as a
child.

The gradient is rendered using a method similar to
http://lists.o-hand.com/clutter/1787.html written in vala and adapted to
handle angles.  (Any improvements to this function would also be welcome
C: )

A screenshot of the incorrect behaviour is located at
http://sellyourvote.ca/Screenshot-test.png

I know it has something to do with the Text actor, since both rectangles
render properly if the text is turned off in both of them.

I'm having trouble compiling your Vala sample so I can't test the
theory, but my guess is that the problem is because you're not setting a
material before you paint the gradient. When you paint the first
gradient on the left you will have the material left over from whatever
was painted last in the previous scene. I think in this case that would
be the text. Text is painted using a special material that I think would
break your gradient. The second gradient works because it will use the
material left over from painting the outline.

I think all it needs is this line at the top of your draw_gradient
method:

  Cogl.set_source_color({128, 128, 128, 255})

- Neil



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