Use rint() for some more rounding of vertices.

Add fl_parse_color() to X11 version, too, and use it instead of XParseColor
in the image handling code.

Move the default color stuff in the plastic scheme to the MacOS
get_system_colors(), and apply the background color to the tile image.

More fixes for test makefile.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1901 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2002-01-01 13:11:29 +00:00
parent 988bc9d95f
commit f9770db21f
11 changed files with 149 additions and 131 deletions
+7
View File
@@ -1,5 +1,12 @@
CHANGES IN FLTK 1.1.0b9 CHANGES IN FLTK 1.1.0b9
- Update the plastic scheme to not override the default
colors - move the color code to the MacOS-specific
code. Also updates the tile image colormap to match
the current background color.
- Add fl_parse_color() to X11 as well, removing a bunch
of conditional code and providing a common interface
for looking up color values.
- Fixed the make problems in the test directory - some - Fixed the make problems in the test directory - some
make programs had trouble handling the recursive make programs had trouble handling the recursive
dependencies on the FLUID files... dependencies on the FLUID files...
+4 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: x.H,v 1.10.2.8.2.3 2001/11/27 17:48:16 easysw Exp $" // "$Id: x.H,v 1.10.2.8.2.4 2002/01/01 13:11:29 easysw Exp $"
// //
// X11 header file for the Fast Light Tool Kit (FLTK). // X11 header file for the Fast Light Tool Kit (FLTK).
// //
@@ -129,9 +129,11 @@ FL_EXPORT Fl_Window* fl_find(Window xid);
extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid() extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid() extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
# endif # endif
#endif #endif
// //
// End of "$Id: x.H,v 1.10.2.8.2.3 2001/11/27 17:48:16 easysw Exp $". // End of "$Id: x.H,v 1.10.2.8.2.4 2002/01/01 13:11:29 easysw Exp $".
// //
+18 -18
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.3 2001/12/11 16:03:12 easysw Exp $" // "$Id: Fl_Chart.cxx,v 1.5.2.6.2.4 2002/01/01 13:11:29 easysw Exp $"
// //
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK). // Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
// //
@@ -53,9 +53,9 @@ static void draw_barchart(int x,int y,int w,int h,
incr = (h - lh + min*incr)/(max-min); incr = (h - lh + min*incr)/(max-min);
zeroh = int(y+h-lh); zeroh = int(y+h-lh);
} else { } else {
zeroh = int(y+h+min * incr + .5); zeroh = (int)rint(y+h+min * incr);
} }
int bwidth = int(w/double(autosize?numb:maxnumb)+.5); int bwidth = (int)rint(w/double(autosize?numb:maxnumb));
/* Draw base line */ /* Draw base line */
fl_color(textcolor); fl_color(textcolor);
fl_line(x, zeroh, x+w, zeroh); fl_line(x, zeroh, x+w, zeroh);
@@ -63,7 +63,7 @@ static void draw_barchart(int x,int y,int w,int h,
int i; int i;
/* Draw the bars */ /* Draw the bars */
for (i=0; i<numb; i++) { for (i=0; i<numb; i++) {
int h = int(entries[i].val*incr+.5); int h = (int)rint(entries[i].val*incr);
if (h < 0) if (h < 0)
fl_rectbound(x+i*bwidth,zeroh,bwidth+1,-h+1, (Fl_Color)entries[i].col); fl_rectbound(x+i*bwidth,zeroh,bwidth+1,-h+1, (Fl_Color)entries[i].col);
else if (h > 0) else if (h > 0)
@@ -98,18 +98,18 @@ static void draw_horbarchart(int x,int y,int w,int h,
else incr = w/(max-min); else incr = w/(max-min);
if ( (-min*incr) < lw) { if ( (-min*incr) < lw) {
incr = (w - lw + min*incr)/(max-min); incr = (w - lw + min*incr)/(max-min);
zeroh = x+int(lw+.5); zeroh = x+(int)rint(lw);
} else { } else {
zeroh = int(x-min * incr + .5); zeroh = (int)rint(x-min * incr);
} }
int bwidth = int(h/double(autosize?numb:maxnumb)+.5); int bwidth = (int)rint(h/double(autosize?numb:maxnumb));
/* Draw base line */ /* Draw base line */
fl_color(textcolor); fl_color(textcolor);
fl_line(zeroh, y, zeroh, y+h); fl_line(zeroh, y, zeroh, y+h);
if (min == 0.0 && max == 0.0) return; /* Nothing else to draw */ if (min == 0.0 && max == 0.0) return; /* Nothing else to draw */
/* Draw the bars */ /* Draw the bars */
for (i=0; i<numb; i++) { for (i=0; i<numb; i++) {
int w = int(entries[i].val*incr+.5); int w = (int)rint(entries[i].val*incr);
if (w > 0) if (w > 0)
fl_rectbound(zeroh,y+i*bwidth,w+1,bwidth+1, (Fl_Color)entries[i].col); fl_rectbound(zeroh,y+i*bwidth,w+1,bwidth+1, (Fl_Color)entries[i].col);
else if (w < 0) else if (w < 0)
@@ -135,14 +135,14 @@ static void draw_linechart(int type, int x,int y,int w,int h,
double incr; double incr;
if (max == min) incr = h-2.0*lh; if (max == min) incr = h-2.0*lh;
else incr = (h-2.0*lh)/ (max-min); else incr = (h-2.0*lh)/ (max-min);
int zeroh = int(y+h-lh+min * incr + .5); int zeroh = (int)rint(y+h-lh+min * incr);
double bwidth = w/double(autosize?numb:maxnumb); double bwidth = w/double(autosize?numb:maxnumb);
/* Draw the values */ /* Draw the values */
for (i=0; i<numb; i++) { for (i=0; i<numb; i++) {
int x0 = x + int((i-.5)*bwidth+.5); int x0 = x + (int)rint((i-.5)*bwidth);
int x1 = x + int((i+.5)*bwidth+.5); int x1 = x + (int)rint((i+.5)*bwidth);
int y0 = i ? zeroh - int(entries[i-1].val*incr+.5) : 0; int y0 = i ? zeroh - (int)rint(entries[i-1].val*incr) : 0;
int y1 = zeroh - int(entries[i].val*incr+.5); int y1 = zeroh - (int)rint(entries[i].val*incr);
if (type == FL_SPIKE_CHART) { if (type == FL_SPIKE_CHART) {
fl_color((Fl_Color)entries[i].col); fl_color((Fl_Color)entries[i].col);
fl_line(x1, zeroh, x1, y1); fl_line(x1, zeroh, x1, y1);
@@ -153,7 +153,7 @@ static void draw_linechart(int type, int x,int y,int w,int h,
fl_color((Fl_Color)entries[i-1].col); fl_color((Fl_Color)entries[i-1].col);
if ((entries[i-1].val>0.0)!=(entries[i].val>0.0)) { if ((entries[i-1].val>0.0)!=(entries[i].val>0.0)) {
double ttt = entries[i-1].val/(entries[i-1].val-entries[i].val); double ttt = entries[i-1].val/(entries[i-1].val-entries[i].val);
int xt = x + int((i-.5+ttt)*bwidth+.5); int xt = x + (int)rint((i-.5+ttt)*bwidth);
fl_polygon(x0,zeroh, x0,y0, xt,zeroh); fl_polygon(x0,zeroh, x0,y0, xt,zeroh);
fl_polygon(xt,zeroh, x1,y1, x1,zeroh); fl_polygon(xt,zeroh, x1,y1, x1,zeroh);
} else { } else {
@@ -169,7 +169,7 @@ static void draw_linechart(int type, int x,int y,int w,int h,
/* Draw the labels */ /* Draw the labels */
for (i=0; i<numb; i++) for (i=0; i<numb; i++)
fl_draw(entries[i].str, fl_draw(entries[i].str,
x+int((i+.5)*bwidth+.5), zeroh - int(entries[i].val*incr+.5),0,0, x+(int)rint((i+.5)*bwidth), zeroh - (int)rint(entries[i].val*incr),0,0,
entries[i].val>=0 ? FL_ALIGN_BOTTOM : FL_ALIGN_TOP); entries[i].val>=0 ? FL_ALIGN_BOTTOM : FL_ALIGN_TOP);
} }
@@ -220,8 +220,8 @@ static void draw_piechart(int x,int y,int w,int h,
/* draw the label */ /* draw the label */
double xl = txc + 1.1*rad*cos(ARCINC*curang); double xl = txc + 1.1*rad*cos(ARCINC*curang);
fl_draw(entries[i].str, fl_draw(entries[i].str,
int(xl+.5), (int)rint(xl),
int(tyc - 1.1*rad*sin(ARCINC*curang)+.5), (int)rint(tyc - 1.1*rad*sin(ARCINC*curang)),
0, 0, 0, 0,
xl<txc ? FL_ALIGN_RIGHT : FL_ALIGN_LEFT); xl<txc ? FL_ALIGN_RIGHT : FL_ALIGN_LEFT);
curang += 0.5 * incr * entries[i].val; curang += 0.5 * incr * entries[i].val;
@@ -378,5 +378,5 @@ void Fl_Chart::maxsize(int m) {
} }
// //
// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.3 2001/12/11 16:03:12 easysw Exp $". // End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.4 2002/01/01 13:11:29 easysw Exp $".
// //
+8 -7
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_File_Icon2.cxx,v 1.1.2.8 2001/12/17 14:27:03 easysw Exp $" // "$Id: Fl_File_Icon2.cxx,v 1.1.2.9 2002/01/01 13:11:29 easysw Exp $"
// //
// Fl_File_Icon system icon routines. // Fl_File_Icon system icon routines.
// //
@@ -40,6 +40,7 @@
#include "flstring.h" #include "flstring.h"
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <FL/math.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(WIN32) && ! defined(__CYGWIN__) #if defined(WIN32) && ! defined(__CYGWIN__)
@@ -299,7 +300,7 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
if (sscanf(params, "%f,%f", &x, &y) != 2) if (sscanf(params, "%f,%f", &x, &y) != 2)
break; break;
add_vertex((short)(x * 100.0 + 0.5), (short)(y * 100.0 + 0.5)); add_vertex((short)(int)rint(x * 100.0), (short)(int)rint(y * 100.0));
} }
else else
{ {
@@ -313,9 +314,9 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
fclose(fp); fclose(fp);
#ifdef DEBUG #ifdef DEBUG
printf("Icon File \"%s\":\n", fti); p(int)rintf("Icon File \"%s\":\n", fti);
for (int i = 0; i < num_data_; i ++) for (int i = 0; i < num_data_; i ++)
printf(" %d,\n", data_[i]); p(int)rintf(" %d,\n", data_[i]);
#endif /* DEBUG */ #endif /* DEBUG */
return 0; return 0;
@@ -559,9 +560,9 @@ Fl_File_Icon::load_image(const char *ifile) // I - File to read from
img->release(); img->release();
#ifdef DEBUG #ifdef DEBUG
printf("Icon File \"%s\":\n", xpm); p(int)rintf("Icon File \"%s\":\n", xpm);
for (i = 0; i < num_data_; i ++) for (i = 0; i < num_data_; i ++)
printf(" %d,\n", data_[i]); p(int)rintf(" %d,\n", data_[i]);
#endif // DEBUG #endif // DEBUG
return 0; return 0;
@@ -930,5 +931,5 @@ get_kde_val(char *str,
// //
// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.8 2001/12/17 14:27:03 easysw Exp $". // End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.9 2002/01/01 13:11:29 easysw Exp $".
// //
+2 -20
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.12 2001/12/21 20:45:43 easysw Exp $" // "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.13 2002/01/01 13:11:29 easysw Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@@ -365,16 +365,7 @@ void Fl_Pixmap::color_average(Fl_Color c, float i) {
while (*p && !isspace(*p)) p++; while (*p && !isspace(*p)) p++;
} }
#if defined(WIN32) || defined(__APPLE__)
if (fl_parse_color(p, r, g, b)) { if (fl_parse_color(p, r, g, b)) {
#else
XColor x;
if (XParseColor(fl_display, fl_colormap, p, &x)) {
r = x.red>>8;
g = x.green>>8;
b = x.blue>>8;
#endif
r = (ia * r + ir) >> 8; r = (ia * r + ir) >> 8;
g = (ia * g + ig) >> 8; g = (ia * g + ig) >> 8;
b = (ia * b + ib) >> 8; b = (ia * b + ib) >> 8;
@@ -460,16 +451,7 @@ void Fl_Pixmap::desaturate() {
while (*p && !isspace(*p)) p++; while (*p && !isspace(*p)) p++;
} }
#if defined(WIN32) || defined(__APPLE__)
if (fl_parse_color(p, r, g, b)) { if (fl_parse_color(p, r, g, b)) {
#else
XColor x;
if (XParseColor(fl_display, fl_colormap, p, &x)) {
r = x.red>>8;
g = x.green>>8;
b = x.blue>>8;
#endif
g = (r * 31 + g * 61 + b * 8) / 100; g = (r * 31 + g * 61 + b * 8) / 100;
if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X", data()[i + 1][0], if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X", data()[i + 1][0],
@@ -485,5 +467,5 @@ void Fl_Pixmap::desaturate() {
} }
// //
// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.12 2001/12/21 20:45:43 easysw Exp $". // End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.13 2002/01/01 13:11:29 easysw Exp $".
// //
+64 -31
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.3 2001/12/20 14:41:44 easysw Exp $" // "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.4 2002/01/01 13:11:29 easysw Exp $"
// //
// System color support for the Fast Light Tool Kit (FLTK). // System color support for the Fast Light Tool Kit (FLTK).
// //
@@ -28,6 +28,7 @@
#include <FL/x.H> #include <FL/x.H>
#include <FL/math.h> #include <FL/math.h>
#include "flstring.h" #include "flstring.h"
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <FL/Fl_Tiled_Image.H> #include <FL/Fl_Tiled_Image.H>
@@ -94,6 +95,18 @@ int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
r = R; g = G; b = B; r = R; g = G; b = B;
return 1; return 1;
} }
#else
// Wrapper around XParseColor...
int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
XColor x;
if (!fl_display) fl_open_display();
if (XParseColor(fl_display, fl_colormap, p, &x)) {
r = x.red>>8;
g = x.green>>8;
b = x.blue>>8;
return 1;
} else return 0;
}
#endif // WIN32 || __APPLE__ #endif // WIN32 || __APPLE__
#if defined(WIN32) #if defined(WIN32)
@@ -122,12 +135,17 @@ void Fl::get_system_colors() {
#elif defined(__APPLE__) #elif defined(__APPLE__)
// MacOS X currently supports two color schemes - Blue and Graphite. // MacOS X currently supports two color schemes - Blue and Graphite.
// Since we aren't emulating the Aqua interface (even if Apple would // Since we aren't emulating the Aqua interface (even if Apple would
// let us), we can stick with the defaults that FLTK has traditionally // let us), we use some defaults that are similar to both. The
// used... The Fl::scheme("plastic") color/box scheme provides a // Fl::scheme("plastic") color/box scheme provides a usable Aqua-like
// usable Aqua-like look-n-feel... // look-n-feel...
void Fl::get_system_colors() void Fl::get_system_colors()
{ {
fl_open_display(); fl_open_display();
foreground(0, 0, 0);
background(0xe0, 0xe0, 0xe0);
background2(0xf0, 0xf0, 0xf0);
set_selection_color(0x80, 0x80, 0x80);
} }
#else #else
@@ -219,25 +237,40 @@ int Fl::reload_scheme() {
get_system_colors(); get_system_colors();
if (scheme_ && !strcasecmp(scheme_, "plastic")) { if (scheme_ && !strcasecmp(scheme_, "plastic")) {
// Load plastic buttons, etc... // Update the tile image to match the background color...
uchar r, g, b;
get_color(FL_GRAY, r, g, b);
sprintf(tile_cmap[0], "O c #%02x%02x%02x", r, g, b);
sprintf(tile_cmap[1], "o c #%02x%02x%02x", 0xe0 * (int)r / 0xf0,
0xe0 * (int)g / 0xf0, 0xe0 * (int)b / 0xf0);
sprintf(tile_cmap[2], ". c #%02x%02x%02x", 0xd8 * (int)r / 0xf0,
0xd8 * (int)g / 0xf0, 0xd8 * (int)b / 0xf0);
if (tile.id) {
fl_delete_offscreen(tile.id);
tile.id = 0;
}
if (tile.mask) {
fl_delete_bitmask(tile.mask);
tile.mask = 0;
}
if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, Fl::w(), Fl::h()); if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, Fl::w(), Fl::h());
Fl::foreground(0, 0, 0); // Load plastic buttons, etc...
Fl::background(0xe0, 0xe0, 0xe0); set_boxtype(FL_UP_FRAME, FL_PLASTIC_UP_FRAME);
Fl::background2(0xf0, 0xf0, 0xf0); set_boxtype(FL_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME);
set_selection_color(0x80, 0x80, 0x80); set_boxtype(FL_THIN_UP_FRAME, FL_PLASTIC_UP_FRAME);
set_boxtype(FL_THIN_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME);
Fl::set_boxtype(FL_UP_FRAME, FL_PLASTIC_UP_FRAME); set_boxtype(FL_UP_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(FL_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME); set_boxtype(FL_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
Fl::set_boxtype(FL_THIN_UP_FRAME, FL_PLASTIC_UP_FRAME); set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(FL_THIN_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME); set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(FL_UP_BOX, FL_PLASTIC_UP_BOX); set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(FL_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
Fl::set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
Fl::set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_UP_BOX);
Fl::set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_UP_BOX);
} else { } else {
// Use the standard FLTK look-n-feel... // Use the standard FLTK look-n-feel...
if (scheme_bg_) { if (scheme_bg_) {
@@ -245,17 +278,17 @@ int Fl::reload_scheme() {
scheme_bg_ = (Fl_Image *)0; scheme_bg_ = (Fl_Image *)0;
} }
Fl::set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2); set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2);
Fl::set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2); set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2);
Fl::set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2); set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2);
Fl::set_boxtype(FL_THIN_DOWN_FRAME, fl_thin_down_frame, 1, 1, 2, 2); set_boxtype(FL_THIN_DOWN_FRAME, fl_thin_down_frame, 1, 1, 2, 2);
Fl::set_boxtype(FL_UP_BOX, fl_up_box, D1, D1, D2, D2); set_boxtype(FL_UP_BOX, fl_up_box, D1, D1, D2, D2);
Fl::set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2); set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2);
Fl::set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2); set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2);
Fl::set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2); set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2);
Fl::set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6); set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6);
Fl::set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6); set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6);
} }
// Set (or clear) the background tile for all windows... // Set (or clear) the background tile for all windows...
@@ -271,5 +304,5 @@ int Fl::reload_scheme() {
// //
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.3 2001/12/20 14:41:44 easysw Exp $". // End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.4 2002/01/01 13:11:29 easysw Exp $".
// //
+17 -28
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $" // "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.6 2002/01/01 13:11:29 easysw Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@@ -72,11 +72,11 @@ static void cb1(void*v, int x, int y, int w, uchar* buf) {
const uchar* p = d.data[y]+x; const uchar* p = d.data[y]+x;
U64* q = (U64*)buf; U64* q = (U64*)buf;
for (int X=(w+1)/2; X--; p += 2) { for (int X=(w+1)/2; X--; p += 2) {
#if WORDS_BIGENDIAN # if WORDS_BIGENDIAN
*q++ = (d.colors[p[0]]<<32) | d.colors[p[1]]; *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]];
#else # else
*q++ = (d.colors[p[1]]<<32) | d.colors[p[0]]; *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]];
#endif # endif
} }
} }
@@ -90,11 +90,11 @@ static void cb2(void*v, int x, int y, int w, uchar* buf) {
int index = *p++; int index = *p++;
U64* colors1 = d.byte1[*p++]; U64* colors1 = d.byte1[*p++];
int index1 = *p++; int index1 = *p++;
#if WORDS_BIGENDIAN # if WORDS_BIGENDIAN
*q++ = (colors[index]<<32) | colors1[index1]; *q++ = (colors[index]<<32) | colors1[index1];
#else # else
*q++ = (colors1[index1]<<32) | colors[index]; *q++ = (colors1[index1]<<32) | colors[index];
#endif # endif
} }
} }
@@ -131,11 +131,6 @@ static void cb2(void*v, int x, int y, int w, uchar* buf) {
#endif #endif
#if defined(WIN32) || defined(__APPLE__)
// this is in Fl_arg.cxx:
extern int fl_parse_color(const char*, uchar&, uchar&, uchar&);
#endif
uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here
int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color bg) { int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color bg) {
@@ -157,9 +152,9 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
uchar* c = (uchar*)&d.colors[' ']; uchar* c = (uchar*)&d.colors[' '];
#ifdef U64 #ifdef U64
*(U64*)c = 0; *(U64*)c = 0;
#if WORDS_BIGENDIAN # if WORDS_BIGENDIAN
c += 4; c += 4;
#endif # endif
#endif #endif
transparent_index = ' '; transparent_index = ' ';
Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0;
@@ -171,9 +166,9 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
uchar* c = (uchar*)&d.colors[*p++]; uchar* c = (uchar*)&d.colors[*p++];
#ifdef U64 #ifdef U64
*(U64*)c = 0; *(U64*)c = 0;
#if WORDS_BIGENDIAN # if WORDS_BIGENDIAN
c += 4; c += 4;
#endif # endif
#endif #endif
*c++ = *p++; *c++ = *p++;
*c++ = *p++; *c++ = *p++;
@@ -214,19 +209,13 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
} }
#ifdef U64 #ifdef U64
*(U64*)c = 0; *(U64*)c = 0;
#if WORDS_BIGENDIAN # if WORDS_BIGENDIAN
c += 4; c += 4;
# endif
#endif #endif
#endif if (!fl_parse_color((const char*)p, c[0], c[1], c[2])) {
#if defined(WIN32) || defined(__APPLE__) // assume "None" or "#transparent" for any errors
if (fl_parse_color((const char*)p, c[0], c[1], c[2])) {; // "bg" should be transparent...
#else
XColor x;
if (XParseColor(fl_display, fl_colormap, (const char*)p, &x)) {
c[0] = x.red>>8; c[1] = x.green>>8; c[2] = x.blue>>8;
#endif
} else { // assume "None" or "#transparent" for any errors
// this should be transparent...
Fl::get_color(bg, c[0], c[1], c[2]); Fl::get_color(bg, c[0], c[1], c[2]);
transparent_index = index; transparent_index = index;
} }
@@ -273,5 +262,5 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
} }
// //
// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $". // End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.6 2002/01/01 13:11:29 easysw Exp $".
// //
+6 -6
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_vertex.cxx,v 1.5.2.3.2.3 2001/12/28 21:57:41 easysw Exp $" // "$Id: fl_vertex.cxx,v 1.5.2.3.2.4 2002/01/01 13:11:29 easysw Exp $"
// //
// Portable drawing routines for the Fast Light Tool Kit (FLTK). // Portable drawing routines for the Fast Light Tool Kit (FLTK).
// //
@@ -228,10 +228,10 @@ void fl_circle(double x, double y,double r) {
double yt = fl_transform_y(x,y); double yt = fl_transform_y(x,y);
double rx = r * (m.c ? sqrt(m.a*m.a+m.c*m.c) : fabs(m.a)); double rx = r * (m.c ? sqrt(m.a*m.a+m.c*m.c) : fabs(m.a));
double ry = r * (m.b ? sqrt(m.b*m.b+m.d*m.d) : fabs(m.d)); double ry = r * (m.b ? sqrt(m.b*m.b+m.d*m.d) : fabs(m.d));
int llx = int(xt-rx+.5); int llx = (int)rint(xt-rx);
int w = int(xt+rx+.5)-llx; int w = (int)rint(xt+rx)-llx;
int lly = int(yt-ry+.5); int lly = (int)rint(yt-ry);
int h = int(yt+ry+.5)-lly; int h = (int)rint(yt+ry)-lly;
#ifdef WIN32 #ifdef WIN32
if (what==POLYGON) { if (what==POLYGON) {
SelectObject(fl_gc, fl_brush()); SelectObject(fl_gc, fl_brush());
@@ -248,5 +248,5 @@ void fl_circle(double x, double y,double r) {
} }
// //
// End of "$Id: fl_vertex.cxx,v 1.5.2.3.2.3 2001/12/28 21:57:41 easysw Exp $". // End of "$Id: fl_vertex.cxx,v 1.5.2.3.2.4 2002/01/01 13:11:29 easysw Exp $".
// //
+8 -3
View File
@@ -1,9 +1,14 @@
/* XPM */ /* XPM */
static char tile_cmap[3][32] = {
"O c #F0F0F0",
"o c #E0E0E0",
". c #D8D8D8"
};
static const char * tile_xpm[] = { static const char * tile_xpm[] = {
"16 16 3 1", "16 16 3 1",
"O c #F0F0F0", tile_cmap[0],
"o c #E0E0E0", tile_cmap[1],
". c #D8D8D8", tile_cmap[2],
"OOOOOOOOOOOOOOOO", "OOOOOOOOOOOOOOOO",
"oooooooooooooooo", "oooooooooooooooo",
"................", "................",
+13 -2
View File
@@ -1,5 +1,5 @@
# #
# "$Id: Makefile,v 1.19.2.7.2.24 2001/12/30 05:16:10 easysw Exp $" # "$Id: Makefile,v 1.19.2.7.2.25 2002/01/01 13:11:29 easysw Exp $"
# #
# Test/example program makefile for the Fast Light Tool Kit (FLTK). # Test/example program makefile for the Fast Light Tool Kit (FLTK).
# #
@@ -180,11 +180,13 @@ keyboard$(EXEEXT): keyboard_ui.o keyboard.o
echo Linking $@... echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS) -o $@ $(CXX) -I.. $(CXXFLAGS) keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r $(POSTBUILD) $@ ../FL/mac.r
keyboard_ui.o: keyboard_ui.h ../fluid/fluid
mandelbrot$(EXEEXT): mandelbrot_ui.o mandelbrot.o mandelbrot$(EXEEXT): mandelbrot_ui.o mandelbrot.o
echo Linking $@... echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS) -o $@ $(CXX) -I.. $(CXXFLAGS) mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r $(POSTBUILD) $@ ../FL/mac.r
mandelbrot_ui.o: mandelbrot_ui.h ../fluid/fluid
pixmap_browser$(EXEEXT): pixmap_browser.o pixmap_browser$(EXEEXT): pixmap_browser.o
echo Linking $@... echo Linking $@...
@@ -199,6 +201,7 @@ CubeView$(EXEEXT): CubeMain.o CubeView.o CubeViewUI.o
$(POSTBUILD) $@ ../FL/mac.r $(POSTBUILD) $@ ../FL/mac.r
CubeMain.o: CubeViewUI.h CubeView.h CubeMain.o: CubeViewUI.h CubeView.h
CubeView.o: CubeView.h CubeView.o: CubeView.h
CubeViewUI.o: CubeViewUI.h ../fluid/fluid
cube$(EXEEXT): cube.o cube$(EXEEXT): cube.o
echo Linking $@... echo Linking $@...
@@ -224,12 +227,20 @@ shiny$(EXEEXT): shiny_panel.o shiny.o
echo Linking $@... echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) shiny.o shiny_panel.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ $(CXX) -I.. $(CXXFLAGS) shiny.o shiny_panel.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r $(POSTBUILD) $@ ../FL/mac.r
shiny_panel.o: shiny_panel.h ../fluid/fluid
shape$(EXEEXT): shape.o shape$(EXEEXT): shape.o
echo Linking $@... echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ $(CXX) -I.. $(CXXFLAGS) shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r $(POSTBUILD) $@ ../FL/mac.r
fast_slow.cxx: ../fluid/fluid
inactive.cxx: ../fluid/fluid
radio.cxx: ../fluid/fluid
resize.cxx: ../fluid/fluid
tabs.cxx: ../fluid/fluid
valuators.cxx: ../fluid/fluid
# If you have libjpeg installed, you might want to try this test program: # If you have libjpeg installed, you might want to try this test program:
jpeg_image$(EXEEXT): jpeg_image.o jpeg_image$(EXEEXT): jpeg_image.o
@@ -250,5 +261,5 @@ uninstall:
@echo Nothing to uninstall in test directory. @echo Nothing to uninstall in test directory.
# #
# End of "$Id: Makefile,v 1.19.2.7.2.24 2001/12/30 05:16:10 easysw Exp $". # End of "$Id: Makefile,v 1.19.2.7.2.25 2002/01/01 13:11:29 easysw Exp $".
# #
+2 -14
View File
@@ -77,11 +77,6 @@ cube.o: ../FL/Fl_Button.H ../FL/Fl_Radio_Light_Button.H
cube.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_Slider.H cube.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_Slider.H
cube.o: ../FL/Fl_Valuator.H ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H ../FL/gl.h cube.o: ../FL/Fl_Valuator.H ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H ../FL/gl.h
CubeMain.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H CubeMain.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
CubeMain.o: CubeViewUI.h ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
CubeMain.o: ../FL/Fl_Group.H ../FL/Fl_Roller.H ../FL/Fl_Valuator.H
CubeMain.o: ../FL/Fl_Slider.H ../FL/Fl_Box.H CubeView.h ../FL/Fl_Gl_Window.H
CubeMain.o: ../FL/Fl_Window.H ../FL/gl.h ../FL/Fl_Value_Slider.H
CubeMain.o: ../FL/Fl_Slider.H
CubeView.o: CubeView.h ../config.h ../FL/Fl.H ../FL/Enumerations.H CubeView.o: CubeView.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
CubeView.o: ../FL/Fl_Export.H ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H CubeView.o: ../FL/Fl_Export.H ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H
CubeView.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/gl.h CubeView.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/gl.h
@@ -197,9 +192,6 @@ input.o: ../FL/Fl_Multiline_Input.H ../FL/Fl_Button.H
input.o: ../FL/Fl_Toggle_Button.H ../FL/Fl_Button.H ../FL/Fl_Color_Chooser.H input.o: ../FL/Fl_Toggle_Button.H ../FL/Fl_Button.H ../FL/Fl_Color_Chooser.H
input.o: ../FL/Fl_Group.H ../FL/Fl_Box.H ../FL/Fl_Return_Button.H input.o: ../FL/Fl_Group.H ../FL/Fl_Box.H ../FL/Fl_Return_Button.H
input.o: ../FL/Fl_Choice.H ../FL/Fl_Value_Input.H ../FL/Fl_Valuator.H input.o: ../FL/Fl_Choice.H ../FL/Fl_Value_Input.H ../FL/Fl_Valuator.H
keyboard.o: keyboard_ui.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
keyboard.o: ../FL/Fl_Button.H ../FL/Fl_Output.H ../FL/Fl_Input_.H
keyboard.o: ../FL/Fl_Box.H ../FL/Fl_Dial.H ../FL/Fl_Valuator.H
label.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H label.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
label.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H label.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
label.o: ../FL/Fl_Widget.H ../FL/Fl_Box.H ../FL/Fl_Hor_Value_Slider.H label.o: ../FL/Fl_Widget.H ../FL/Fl_Box.H ../FL/Fl_Hor_Value_Slider.H
@@ -281,12 +273,8 @@ shape.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
shape.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H shape.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
shape.o: ../FL/Fl_Hor_Slider.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H shape.o: ../FL/Fl_Hor_Slider.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
shape.o: ../FL/math.h ../FL/gl.h ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H shape.o: ../FL/math.h ../FL/gl.h ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H
shiny.o: ../config.h shiny_panel.h ../FL/Fl.H ../FL/Enumerations.H shiny.o: ../config.h ../FL/fl_message.H ../FL/fl_ask.H ../FL/Enumerations.H
shiny.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H shiny.o: ../FL/Fl_Export.H ../FL/fl_draw.H ../FL/gl.h
shiny.o: ../FL/Fl_Widget.H ../FL/Fl_Box.H ../FL/Fl_Group.H ../FL/Fl_Button.H
shiny.o: ../FL/Fl_Value_Slider.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
shiny.o: ../FL/Fl_Slider.H ../FL/fl_message.H ../FL/fl_ask.H ../FL/fl_draw.H
shiny.o: ../FL/gl.h
subwindow.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H subwindow.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
subwindow.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H subwindow.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
subwindow.o: ../FL/Fl_Toggle_Button.H ../FL/Fl_Button.H subwindow.o: ../FL/Fl_Toggle_Button.H ../FL/Fl_Button.H