More color fixes for Xft (fl_color_ wasn't always set)

Fix plastic boxtype (1 pixel too high)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2234 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-05-16 02:16:17 +00:00
parent 83c0e840ba
commit af1ec00483
5 changed files with 24 additions and 17 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_color.cxx,v 1.12.2.5.2.6 2002/04/11 10:46:19 easysw Exp $"
// "$Id: fl_color.cxx,v 1.12.2.5.2.7 2002/05/16 02:16:17 easysw Exp $"
//
// Color functions for the Fast Light Tool Kit (FLTK).
//
@ -136,6 +136,7 @@ ulong fl_xpixel(uchar r,uchar g,uchar b) {
}
void fl_color(uchar r,uchar g,uchar b) {
fl_color_ = fl_rgb_color(r, g, b);
XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));
}
@ -165,6 +166,10 @@ static inline uchar realcolor(uchar color, uchar mask) {
}
ulong fl_xpixel(Fl_Color i) {
if (i & 0xffffff00) {
return fl_xpixel((i >> 24) & 255, (i >> 16) & 255, (i >> 8) & 255);
}
Fl_XColor &xmap = fl_xmap[fl_overlay][i];
if (xmap.mapped) return xmap.pixel;
@ -372,5 +377,5 @@ Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg) {
}
//
// End of "$Id: fl_color.cxx,v 1.12.2.5.2.6 2002/04/11 10:46:19 easysw Exp $".
// End of "$Id: fl_color.cxx,v 1.12.2.5.2.7 2002/05/16 02:16:17 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_color_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $"
// "$Id: fl_color_mac.cxx,v 1.1.2.3 2002/05/16 02:16:17 easysw Exp $"
//
// MacOS color functions for the Fast Light Tool Kit (FLTK).
//
@ -72,6 +72,7 @@ void fl_color(Fl_Color i) {
void fl_color(uchar r, uchar g, uchar b) {
RGBColor rgb;
fl_color_ = fl_rgb_color(r, g, b);
rgb.red = (r<<8)|r;
rgb.green = (g<<8)|g;
rgb.blue = (b<<8)|b;
@ -85,5 +86,5 @@ void Fl::set_color(Fl_Color i, unsigned c) {
}
//
// End of "$Id: fl_color_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: fl_color_mac.cxx,v 1.1.2.3 2002/05/16 02:16:17 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_color_win32.cxx,v 1.14.2.3.2.3 2002/01/01 15:11:32 easysw Exp $"
// "$Id: fl_color_win32.cxx,v 1.14.2.3.2.4 2002/05/16 02:16:17 easysw Exp $"
//
// WIN32 color functions for the Fast Light Tool Kit (FLTK).
//
@ -109,6 +109,7 @@ void fl_color(Fl_Color i) {
void fl_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);
if (!xmap.pen || c != xmap.rgb) {
clear_xmap(xmap);
set_xmap(xmap, c);
@ -221,5 +222,5 @@ fl_select_palette(void)
#endif
//
// End of "$Id: fl_color_win32.cxx,v 1.14.2.3.2.3 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: fl_color_win32.cxx,v 1.14.2.3.2.4 2002/05/16 02:16:17 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_font_xft.cxx,v 1.4.2.5 2002/05/15 23:20:51 easysw Exp $"
// "$Id: fl_font_xft.cxx,v 1.4.2.6 2002/05/16 02:16:17 easysw Exp $"
//
// Xft font code for the Fast Light Tool Kit (FLTK).
//
@ -217,14 +217,14 @@ void fl_draw(const char *str, int n, int x, int y) {
XftColor color;
color.pixel = fl_xpixel(fl_color_);
uchar r,g,b; Fl::get_color(fl_color_, r,g,b);
color.color.red = (int)r*0x101;
color.color.green = (int)g*0x101;
color.color.blue = (int)b*0x101;
color.color.red = ((int)r)*0x101;
color.color.green = ((int)g)*0x101;
color.color.blue = ((int)b)*0x101;
color.color.alpha = 0xffff;
XftDrawString8(draw, &color, current_font, x, y, (XftChar8 *)str, n);
}
//
// End of "$Id: fl_font_xft.cxx,v 1.4.2.5 2002/05/15 23:20:51 easysw Exp $"
// End of "$Id: fl_font_xft.cxx,v 1.4.2.6 2002/05/16 02:16:17 easysw Exp $"
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_plastic.cxx,v 1.1.2.12 2002/05/10 00:18:37 easysw Exp $"
// "$Id: fl_plastic.cxx,v 1.1.2.13 2002/05/16 02:16:17 easysw Exp $"
//
// "Plastic" drawing routines for the Fast Light Tool Kit (FLTK).
//
@ -136,24 +136,24 @@ static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc)
static void up_frame(int x, int y, int w, int h, Fl_Color c) {
shade_frame(x, y, w, h, "MNFKKLNO", c);
shade_frame(x, y, w, h - 1, "MNFKKLNO", c);
}
static void up_box(int x, int y, int w, int h, Fl_Color c) {
shade_rect(x + 2, y + 2, w - 4, h - 4, "TXSPPQQRSSTTUVS", c);
shade_rect(x + 2, y + 2, w - 4, h - 5, "TXSPPQQRSSTTUVS", c);
up_frame(x, y, w, h, c);
}
static void down_frame(int x, int y, int w, int h, Fl_Color c) {
shade_frame(x, y, w, h, "LLRRTTLL", c);
shade_frame(x, y, w, h - 1, "LLRRTTLL", c);
}
static void down_box(int x, int y, int w, int h, Fl_Color c) {
shade_rect(x + 2, y + 2, w - 4, h - 4, "STUVWWWVT", c);
shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
down_frame(x, y, w, h, c);
}
@ -173,5 +173,5 @@ Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX() {
//
// End of "$Id: fl_plastic.cxx,v 1.1.2.12 2002/05/10 00:18:37 easysw Exp $".
// End of "$Id: fl_plastic.cxx,v 1.1.2.13 2002/05/16 02:16:17 easysw Exp $".
//