Use device abstraction for colors.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8129 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-12-28 15:33:36 +00:00
parent 431fc4cd5d
commit 2a5a3d4e8b
4 changed files with 14 additions and 8 deletions

View File

@ -193,9 +193,9 @@ protected:
/** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
virtual void font(Fl_Font face, Fl_Fontsize size) {};
/** \brief see fl_color(Fl_Color c). */
virtual void color(Fl_Color c);
virtual void color(Fl_Color c) {};
/** \brief see fl_color(uchar r, uchar g, uchar b). */
virtual void color(uchar r, uchar g, uchar b);
virtual void color(uchar r, uchar g, uchar b) {};
/** \brief see fl_point(int x, int y). */
virtual void point(int x, int y);
/** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2). */
@ -298,6 +298,8 @@ public:
/** \brief The constructor. */
Fl_Quartz_Graphics_Driver() { type_ = device_type; };
static const char *device_type;
void color(Fl_Color c);
void color(uchar r, uchar g, uchar b);
void draw(const char* str, int n, int x, int y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);
@ -322,6 +324,8 @@ public:
/** \brief The constructor. */
Fl_GDI_Graphics_Driver() { type_ = device_type; };
static const char *device_type;
void color(Fl_Color c);
void color(uchar r, uchar g, uchar b);
void draw(const char* str, int n, int x, int y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);
@ -346,6 +350,8 @@ public:
/** \brief The constructor. */
Fl_Xlib_Graphics_Driver() { type_ = device_type; };
static const char *device_type;
void color(Fl_Color c);
void color(uchar r, uchar g, uchar b);
void draw(const char* str, int n, int x, int y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);

View File

@ -127,7 +127,7 @@ Fl_XColor fl_xmap[1][256];
/** Current color for drawing operations */
Fl_Color fl_color_;
void Fl_Graphics_Driver::color(Fl_Color i) {
void Fl_Xlib_Graphics_Driver::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
@ -138,7 +138,7 @@ void Fl_Graphics_Driver::color(Fl_Color i) {
}
}
void Fl_Graphics_Driver::color(uchar r,uchar g,uchar b) {
void Fl_Xlib_Graphics_Driver::color(uchar r,uchar g,uchar b) {
fl_color_ = fl_rgb_color(r, g, b);
if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));

View File

@ -49,7 +49,7 @@ Fl_XMap* fl_current_xmap;
Fl_Color fl_color_;
void Fl_Graphics_Driver::color(Fl_Color i) {
void Fl_Quartz_Graphics_Driver::color(Fl_Color i) {
fl_color_ = i;
int index;
uchar r, g, b;
@ -74,7 +74,7 @@ void Fl_Graphics_Driver::color(Fl_Color i) {
CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
}
void Fl_Graphics_Driver::color(uchar r, uchar g, uchar b) {
void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) {
fl_color_ = fl_rgb_color(r, g, b);
float fr = r/255.0f;
float fg = g/255.0f;

View File

@ -94,7 +94,7 @@ static void set_xmap(Fl_XMap& xmap, COLORREF c) {
Fl_Color fl_color_;
void Fl_Graphics_Driver::color(Fl_Color i) {
void Fl_GDI_Graphics_Driver::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
@ -118,7 +118,7 @@ void Fl_Graphics_Driver::color(Fl_Color i) {
}
}
void Fl_Graphics_Driver::color(uchar r, uchar g, uchar b) {
void Fl_GDI_Graphics_Driver::color(uchar r, uchar g, uchar b) {
static Fl_XMap xmap;
COLORREF c = RGB(r,g,b);
fl_color_ = fl_rgb_color(r, g, b);