[Mono-list] Best way to convert Cairo.Color from/to Gdk.Color???

Francisco M. Marzoa fmmarzoa at gmx.net
Sun Nov 21 07:40:35 EST 2010


I'd like to know what's the best way to converting Cairo.Color into
Gdk.Color and viceversa, mainly for using Gtk.ColorSelection widget.
Currently I'm doing something like:

Gdk.Color gcl;
Cairo.Color ccl;


gcl = Gdk.Color ( (byte)ccl.R, (byte)ccl.G, (byte),cc.B);

Although it seems to work, it does not looks neither clean nor robust,
as Cairo.Color uses a double for each color component, data may be lost
on the conversion though. I wonder if there's a better method for doing
this, and also for converting from Gdk.Color to Cairo.Color.

Thanks a lot in advance.

Best regards,

More information about the Mono-list mailing list