changed function names in BColor, BTexture, BImage and BImageControl
This commit is contained in:
parent
15c875ad37
commit
56bbd4e580
2 changed files with 192 additions and 193 deletions
284
src/Image.cc
284
src/Image.cc
|
@ -25,7 +25,7 @@
|
||||||
// stupid macros needed to access some functions in version 2 of the GNU C
|
// stupid macros needed to access some functions in version 2 of the GNU C
|
||||||
// library
|
// library
|
||||||
|
|
||||||
// $Id: Image.cc,v 1.9 2002/05/07 17:14:01 fluxgen Exp $
|
// $Id: Image.cc,v 1.10 2002/07/19 20:30:45 fluxgen Exp $
|
||||||
|
|
||||||
//use GNU extensions
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -96,14 +96,14 @@ BImage::BImage(BImageControl *c, unsigned int w, unsigned int h) {
|
||||||
|
|
||||||
xtable = ytable = (unsigned int *) 0;
|
xtable = ytable = (unsigned int *) 0;
|
||||||
|
|
||||||
cpc = control->getColorsPerChannel();
|
cpc = control->colorsPerChannel();
|
||||||
cpccpc = cpc * cpc;
|
cpccpc = cpc * cpc;
|
||||||
|
|
||||||
control->getColorTables(&red_table, &green_table, &blue_table,
|
control->colorTables(&red_table, &green_table, &blue_table,
|
||||||
&red_offset, &green_offset, &blue_offset,
|
&red_offset, &green_offset, &blue_offset,
|
||||||
&red_bits, &green_bits, &blue_bits);
|
&red_bits, &green_bits, &blue_bits);
|
||||||
|
|
||||||
if (control->getVisual()->c_class != TrueColor)
|
if (control->visual()->c_class != TrueColor)
|
||||||
control->getXColorTable(&colors, &ncolors);
|
control->getXColorTable(&colors, &ncolors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,9 +128,9 @@ Pixmap BImage::render(BTexture *texture) {
|
||||||
|
|
||||||
|
|
||||||
Pixmap BImage::render_solid(BTexture *texture) {
|
Pixmap BImage::render_solid(BTexture *texture) {
|
||||||
Pixmap pixmap = XCreatePixmap(control->getBaseDisplay()->getXDisplay(),
|
Pixmap pixmap = XCreatePixmap(control->baseDisplay()->getXDisplay(),
|
||||||
control->getDrawable(), width,
|
control->drawable(), width,
|
||||||
height, control->getDepth());
|
height, control->depth());
|
||||||
if (pixmap == None) {
|
if (pixmap == None) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
I18n::instance()->getMessage(
|
I18n::instance()->getMessage(
|
||||||
|
@ -142,87 +142,87 @@ Pixmap BImage::render_solid(BTexture *texture) {
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
GC gc, hgc, lgc;
|
GC gc, hgc, lgc;
|
||||||
|
|
||||||
gcv.foreground = texture->getColor()->getPixel();
|
gcv.foreground = texture->color().pixel();
|
||||||
gcv.fill_style = FillSolid;
|
gcv.fill_style = FillSolid;
|
||||||
gc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
|
gc = XCreateGC(control->baseDisplay()->getXDisplay(), pixmap,
|
||||||
GCForeground | GCFillStyle, &gcv);
|
GCForeground | GCFillStyle, &gcv);
|
||||||
|
|
||||||
gcv.foreground = texture->getHiColor()->getPixel();
|
gcv.foreground = texture->hiColor().pixel();
|
||||||
hgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
|
hgc = XCreateGC(control->baseDisplay()->getXDisplay(), pixmap,
|
||||||
GCForeground, &gcv);
|
GCForeground, &gcv);
|
||||||
|
|
||||||
gcv.foreground = texture->getLoColor()->getPixel();
|
gcv.foreground = texture->loColor().pixel();
|
||||||
lgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
|
lgc = XCreateGC(control->baseDisplay()->getXDisplay(), pixmap,
|
||||||
GCForeground, &gcv);
|
GCForeground, &gcv);
|
||||||
|
|
||||||
XFillRectangle(control->getBaseDisplay()->getXDisplay(), pixmap, gc, 0, 0,
|
XFillRectangle(control->baseDisplay()->getXDisplay(), pixmap, gc, 0, 0,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
#ifdef INTERLACE
|
#ifdef INTERLACE
|
||||||
if (texture->getTexture() & BImage::INTERLACED) {
|
if (texture->getTexture() & BImage::INTERLACED) {
|
||||||
gcv.foreground = texture->getColorTo()->getPixel();
|
gcv.foreground = texture->colorTo().pixel();
|
||||||
GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
|
GC igc = XCreateGC(control->baseDisplay()->getXDisplay(), pixmap,
|
||||||
GCForeground, &gcv);
|
GCForeground, &gcv);
|
||||||
|
|
||||||
register unsigned int i = 0;
|
register unsigned int i = 0;
|
||||||
for (; i < height; i += 2)
|
for (; i < height; i += 2)
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, igc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, igc,
|
||||||
0, i, width, i);
|
0, i, width, i);
|
||||||
|
|
||||||
XFreeGC(control->getBaseDisplay()->getXDisplay(), igc);
|
XFreeGC(control->baseDisplay()->getXDisplay(), igc);
|
||||||
}
|
}
|
||||||
#endif // INTERLACE
|
#endif // INTERLACE
|
||||||
|
|
||||||
|
|
||||||
if (texture->getTexture() & BImage::BEVEL1) {
|
if (texture->getTexture() & BImage::BEVEL1) {
|
||||||
if (texture->getTexture() & BImage::RAISED) {
|
if (texture->getTexture() & BImage::RAISED) {
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
0, height - 1, width - 1, height - 1);
|
0, height - 1, width - 1, height - 1);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
width - 1, height - 1, width - 1, 0);
|
width - 1, height - 1, width - 1, 0);
|
||||||
|
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
0, 0, width - 1, 0);
|
0, 0, width - 1, 0);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
0, height - 1, 0, 0);
|
0, height - 1, 0, 0);
|
||||||
} else if (texture->getTexture() & BImage::SUNKEN) {
|
} else if (texture->getTexture() & BImage::SUNKEN) {
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
0, height - 1, width - 1, height - 1);
|
0, height - 1, width - 1, height - 1);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
width - 1, height - 1, width - 1, 0);
|
width - 1, height - 1, width - 1, 0);
|
||||||
|
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
0, 0, width - 1, 0);
|
0, 0, width - 1, 0);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
0, height - 1, 0, 0);
|
0, height - 1, 0, 0);
|
||||||
}
|
}
|
||||||
} else if (texture->getTexture() & BImage::BEVEL2) {
|
} else if (texture->getTexture() & BImage::BEVEL2) {
|
||||||
if (texture->getTexture() & BImage::RAISED) {
|
if (texture->getTexture() & BImage::RAISED) {
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
1, height - 3, width - 3, height - 3);
|
1, height - 3, width - 3, height - 3);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
width - 3, height - 3, width - 3, 1);
|
width - 3, height - 3, width - 3, 1);
|
||||||
|
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
1, 1, width - 3, 1);
|
1, 1, width - 3, 1);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
1, height - 3, 1, 1);
|
1, height - 3, 1, 1);
|
||||||
} else if (texture->getTexture() & BImage::SUNKEN) {
|
} else if (texture->getTexture() & BImage::SUNKEN) {
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
1, height - 3, width - 3, height - 3);
|
1, height - 3, width - 3, height - 3);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
|
||||||
width - 3, height - 3, width - 3, 1);
|
width - 3, height - 3, width - 3, 1);
|
||||||
|
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
1, 1, width - 3, 1);
|
1, 1, width - 3, 1);
|
||||||
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
|
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,
|
||||||
1, height - 3, 1, 1);
|
1, height - 3, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XFreeGC(control->getBaseDisplay()->getXDisplay(), gc);
|
XFreeGC(control->baseDisplay()->getXDisplay(), gc);
|
||||||
XFreeGC(control->getBaseDisplay()->getXDisplay(), hgc);
|
XFreeGC(control->baseDisplay()->getXDisplay(), hgc);
|
||||||
XFreeGC(control->getBaseDisplay()->getXDisplay(), lgc);
|
XFreeGC(control->baseDisplay()->getXDisplay(), lgc);
|
||||||
|
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
@ -236,13 +236,13 @@ Pixmap BImage::render_gradient(BTexture *texture) {
|
||||||
#endif // INTERLACE
|
#endif // INTERLACE
|
||||||
|
|
||||||
if (texture->getTexture() & BImage::SUNKEN) {
|
if (texture->getTexture() & BImage::SUNKEN) {
|
||||||
from = texture->getColorTo();
|
from = &(texture->colorTo());
|
||||||
to = texture->getColor();
|
to = &(texture->color());
|
||||||
|
|
||||||
if (! (texture->getTexture() & BImage::INVERT)) inverted = 1;
|
if (! (texture->getTexture() & BImage::INVERT)) inverted = 1;
|
||||||
} else {
|
} else {
|
||||||
from = texture->getColor();
|
from = &(texture->color());
|
||||||
to = texture->getColorTo();
|
to = &(texture->colorTo());
|
||||||
|
|
||||||
if (texture->getTexture() & BImage::INVERT) inverted = 1;
|
if (texture->getTexture() & BImage::INVERT) inverted = 1;
|
||||||
}
|
}
|
||||||
|
@ -273,8 +273,8 @@ Pixmap BImage::render_gradient(BTexture *texture) {
|
||||||
XImage *BImage::renderXImage(void) {
|
XImage *BImage::renderXImage(void) {
|
||||||
I18n *i18n = I18n::instance();
|
I18n *i18n = I18n::instance();
|
||||||
XImage *image =
|
XImage *image =
|
||||||
XCreateImage(control->getBaseDisplay()->getXDisplay(),
|
XCreateImage(control->baseDisplay()->getXDisplay(),
|
||||||
control->getVisual(), control->getDepth(), ZPixmap, 0, 0,
|
control->visual(), control->depth(), ZPixmap, 0, 0,
|
||||||
width, height, 32, 0);
|
width, height, 32, 0);
|
||||||
|
|
||||||
if (! image) {
|
if (! image) {
|
||||||
|
@ -316,7 +316,7 @@ XImage *BImage::renderXImage(void) {
|
||||||
{ 63, 31, 55, 23, 61, 29, 53, 21 } };
|
{ 63, 31, 55, 23, 61, 29, 53, 21 } };
|
||||||
#endif // ORDEREDPSEUDO
|
#endif // ORDEREDPSEUDO
|
||||||
|
|
||||||
switch (control->getVisual()->c_class) {
|
switch (control->visual()->c_class) {
|
||||||
case TrueColor:
|
case TrueColor:
|
||||||
// algorithm: ordered dithering... many many thanks to rasterman
|
// algorithm: ordered dithering... many many thanks to rasterman
|
||||||
// (raster@rasterman.com) for telling me about this... portions of this
|
// (raster@rasterman.com) for telling me about this... portions of this
|
||||||
|
@ -403,7 +403,7 @@ XImage *BImage::renderXImage(void) {
|
||||||
*ngerr = new short[width + 2],
|
*ngerr = new short[width + 2],
|
||||||
*nberr = new short[width + 2];
|
*nberr = new short[width + 2];
|
||||||
int rr, gg, bb, rer, ger, ber;
|
int rr, gg, bb, rer, ger, ber;
|
||||||
int dd = 255 / control->getColorsPerChannel();
|
int dd = 255 / control->colorsPerChannel();
|
||||||
|
|
||||||
for (x = 0; x < width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
*(rerr + x) = *(red + x);
|
*(rerr + x) = *(red + x);
|
||||||
|
@ -564,7 +564,7 @@ XImage *BImage::renderXImage(void) {
|
||||||
return (XImage *) 0;
|
return (XImage *) 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (control->getVisual()->c_class) {
|
switch (control->visual()->c_class) {
|
||||||
case StaticColor:
|
case StaticColor:
|
||||||
case PseudoColor:
|
case PseudoColor:
|
||||||
for (y = 0, offset = 0; y < height; y++) {
|
for (y = 0, offset = 0; y < height; y++) {
|
||||||
|
@ -676,8 +676,8 @@ XImage *BImage::renderXImage(void) {
|
||||||
Pixmap BImage::renderPixmap(void) {
|
Pixmap BImage::renderPixmap(void) {
|
||||||
I18n *i18n = I18n::instance();
|
I18n *i18n = I18n::instance();
|
||||||
Pixmap pixmap =
|
Pixmap pixmap =
|
||||||
XCreatePixmap(control->getBaseDisplay()->getXDisplay(),
|
XCreatePixmap(control->baseDisplay()->getXDisplay(),
|
||||||
control->getDrawable(), width, height, control->getDepth());
|
control->drawable(), width, height, control->depth());
|
||||||
|
|
||||||
if (pixmap == None) {
|
if (pixmap == None) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -690,16 +690,16 @@ Pixmap BImage::renderPixmap(void) {
|
||||||
XImage *image = renderXImage();
|
XImage *image = renderXImage();
|
||||||
|
|
||||||
if (! image) {
|
if (! image) {
|
||||||
XFreePixmap(control->getBaseDisplay()->getXDisplay(), pixmap);
|
XFreePixmap(control->baseDisplay()->getXDisplay(), pixmap);
|
||||||
return None;
|
return None;
|
||||||
} else if (! image->data) {
|
} else if (! image->data) {
|
||||||
XDestroyImage(image);
|
XDestroyImage(image);
|
||||||
XFreePixmap(control->getBaseDisplay()->getXDisplay(), pixmap);
|
XFreePixmap(control->baseDisplay()->getXDisplay(), pixmap);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
XPutImage(control->getBaseDisplay()->getXDisplay(), pixmap,
|
XPutImage(control->baseDisplay()->getXDisplay(), pixmap,
|
||||||
DefaultGC(control->getBaseDisplay()->getXDisplay(),
|
DefaultGC(control->baseDisplay()->getXDisplay(),
|
||||||
control->getScreenInfo()->getScreenNumber()),
|
control->getScreenInfo()->getScreenNumber()),
|
||||||
image, 0, 0, 0, 0, width, height);
|
image, 0, 0, 0, 0, width, height);
|
||||||
|
|
||||||
|
@ -951,22 +951,22 @@ void BImage::invert(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BImage::dgradient(void) {
|
void BImage::dgradient() {
|
||||||
// diagonal gradient code was written by Mike Cole <mike@mydot.com>
|
// diagonal gradient code was written by Mike Cole <mike@mydot.com>
|
||||||
// modified for interlacing by Brad Hughes
|
// modified for interlacing by Brad Hughes
|
||||||
|
|
||||||
float drx, dgx, dbx, dry, dgy, dby, yr = 0.0, yg = 0.0, yb = 0.0,
|
float drx, dgx, dbx, dry, dgy, dby, yr = 0.0, yg = 0.0, yb = 0.0,
|
||||||
xr = (float) from->getRed(),
|
xr = (float) from->red(),
|
||||||
xg = (float) from->getGreen(),
|
xg = (float) from->green(),
|
||||||
xb = (float) from->getBlue();
|
xb = (float) from->blue();
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int w = width * 2, h = height * 2, *xt = xtable, *yt = ytable;
|
unsigned int w = width * 2, h = height * 2, *xt = xtable, *yt = ytable;
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
// Create X table
|
// Create X table
|
||||||
drx /= w;
|
drx /= w;
|
||||||
|
@ -1061,16 +1061,16 @@ void BImage::dgradient(void) {
|
||||||
|
|
||||||
void BImage::hgradient(void) {
|
void BImage::hgradient(void) {
|
||||||
float drx, dgx, dbx,
|
float drx, dgx, dbx,
|
||||||
xr = (float) from->getRed(),
|
xr = (float) from->red(),
|
||||||
xg = (float) from->getGreen(),
|
xg = (float) from->green(),
|
||||||
xb = (float) from->getBlue();
|
xb = (float) from->blue();
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
drx = (float) (to->getRed() - from->getRed());
|
drx = (float) (to->red() - from->red());
|
||||||
dgx = (float) (to->getGreen() - from->getGreen());
|
dgx = (float) (to->green() - from->green());
|
||||||
dbx = (float) (to->getBlue() - from->getBlue());
|
dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
drx /= width;
|
drx /= width;
|
||||||
dgx /= width;
|
dgx /= width;
|
||||||
|
@ -1160,16 +1160,16 @@ void BImage::hgradient(void) {
|
||||||
|
|
||||||
void BImage::vgradient(void) {
|
void BImage::vgradient(void) {
|
||||||
float dry, dgy, dby,
|
float dry, dgy, dby,
|
||||||
yr = (float) from->getRed(),
|
yr = (float) from->red(),
|
||||||
yg = (float) from->getGreen(),
|
yg = (float) from->green(),
|
||||||
yb = (float) from->getBlue();
|
yb = (float) from->blue();
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
|
|
||||||
register unsigned int y;
|
register unsigned int y;
|
||||||
|
|
||||||
dry = (float) (to->getRed() - from->getRed());
|
dry = (float) (to->red() - from->red());
|
||||||
dgy = (float) (to->getGreen() - from->getGreen());
|
dgy = (float) (to->green() - from->green());
|
||||||
dby = (float) (to->getBlue() - from->getBlue());
|
dby = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
dry /= height;
|
dry /= height;
|
||||||
dgy /= height;
|
dgy /= height;
|
||||||
|
@ -1247,14 +1247,14 @@ void BImage::pgradient(void) {
|
||||||
xr, xg, xb;
|
xr, xg, xb;
|
||||||
int rsign, gsign, bsign;
|
int rsign, gsign, bsign;
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int tr = to->getRed(), tg = to->getGreen(), tb = to->getBlue(),
|
unsigned int tr = to->red(), tg = to->green(), tb = to->blue(),
|
||||||
*xt = xtable, *yt = ytable;
|
*xt = xtable, *yt = ytable;
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
rsign = (drx < 0) ? -1 : 1;
|
rsign = (drx < 0) ? -1 : 1;
|
||||||
gsign = (dgx < 0) ? -1 : 1;
|
gsign = (dgx < 0) ? -1 : 1;
|
||||||
|
@ -1363,14 +1363,14 @@ void BImage::rgradient(void) {
|
||||||
float drx, dgx, dbx, dry, dgy, dby, xr, xg, xb, yr, yg, yb;
|
float drx, dgx, dbx, dry, dgy, dby, xr, xg, xb, yr, yg, yb;
|
||||||
int rsign, gsign, bsign;
|
int rsign, gsign, bsign;
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int tr = to->getRed(), tg = to->getGreen(), tb = to->getBlue(),
|
unsigned int tr = to->red(), tg = to->green(), tb = to->blue(),
|
||||||
*xt = xtable, *yt = ytable;
|
*xt = xtable, *yt = ytable;
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
rsign = (drx < 0) ? -2 : 2;
|
rsign = (drx < 0) ? -2 : 2;
|
||||||
gsign = (dgx < 0) ? -2 : 2;
|
gsign = (dgx < 0) ? -2 : 2;
|
||||||
|
@ -1480,15 +1480,15 @@ void BImage::egradient(void) {
|
||||||
int rsign, gsign, bsign;
|
int rsign, gsign, bsign;
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int *xt = xtable, *yt = ytable,
|
unsigned int *xt = xtable, *yt = ytable,
|
||||||
tr = (unsigned long) to->getRed(),
|
tr = (unsigned long) to->red(),
|
||||||
tg = (unsigned long) to->getGreen(),
|
tg = (unsigned long) to->green(),
|
||||||
tb = (unsigned long) to->getBlue();
|
tb = (unsigned long) to->blue();
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
rsign = (drx < 0) ? -1 : 1;
|
rsign = (drx < 0) ? -1 : 1;
|
||||||
gsign = (dgx < 0) ? -1 : 1;
|
gsign = (dgx < 0) ? -1 : 1;
|
||||||
|
@ -1607,15 +1607,15 @@ void BImage::pcgradient(void) {
|
||||||
int rsign, gsign, bsign;
|
int rsign, gsign, bsign;
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int *xt = xtable, *yt = ytable,
|
unsigned int *xt = xtable, *yt = ytable,
|
||||||
tr = to->getRed(),
|
tr = to->red(),
|
||||||
tg = to->getGreen(),
|
tg = to->green(),
|
||||||
tb = to->getBlue();
|
tb = to->blue();
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
rsign = (drx < 0) ? -2 : 2;
|
rsign = (drx < 0) ? -2 : 2;
|
||||||
gsign = (dgx < 0) ? -2 : 2;
|
gsign = (dgx < 0) ? -2 : 2;
|
||||||
|
@ -1722,17 +1722,17 @@ void BImage::cdgradient(void) {
|
||||||
// adapted from kde sources for Blackbox by Brad Hughes
|
// adapted from kde sources for Blackbox by Brad Hughes
|
||||||
|
|
||||||
float drx, dgx, dbx, dry, dgy, dby, yr = 0.0, yg = 0.0, yb = 0.0,
|
float drx, dgx, dbx, dry, dgy, dby, yr = 0.0, yg = 0.0, yb = 0.0,
|
||||||
xr = (float) from->getRed(),
|
xr = (float) from->red(),
|
||||||
xg = (float) from->getGreen(),
|
xg = (float) from->green(),
|
||||||
xb = (float) from->getBlue();
|
xb = (float) from->blue();
|
||||||
unsigned char *pr = red, *pg = green, *pb = blue;
|
unsigned char *pr = red, *pg = green, *pb = blue;
|
||||||
unsigned int w = width * 2, h = height * 2, *xt, *yt;
|
unsigned int w = width * 2, h = height * 2, *xt, *yt;
|
||||||
|
|
||||||
register unsigned int x, y;
|
register unsigned int x, y;
|
||||||
|
|
||||||
dry = drx = (float) (to->getRed() - from->getRed());
|
dry = drx = (float) (to->red() - from->red());
|
||||||
dgy = dgx = (float) (to->getGreen() - from->getGreen());
|
dgy = dgx = (float) (to->green() - from->green());
|
||||||
dby = dbx = (float) (to->getBlue() - from->getBlue());
|
dby = dbx = (float) (to->blue() - from->blue());
|
||||||
|
|
||||||
// Create X table
|
// Create X table
|
||||||
drx /= w;
|
drx /= w;
|
||||||
|
@ -1825,7 +1825,7 @@ void BImage::cdgradient(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither,
|
||||||
int _cpc, unsigned long cache_timeout,
|
int _cpc, unsigned long cache_timeout,
|
||||||
unsigned long cmax)
|
unsigned long cmax)
|
||||||
#ifdef TIMEDCACHE
|
#ifdef TIMEDCACHE
|
||||||
|
@ -1861,7 +1861,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
int count;
|
int count;
|
||||||
XPixmapFormatValues *pmv = XListPixmapFormats(basedisplay->getXDisplay(),
|
XPixmapFormatValues *pmv = XListPixmapFormats(basedisplay->getXDisplay(),
|
||||||
&count);
|
&count);
|
||||||
colormap = screeninfo->getColormap();
|
m_colormap = screeninfo->colormap();
|
||||||
|
|
||||||
if (pmv) {
|
if (pmv) {
|
||||||
bits_per_pixel = 0;
|
bits_per_pixel = 0;
|
||||||
|
@ -1882,15 +1882,15 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
|
|
||||||
red_offset = green_offset = blue_offset = 0;
|
red_offset = green_offset = blue_offset = 0;
|
||||||
|
|
||||||
switch (getVisual()->c_class) {
|
switch (visual()->c_class) {
|
||||||
case TrueColor:
|
case TrueColor:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// compute color tables
|
// compute color tables
|
||||||
unsigned long red_mask = getVisual()->red_mask,
|
unsigned long red_mask = visual()->red_mask,
|
||||||
green_mask = getVisual()->green_mask,
|
green_mask = visual()->green_mask,
|
||||||
blue_mask = getVisual()->blue_mask;
|
blue_mask = visual()->blue_mask;
|
||||||
|
|
||||||
while (! (red_mask & 1)) { red_offset++; red_mask >>= 1; }
|
while (! (red_mask & 1)) { red_offset++; red_mask >>= 1; }
|
||||||
while (! (green_mask & 1)) { green_offset++; green_mask >>= 1; }
|
while (! (green_mask & 1)) { green_offset++; green_mask >>= 1; }
|
||||||
|
@ -1969,7 +1969,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
basedisplay->grab();
|
basedisplay->grab();
|
||||||
|
|
||||||
for (i = 0; i < ncolors; i++) {
|
for (i = 0; i < ncolors; i++) {
|
||||||
if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) {
|
if (! XAllocColor(basedisplay->getXDisplay(), colormap(), &colors[i])) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n->getMessage(
|
i18n->getMessage(
|
||||||
FBNLS::ImageSet, FBNLS::ImageColorAllocFail,
|
FBNLS::ImageSet, FBNLS::ImageColorAllocFail,
|
||||||
|
@ -1988,7 +1988,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
for (i = 0; i < incolors; i++)
|
for (i = 0; i < incolors; i++)
|
||||||
icolors[i].pixel = i;
|
icolors[i].pixel = i;
|
||||||
|
|
||||||
XQueryColors(basedisplay->getXDisplay(), colormap, icolors, incolors);
|
XQueryColors(basedisplay->getXDisplay(), colormap(), icolors, incolors);
|
||||||
for (i = 0; i < ncolors; i++) {
|
for (i = 0; i < ncolors; i++) {
|
||||||
if (! colors[i].flags) {
|
if (! colors[i].flags) {
|
||||||
unsigned long chk = 0xffffffff, pixel, close = 0;
|
unsigned long chk = 0xffffffff, pixel, close = 0;
|
||||||
|
@ -2010,7 +2010,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
colors[i].green = icolors[close].green;
|
colors[i].green = icolors[close].green;
|
||||||
colors[i].blue = icolors[close].blue;
|
colors[i].blue = icolors[close].blue;
|
||||||
|
|
||||||
if (XAllocColor(basedisplay->getXDisplay(), colormap,
|
if (XAllocColor(basedisplay->getXDisplay(), colormap(),
|
||||||
&colors[i])) {
|
&colors[i])) {
|
||||||
colors[i].flags = DoRed|DoGreen|DoBlue;
|
colors[i].flags = DoRed|DoGreen|DoBlue;
|
||||||
break;
|
break;
|
||||||
|
@ -2027,7 +2027,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
case StaticGray:
|
case StaticGray:
|
||||||
{
|
{
|
||||||
|
|
||||||
if (getVisual()->c_class == StaticGray) {
|
if (visual()->c_class == StaticGray) {
|
||||||
ncolors = 1 << screen_depth;
|
ncolors = 1 << screen_depth;
|
||||||
} else {
|
} else {
|
||||||
ncolors = colors_per_channel * colors_per_channel * colors_per_channel;
|
ncolors = colors_per_channel * colors_per_channel * colors_per_channel;
|
||||||
|
@ -2077,7 +2077,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);;
|
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);;
|
||||||
colors[i].flags = DoRed|DoGreen|DoBlue;
|
colors[i].flags = DoRed|DoGreen|DoBlue;
|
||||||
|
|
||||||
if (! XAllocColor(basedisplay->getXDisplay(), colormap,
|
if (! XAllocColor(basedisplay->getXDisplay(), colormap(),
|
||||||
&colors[i])) {
|
&colors[i])) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n->
|
i18n->
|
||||||
|
@ -2099,7 +2099,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
for (i = 0; i < incolors; i++)
|
for (i = 0; i < incolors; i++)
|
||||||
icolors[i].pixel = i;
|
icolors[i].pixel = i;
|
||||||
|
|
||||||
XQueryColors(basedisplay->getXDisplay(), colormap, icolors, incolors);
|
XQueryColors(basedisplay->getXDisplay(), colormap(), icolors, incolors);
|
||||||
for (i = 0; i < ncolors; i++) {
|
for (i = 0; i < ncolors; i++) {
|
||||||
if (! colors[i].flags) {
|
if (! colors[i].flags) {
|
||||||
unsigned long chk = 0xffffffff, pixel, close = 0;
|
unsigned long chk = 0xffffffff, pixel, close = 0;
|
||||||
|
@ -2121,7 +2121,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
colors[i].green = icolors[close].green;
|
colors[i].green = icolors[close].green;
|
||||||
colors[i].blue = icolors[close].blue;
|
colors[i].blue = icolors[close].blue;
|
||||||
|
|
||||||
if (XAllocColor(basedisplay->getXDisplay(), colormap,
|
if (XAllocColor(basedisplay->getXDisplay(), colormap(),
|
||||||
&colors[i])) {
|
&colors[i])) {
|
||||||
colors[i].flags = DoRed|DoGreen|DoBlue;
|
colors[i].flags = DoRed|DoGreen|DoBlue;
|
||||||
break;
|
break;
|
||||||
|
@ -2140,7 +2140,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
|
||||||
getMessage(
|
getMessage(
|
||||||
FBNLS::ImageSet, FBNLS::ImageUnsupVisual,
|
FBNLS::ImageSet, FBNLS::ImageUnsupVisual,
|
||||||
"BImageControl::BImageControl: unsupported visual %d\n"),
|
"BImageControl::BImageControl: unsupported visual %d\n"),
|
||||||
getVisual()->c_class);
|
visual()->c_class);
|
||||||
throw static_cast<int>(1); //throw error code 1
|
throw static_cast<int>(1); //throw error code 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2167,7 +2167,7 @@ BImageControl::~BImageControl(void) {
|
||||||
for (i = 0; i < ncolors; i++)
|
for (i = 0; i < ncolors; i++)
|
||||||
*(pixels + i) = (*(colors + i)).pixel;
|
*(pixels + i) = (*(colors + i)).pixel;
|
||||||
|
|
||||||
XFreeColors(basedisplay->getXDisplay(), colormap, pixels, ncolors, 0);
|
XFreeColors(basedisplay->getXDisplay(), colormap(), pixels, ncolors, 0);
|
||||||
|
|
||||||
delete [] colors;
|
delete [] colors;
|
||||||
}
|
}
|
||||||
|
@ -2200,9 +2200,9 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height,
|
||||||
if (((*it)->width == width) &&
|
if (((*it)->width == width) &&
|
||||||
((*it)->height == height) &&
|
((*it)->height == height) &&
|
||||||
((*it)->texture == texture) &&
|
((*it)->texture == texture) &&
|
||||||
((*it)->pixel1 == c1->getPixel())) {
|
((*it)->pixel1 == c1->pixel())) {
|
||||||
if (texture & BImage::GRADIENT) {
|
if (texture & BImage::GRADIENT) {
|
||||||
if ((*it)->pixel2 == c2->getPixel()) {
|
if ((*it)->pixel2 == c2->pixel()) {
|
||||||
(*it)->count++;
|
(*it)->count++;
|
||||||
return (*it)->pixmap;
|
return (*it)->pixmap;
|
||||||
}
|
}
|
||||||
|
@ -2222,7 +2222,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
|
||||||
if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative;
|
if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative;
|
||||||
|
|
||||||
Pixmap pixmap = searchCache(width, height, texture->getTexture(),
|
Pixmap pixmap = searchCache(width, height, texture->getTexture(),
|
||||||
texture->getColor(), texture->getColorTo());
|
&texture->color(), &texture->colorTo());
|
||||||
if (pixmap) return pixmap;
|
if (pixmap) return pixmap;
|
||||||
|
|
||||||
BImage image(this, width, height);
|
BImage image(this, width, height);
|
||||||
|
@ -2236,10 +2236,10 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
|
||||||
tmp->height = height;
|
tmp->height = height;
|
||||||
tmp->count = 1;
|
tmp->count = 1;
|
||||||
tmp->texture = texture->getTexture();
|
tmp->texture = texture->getTexture();
|
||||||
tmp->pixel1 = texture->getColor()->getPixel();
|
tmp->pixel1 = texture->color().pixel();
|
||||||
|
|
||||||
if (texture->getTexture() & BImage::GRADIENT)
|
if (texture->getTexture() & BImage::GRADIENT)
|
||||||
tmp->pixel2 = texture->getColorTo()->getPixel();
|
tmp->pixel2 = texture->colorTo().pixel();
|
||||||
else
|
else
|
||||||
tmp->pixel2 = 0l;
|
tmp->pixel2 = 0l;
|
||||||
|
|
||||||
|
@ -2287,18 +2287,18 @@ void BImageControl::removeImage(Pixmap pixmap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long BImageControl::getColor(const char *colorname,
|
unsigned long BImageControl::color(const char *colorname,
|
||||||
unsigned char *r, unsigned char *g,
|
unsigned char *r, unsigned char *g,
|
||||||
unsigned char *b)
|
unsigned char *b)
|
||||||
{
|
{
|
||||||
XColor color;
|
XColor color;
|
||||||
color.pixel = 0;
|
color.pixel = 0;
|
||||||
|
|
||||||
if (! XParseColor(basedisplay->getXDisplay(), colormap, colorname, &color))
|
if (! XParseColor(basedisplay->getXDisplay(), colormap(), colorname, &color))
|
||||||
fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n",
|
fprintf(stderr, "BImageControl::color: color parse error: \"%s\"\n",
|
||||||
colorname);
|
colorname);
|
||||||
else if (! XAllocColor(basedisplay->getXDisplay(), colormap, &color))
|
else if (! XAllocColor(basedisplay->getXDisplay(), colormap(), &color))
|
||||||
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n",
|
fprintf(stderr, "BImageControl::color: color alloc error: \"%s\"\n",
|
||||||
colorname);
|
colorname);
|
||||||
|
|
||||||
if (color.red == 65535) *r = 0xff;
|
if (color.red == 65535) *r = 0xff;
|
||||||
|
@ -2312,16 +2312,16 @@ unsigned long BImageControl::getColor(const char *colorname,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long BImageControl::getColor(const char *colorname) {
|
unsigned long BImageControl::color(const char *colorname) {
|
||||||
XColor color;
|
XColor color;
|
||||||
color.pixel = 0;
|
color.pixel = 0;
|
||||||
|
|
||||||
if (! XParseColor(basedisplay->getXDisplay(), colormap, colorname, &color))
|
if (! XParseColor(basedisplay->getXDisplay(), colormap(), colorname, &color))
|
||||||
fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n",
|
fprintf(stderr, "BImageControl::color: color parse error: \"%s\"\n",
|
||||||
colorname);
|
colorname);
|
||||||
else {
|
else {
|
||||||
if (! XAllocColor(basedisplay->getXDisplay(), colormap, &color))
|
if (! XAllocColor(basedisplay->getXDisplay(), colormap(), &color))
|
||||||
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n",
|
fprintf(stderr, "BImageControl::color: color alloc error: \"%s\"\n",
|
||||||
colorname);
|
colorname);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%s(%d) Allocated color:%s", __FILE__, __LINE__, colorname);
|
fprintf(stderr, "%s(%d) Allocated color:%s", __FILE__, __LINE__, colorname);
|
||||||
|
@ -2330,7 +2330,7 @@ unsigned long BImageControl::getColor(const char *colorname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt,
|
void BImageControl::colorTables(unsigned char **rmt, unsigned char **gmt,
|
||||||
unsigned char **bmt,
|
unsigned char **bmt,
|
||||||
int *roff, int *goff, int *boff,
|
int *roff, int *goff, int *boff,
|
||||||
int *rbit, int *gbit, int *bbit) {
|
int *rbit, int *gbit, int *bbit) {
|
||||||
|
@ -2395,11 +2395,11 @@ void BImageControl::installRootColormap(void) {
|
||||||
|
|
||||||
if (cmaps) {
|
if (cmaps) {
|
||||||
for (i = 0; i < ncmap; i++)
|
for (i = 0; i < ncmap; i++)
|
||||||
if (*(cmaps + i) == colormap)
|
if (*(cmaps + i) == colormap())
|
||||||
install = False;
|
install = False;
|
||||||
|
|
||||||
if (install)
|
if (install)
|
||||||
XInstallColormap(basedisplay->getXDisplay(), colormap);
|
XInstallColormap(basedisplay->getXDisplay(), colormap());
|
||||||
|
|
||||||
XFree(cmaps);
|
XFree(cmaps);
|
||||||
}
|
}
|
||||||
|
@ -2497,30 +2497,30 @@ void BImageControl::parseTexture(BTexture *texture, char *t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BImageControl::parseColor(BColor *color, char *c) {
|
void BImageControl::parseColor(BColor *col, char *c) {
|
||||||
if (! color) return;
|
if (!col) return;
|
||||||
|
|
||||||
if (color->isAllocated()) {
|
if (col->isAllocated()) {
|
||||||
unsigned long pixel = color->getPixel();
|
unsigned long pixel = col->pixel();
|
||||||
|
|
||||||
XFreeColors(basedisplay->getXDisplay(), colormap, &pixel, 1, 0);
|
XFreeColors(basedisplay->getXDisplay(), colormap(), &pixel, 1, 0);
|
||||||
|
|
||||||
color->setPixel(0l);
|
col->setPixel(0l);
|
||||||
color->setRGB(0, 0, 0);
|
col->setRGB(0, 0, 0);
|
||||||
color->setAllocated(False);
|
col->setAllocated(False);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c) {
|
if (c) {
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
|
|
||||||
color->setPixel(getColor(c, &r, &g, &b));
|
col->setPixel(color(c, &r, &g, &b));
|
||||||
color->setRGB(r, g, b);
|
col->setRGB(r, g, b);
|
||||||
color->setAllocated(True);
|
col->setAllocated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BImageControl::timeout(void) {
|
void BImageControl::timeout() {
|
||||||
CacheList::iterator it = cache.begin();
|
CacheList::iterator it = cache.begin();
|
||||||
CacheList::iterator it_end = cache.end();
|
CacheList::iterator it_end = cache.end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
|
|
97
src/Image.hh
97
src/Image.hh
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Image.hh,v 1.7 2002/05/17 10:59:30 fluxgen Exp $
|
// $Id: Image.hh,v 1.8 2002/07/19 20:33:15 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef IMAGE_HH
|
#ifndef IMAGE_HH
|
||||||
#define IMAGE_HH
|
#define IMAGE_HH
|
||||||
|
@ -40,51 +40,51 @@ class BImageControl;
|
||||||
|
|
||||||
|
|
||||||
class BColor {
|
class BColor {
|
||||||
private:
|
|
||||||
int allocated;
|
|
||||||
unsigned char red, green, blue;
|
|
||||||
unsigned long pixel;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BColor(char r = 0, char g = 0, char b = 0)
|
BColor(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0):
|
||||||
{ red = r; green = g; blue = b; pixel = 0; allocated = 0; }
|
m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false) { }
|
||||||
|
|
||||||
inline int isAllocated(void) const { return allocated; }
|
inline int isAllocated() const { return m_allocated; }
|
||||||
|
|
||||||
inline unsigned char getRed(void) const { return red; }
|
inline unsigned char red() const { return m_red; }
|
||||||
inline unsigned char getGreen(void) const { return green; }
|
inline unsigned char green() const { return m_green; }
|
||||||
inline unsigned char getBlue(void) const { return blue; }
|
inline unsigned char blue() const { return m_blue; }
|
||||||
|
|
||||||
inline unsigned long getPixel(void) const { return pixel; }
|
inline unsigned long pixel() const { return m_pixel; }
|
||||||
|
|
||||||
inline void setAllocated(int a) { allocated = a; }
|
inline void setAllocated(bool a) { m_allocated = a; }
|
||||||
inline void setRGB(char r, char g, char b) { red = r; green = g; blue = b; }
|
inline void setRGB(char red, char green, char blue) { m_red = red; m_green = green; m_blue = blue; }
|
||||||
inline void setPixel(unsigned long p) { pixel = p; }
|
inline void setPixel(unsigned long pixel) { m_pixel = pixel; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned char m_red, m_green, m_blue;
|
||||||
|
unsigned long m_pixel;
|
||||||
|
bool m_allocated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BTexture {
|
class BTexture {
|
||||||
private:
|
|
||||||
BColor color, colorTo, hiColor, loColor;
|
|
||||||
unsigned long texture;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BTexture(void):texture(0) { }
|
BTexture():m_texture(0) { }
|
||||||
|
|
||||||
inline const BColor *getColor(void) const { return &color; }
|
inline const BColor &color() const { return m_color; }
|
||||||
inline const BColor *getColorTo(void) const { return &colorTo; }
|
inline const BColor &colorTo() const { return m_color_to; }
|
||||||
inline const BColor *getHiColor(void) const { return &hiColor; }
|
inline const BColor &hiColor() const { return m_hicolor; }
|
||||||
inline const BColor *getLoColor(void) const { return &loColor; }
|
inline const BColor &loColor() const { return m_locolor; }
|
||||||
|
|
||||||
inline BColor *getColor(void) { return &color; }
|
inline BColor &color() { return m_color; }
|
||||||
inline BColor *getColorTo(void) { return &colorTo; }
|
inline BColor &colorTo() { return m_color_to; }
|
||||||
inline BColor *getHiColor(void) { return &hiColor; }
|
inline BColor &hiColor() { return m_hicolor; }
|
||||||
inline BColor *getLoColor(void) { return &loColor; }
|
inline BColor &loColor() { return m_locolor; }
|
||||||
|
|
||||||
inline unsigned long getTexture(void) const { return texture; }
|
inline unsigned long getTexture() const { return m_texture; }
|
||||||
|
|
||||||
inline void setTexture(unsigned long t) { texture = t; }
|
inline void setTexture(unsigned long t) { m_texture = t; }
|
||||||
inline void addTexture(unsigned long t) { texture |= t; }
|
inline void addTexture(unsigned long t) { m_texture |= t; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
BColor m_color, m_color_to, m_hicolor, m_locolor;
|
||||||
|
unsigned long m_texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,35 +156,34 @@ public:
|
||||||
|
|
||||||
class BImageControl : public TimeoutHandler {
|
class BImageControl : public TimeoutHandler {
|
||||||
public:
|
public:
|
||||||
BImageControl(BaseDisplay *, ScreenInfo *, Bool = False, int = 4,
|
BImageControl(BaseDisplay *disp, ScreenInfo *screen, bool = False, int = 4,
|
||||||
unsigned long = 300000l, unsigned long = 200l);
|
unsigned long = 300000l, unsigned long = 200l);
|
||||||
virtual ~BImageControl();
|
virtual ~BImageControl();
|
||||||
|
|
||||||
inline BaseDisplay *getBaseDisplay(void) { return basedisplay; }
|
inline BaseDisplay *baseDisplay() { return basedisplay; }
|
||||||
|
|
||||||
inline bool doDither(void) { return dither; }
|
inline bool doDither() { return dither; }
|
||||||
inline const Colormap &getColormap(void) const { return colormap; }
|
inline const Colormap &colormap() const { return m_colormap; }
|
||||||
inline ScreenInfo *getScreenInfo(void) { return screeninfo; }
|
inline ScreenInfo *getScreenInfo() { return screeninfo; }
|
||||||
|
|
||||||
inline const Window &getDrawable(void) const { return window; }
|
inline const Window &drawable() const { return window; }
|
||||||
|
|
||||||
inline Visual *getVisual(void) { return screeninfo->getVisual(); }
|
inline Visual *visual() { return screeninfo->getVisual(); }
|
||||||
|
|
||||||
inline int getBitsPerPixel(void) const { return bits_per_pixel; }
|
inline int bitsPerPixel() const { return bits_per_pixel; }
|
||||||
inline int getDepth(void) const { return screen_depth; }
|
inline int depth() const { return screen_depth; }
|
||||||
inline int getColorsPerChannel(void) const
|
inline int colorsPerChannel(void) const { return colors_per_channel; }
|
||||||
{ return colors_per_channel; }
|
|
||||||
|
|
||||||
unsigned long getColor(const char *);
|
unsigned long color(const char *colorname);
|
||||||
unsigned long getColor(const char *, unsigned char *, unsigned char *,
|
unsigned long color(const char *, unsigned char *, unsigned char *,
|
||||||
unsigned char *);
|
unsigned char *);
|
||||||
unsigned long getSqrt(unsigned int);
|
unsigned long getSqrt(unsigned int);
|
||||||
|
|
||||||
Pixmap renderImage(unsigned int, unsigned int, BTexture *);
|
Pixmap renderImage(unsigned int, unsigned int, BTexture *);
|
||||||
|
|
||||||
void installRootColormap(void);
|
void installRootColormap();
|
||||||
void removeImage(Pixmap);
|
void removeImage(Pixmap thepix);
|
||||||
void getColorTables(unsigned char **, unsigned char **, unsigned char **,
|
void colorTables(unsigned char **, unsigned char **, unsigned char **,
|
||||||
int *, int *, int *, int *, int *, int *);
|
int *, int *, int *, int *, int *, int *);
|
||||||
void getXColorTable(XColor **, int *);
|
void getXColorTable(XColor **, int *);
|
||||||
void getGradientBuffers(unsigned int, unsigned int,
|
void getGradientBuffers(unsigned int, unsigned int,
|
||||||
|
@ -204,7 +203,7 @@ private:
|
||||||
BTimer timer;
|
BTimer timer;
|
||||||
#endif // TIMEDCACHE
|
#endif // TIMEDCACHE
|
||||||
|
|
||||||
Colormap colormap;
|
Colormap m_colormap;
|
||||||
|
|
||||||
Window window;
|
Window window;
|
||||||
XColor *colors;
|
XColor *colors;
|
||||||
|
|
Loading…
Reference in a new issue