> what I want to do is picking up a color from an > Fl_Color_Chooser (widget) > then convert it to an Fl_Color (type) to use it in a drawing function. > What I tried so far looks like this: > > Fl_Color_Chooser *Co; > Fl_Color c = fl_rgb_color(Co->r(), Co->g(), Co->b()); > > This unfortunately always ends up black, because the widget's > r(), g(), b() > returns a value between 0 and 1.0, and as far as I know > fl_rgb_color expects > values between 1-255. > Anyone can give me a good solution for this conversion? Or > should I simply > multiply the rgb values with 255and round?
The color_chooser.cxx example in the test folder is worth a look, but yes, multiplying by 255 should be fine. Note that many folk use the fl_color_chooser function rather than the Fl_Color_Chooser class, and that the function does provide a version that takes/returns bytes... SELEX Galileo Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

