Edzard Egberts wrote:
> I tried to make the background color changeable and wanted to use
> fl_rgb_color() for choosing color and Fl::background() for setting
> color.
Does it work if you pass the r/g/b values you're starting with
directly to Fl::background()? eg:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
int main() {
int r = 255, g = 0, b = 0; // red
Fl::background(r,g,b);
Fl_Window win(300,100,"test");
win.show();
return(Fl::run());
}
This seems to work for me; background is red.
If you want to convert the r/g/b values into an Fl_Color,
then back into r/g/b values, this seems to work as well:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
int main() {
int r1 = 255, g1 = 0, b1 = 0; // start with r/g/b colors..
Fl_Color c = fl_rgb_color(r1,g1,b1); // ..turn them into an
Fl_Color..
int r2 = (c >> 24) & 255; // then back again into r/g/b
colors
int g2 = (c >> 16) & 255;
int b2 = (c >> 8) & 255;
Fl::background(r2,g2,b2); // assign bg color (should be
same as Fl::background(r1,g1,b1))
Fl_Window win(300,100,"test");
win.show();
return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk