Hi,<br><br>this may help other people when working with RGBA values.<br><br>I did indeed solved the problem.<br><br>Anyway.. the first issue below happened because I was running Xournal from root in an SSH remote shell.<br>
Thus, probably, colormaps were wrong.<br>Running it the usual way (from the Menu) fixed a bit things.<br>The GdkColor returned by the hildon color chooser was, when drawn on the canvas, slightly different from the one showed in the button itself.<br>
I think it looked darker.<br><br>After digging a bit I figured out that the GdkColor RGB values where RGB16 (guint16) while I needed the RGB8 format.<br>Thus, I had to first divide red, green and blue by 255 before putting them into a single guint value (RGBA) in the form of 0xRRGGBBAA.<br>
<br>guint rgba = GNOME_CANVAS_COLOR_A (color->red / 255.0, color->green / 255.0, color->blue / 255.0, alpha)<br><br>Is that the correct explanation ?<br><br>--<br>anidel<br><br><div class="gmail_quote">On Tue, Apr 15, 2008 at 8:16 PM, Aniello Del Sorbo <<a href="mailto:anidel@gmail.com">anidel@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I reply to myself.<div><br></div><div>I was testing the app running it from a remote SSH (root) and not from the user's Menu.</div>
<div><br></div><div>It works.</div><div>Thanks anyway.</div><div><br></div><div>Aniello<div><div></div><div class="Wj3C7c"><br>
<br><div class="gmail_quote">On Tue, Apr 15, 2008 at 5:50 PM, Aniello Del Sorbo <<a href="mailto:anidel@gmail.com" target="_blank">anidel@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>while porting Xournal to Maemo I decided to give it as much hildonization is possible.<br>Base xournal uses only a bunch of predefined colors (something like 9 or 10 colors).<br><br>I decided to use the hildon_color_button widget to give the user a much wide choice of colors.<br>
I get the GdkColor from the color button and have to convert it in RGBA because Xournal only works with those values<br>(passing "fill-color-rgba" to the canvas items). It does this, I think, for being able to make a highlighter tool available in different colors<br>
(by making use of the alpha channel).<br><br>anyway, I convert the GdkColor to RGBA using the macro:<br><br>GdkColor *color; // read from the hildon_color widget<br>guint alpha = 0xFF; // no transparency<br><br>guint rgba = GNOME_CANVAS_COLOR_A (color->red, color->green, color->blue, alpha) <br>
<br clear="all">and then use it wherever it is needed.<br><br>This works for the predefined colors in the color chooser dialog.<br>But if I choose my own custom color it does not.<br><br>If I use the GdkColor as is (thus passing "fill-color-gdk" to the canvas items), it works, but I can't use the alpha channel (can I ?).<br>
If I convert this custom color to RGBA with the given macro, it paints in a totally different color.<br><br>Is this some issue with the colormap ?<br>Is GNOME_CANVAS_COLOR_A not good for this ?<br><br>Any other hints ?<br>
<font color="#888888">
<br>-- <br>anidel
</font></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>anidel
</font></div>
</blockquote></div><br><br clear="all"><br>-- <br>anidel