[MonoDevelop] Gdk# Color Parse function

Abdul Rauf raufbutt at gmail.com
Sun May 15 04:21:58 EDT 2011


Thanks for your reply. I am passing Gdk.Color.ToString() which is of the
form rgb:ffff/0/0
Here is a snippet:

Gdk.Color colour1 = new Gdk.Color(255, 0, 0); //red
Gdk.Color colour2 = new Gdk.Color(255, 255, 0); //Yellow
        bool result = Gdk.Color.Parse("red", ref colour2);

In this scenario, the colour2 variable changes from yellow to red and the
function returns true. However if I passes the string as follows:

Gdk.Color colour1 = new Gdk.Color(255, 0, 0); //red
Gdk.Color colour2 = new Gdk.Color(255, 255, 0); //Yellow
        bool result = Gdk.Color.Parse(colour1.ToString(), ref colour2); //
rgb:ffff/0/0

the colour2 variable remains yellow and the function returns false.

Regards
Rauf

On 15 May 2011 05:13, Michael Hutchinson <m.j.hutchinson at gmail.com> wrote:

> On Sat, May 14, 2011 at 6:43 AM, Abdul Rauf <raufbutt at gmail.com> wrote:
> > Hello,
> > I am working with Gdk.Color structure. When I use the function
> > "Gdk.Color.Parse(string , ref Gtk.Color)" with a color name like "red"
> and
> > "green", it changes the value of the Color structure in the second
> argument.
> > However, when I pass the RGB string - for example, "RGB:ff/ff/00", it
> does
> > not change the Color structure.
> > I found in a book that original GNOME GDK Parse function does accept RGB
> > strings as well..Ref:
> > (http://openbooks.sourceforge.net/books/wga/graphics-gdk.html)
> > Could anyone please tell me about Gdk# behavior in this regard?
>
> In general, Gdk# is a very thin wrapper over GDK, and passes string
> directly through, so behaviour should be the same. Did you try just
> passing "#ffff00", i.e. like HTML?
>
> --
> Michael Hutchinson
> http://mjhutchinson.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20110515/75d22173/attachment.html 


More information about the Monodevelop-list mailing list