// Image drawing routines for the Fast Light Tool Kit (FLTK).
//
@ -59,6 +59,7 @@
@@ -59,6 +59,7 @@
#include<FL/fl_draw.H>
#include<FL/x.H>
#include"Fl_XColor.H"
#include<string.h>
staticXImagei;// template used to pass info to X
staticintbytes_per_pixel;
@ -97,8 +98,12 @@ static void improve(uchar *p, int& e, int r, int g, int b, int i) {
@@ -97,8 +98,12 @@ static void improve(uchar *p, int& e, int r, int g, int b, int i) {
}
staticintfilled_color_cube;
staticcharalloc_color[256];// 1 = allocated, 0 = not allocated
staticvoidfill_color_cube(){
filled_color_cube=1;
#if 0 // Delay color filling to reduce colormap usage...
inti;
// allocate all the colors in the fltk color cube and gray ramp:
// allocate widely seperated values first so that the bad ones are
@ -183,8 +200,14 @@ static void mono8_converter(const uchar *from, uchar *to, int w, int delta) {
@@ -183,8 +200,14 @@ static void mono8_converter(const uchar *from, uchar *to, int w, int delta) {
}
for(;w--;from+=d,to+=td){
r+=from[0];if(r<0)r=0;elseif(r>255)r=255;
Fl_XColor*x=fl_xmap[0]+cube[(r>>4)*0x111];
i=cube[(r>>4)*0x111];
Fl_XColor*x=fl_xmap[0]+i;
r-=x->g;
if(!alloc_color[i])
{
fl_xpixel((Fl_Color)i);
alloc_color[i]=1;
}
*to=uchar(x->pixel);
}
ri=r;
@ -627,5 +650,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
@@ -627,5 +650,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
#endif
//
// End of "$Id: fl_draw_image.cxx,v 1.5.2.2 2000/06/05 21:21:07 mike Exp $".
// End of "$Id: fl_draw_image.cxx,v 1.5.2.3 2000/06/27 23:07:51 easysw Exp $".