Lines 121-131
Link Here
|
121 |
|
121 |
|
122 |
Pixmap BImage::render_solid(BTexture *texture) { |
122 |
Pixmap BImage::render_solid(BTexture *texture) { |
123 |
Pixmap pixmap = XCreatePixmap(control->getBaseDisplay()->getXDisplay(), |
123 |
Pixmap pixmap = XCreatePixmap(control->getBaseDisplay()->getXDisplay(), |
124 |
control->getDrawable(), width, |
124 |
control->getDrawable(), width, |
125 |
height, control->getDepth()); |
125 |
height, control->getDepth()); |
126 |
if (pixmap == None) { |
126 |
if (pixmap == None) { |
127 |
fprintf(stderr, |
127 |
fprintf(stderr, |
128 |
"BImage::render_solid: error creating pixmap\n"); |
128 |
"BImage::render_solid: error creating pixmap\n"); |
129 |
return None; |
129 |
return None; |
130 |
} |
130 |
} |
131 |
|
131 |
|
Lines 135-163
Link Here
|
135 |
gcv.foreground = texture->getColor()->getPixel(); |
135 |
gcv.foreground = texture->getColor()->getPixel(); |
136 |
gcv.fill_style = FillSolid; |
136 |
gcv.fill_style = FillSolid; |
137 |
gc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
137 |
gc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
138 |
GCForeground | GCFillStyle, &gcv); |
138 |
GCForeground | GCFillStyle, &gcv); |
139 |
|
139 |
|
140 |
gcv.foreground = texture->getHiColor()->getPixel(); |
140 |
gcv.foreground = texture->getHiColor()->getPixel(); |
141 |
hgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
141 |
hgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
142 |
GCForeground, &gcv); |
142 |
GCForeground, &gcv); |
143 |
|
143 |
|
144 |
gcv.foreground = texture->getLoColor()->getPixel(); |
144 |
gcv.foreground = texture->getLoColor()->getPixel(); |
145 |
lgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
145 |
lgc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
146 |
GCForeground, &gcv); |
146 |
GCForeground, &gcv); |
147 |
|
147 |
|
148 |
XFillRectangle(control->getBaseDisplay()->getXDisplay(), pixmap, gc, 0, 0, |
148 |
XFillRectangle(control->getBaseDisplay()->getXDisplay(), pixmap, gc, 0, 0, |
149 |
width, height); |
149 |
width, height); |
150 |
|
150 |
|
151 |
#ifdef INTERLACE |
151 |
#ifdef INTERLACE |
152 |
if (texture->getTexture() & BImage_Interlaced) { |
152 |
if (texture->getTexture() & BImage_Interlaced) { |
153 |
gcv.foreground = texture->getColorTo()->getPixel(); |
153 |
gcv.foreground = texture->getColorTo()->getPixel(); |
154 |
GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
154 |
GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, |
155 |
GCForeground, &gcv); |
155 |
GCForeground, &gcv); |
156 |
|
156 |
|
157 |
register unsigned int i = 0; |
157 |
register unsigned int i = 0; |
158 |
for (; i < height; i += 2) |
158 |
for (; i < height; i += 2) |
159 |
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, igc, |
159 |
XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, igc, |
160 |
0, i, width, i); |
160 |
0, i, width, i); |
161 |
|
161 |
|
162 |
XFreeGC(control->getBaseDisplay()->getXDisplay(), igc); |
162 |
XFreeGC(control->getBaseDisplay()->getXDisplay(), igc); |
163 |
} |
163 |
} |
Lines 268-274
Link Here
|
268 |
|
268 |
|
269 |
if (! image) { |
269 |
if (! image) { |
270 |
fprintf(stderr, |
270 |
fprintf(stderr, |
271 |
"BImage::renderXImage: error creating XImage\n"); |
271 |
"BImage::renderXImage: error creating XImage\n"); |
272 |
return (XImage *) 0; |
272 |
return (XImage *) 0; |
273 |
} |
273 |
} |
274 |
|
274 |
|
Lines 306-314
Link Here
|
306 |
// (raster@rasterman.com) for telling me about this... portions of this |
306 |
// (raster@rasterman.com) for telling me about this... portions of this |
307 |
// code is based off of his code in Imlib |
307 |
// code is based off of his code in Imlib |
308 |
for (y = 0, offset = 0; y < height; y++) { |
308 |
for (y = 0, offset = 0; y < height; y++) { |
309 |
dithy = y & 0x3; |
309 |
dithy = y & 0x3; |
310 |
|
310 |
|
311 |
for (x = 0; x < width; x++, offset++) { |
311 |
for (x = 0; x < width; x++, offset++) { |
312 |
dithx = x & 0x3; |
312 |
dithx = x & 0x3; |
313 |
r = red[offset]; |
313 |
r = red[offset]; |
314 |
g = green[offset]; |
314 |
g = green[offset]; |
Lines 326-349
Link Here
|
326 |
if ((dither4[dithy][dithx] < eg) && (g < green_table[255])) g++; |
326 |
if ((dither4[dithy][dithx] < eg) && (g < green_table[255])) g++; |
327 |
if ((dither4[dithy][dithx] < eb) && (b < blue_table[255])) b++; |
327 |
if ((dither4[dithy][dithx] < eb) && (b < blue_table[255])) b++; |
328 |
|
328 |
|
329 |
pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); |
329 |
pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); |
330 |
|
330 |
|
331 |
switch (o) { |
331 |
switch (o) { |
332 |
case 16: // 16bpp LSB |
332 |
case 16: // 16bpp LSB |
333 |
*pixel_data++ = pixel; |
333 |
*pixel_data++ = pixel; |
334 |
*pixel_data++ = pixel >> 8; |
334 |
*pixel_data++ = pixel >> 8; |
335 |
break; |
335 |
break; |
336 |
|
336 |
|
337 |
case 17: // 16bpp MSB |
337 |
case 17: // 16bpp MSB |
338 |
*pixel_data++ = pixel >> 8; |
338 |
*pixel_data++ = pixel >> 8; |
339 |
*pixel_data++ = pixel; |
339 |
*pixel_data++ = pixel; |
340 |
break; |
340 |
break; |
341 |
|
341 |
|
342 |
case 24: // 24bpp LSB |
342 |
case 24: // 24bpp LSB |
343 |
*pixel_data++ = pixel; |
343 |
*pixel_data++ = pixel; |
344 |
*pixel_data++ = pixel >> 8; |
344 |
*pixel_data++ = pixel >> 8; |
345 |
*pixel_data++ = pixel >> 16; |
345 |
*pixel_data++ = pixel >> 16; |
346 |
break; |
346 |
break; |
347 |
|
347 |
|
348 |
case 25: // 24bpp MSB |
348 |
case 25: // 24bpp MSB |
349 |
*pixel_data++ = pixel >> 16; |
349 |
*pixel_data++ = pixel >> 16; |
Lines 365-373
Link Here
|
365 |
*pixel_data++ = pixel; |
365 |
*pixel_data++ = pixel; |
366 |
break; |
366 |
break; |
367 |
} |
367 |
} |
368 |
} |
368 |
} |
369 |
|
369 |
|
370 |
pixel_data = (ppixel_data += image->bytes_per_line); |
370 |
pixel_data = (ppixel_data += image->bytes_per_line); |
371 |
} |
371 |
} |
372 |
|
372 |
|
373 |
break; |
373 |
break; |
Lines 376-394
Link Here
|
376 |
case PseudoColor: { |
376 |
case PseudoColor: { |
377 |
#ifndef ORDEREDPSEUDO |
377 |
#ifndef ORDEREDPSEUDO |
378 |
short *terr, |
378 |
short *terr, |
379 |
*rerr = new short[width + 2], |
379 |
*rerr = new short[width + 2], |
380 |
*gerr = new short[width + 2], |
380 |
*gerr = new short[width + 2], |
381 |
*berr = new short[width + 2], |
381 |
*berr = new short[width + 2], |
382 |
*nrerr = new short[width + 2], |
382 |
*nrerr = new short[width + 2], |
383 |
*ngerr = new short[width + 2], |
383 |
*ngerr = new short[width + 2], |
384 |
*nberr = new short[width + 2]; |
384 |
*nberr = new short[width + 2]; |
385 |
int rr, gg, bb, rer, ger, ber; |
385 |
int rr, gg, bb, rer, ger, ber; |
386 |
int dd = 255 / control->getColorsPerChannel(); |
386 |
int dd = 255 / control->getColorsPerChannel(); |
387 |
|
387 |
|
388 |
for (x = 0; x < width; x++) { |
388 |
for (x = 0; x < width; x++) { |
389 |
*(rerr + x) = *(red + x); |
389 |
*(rerr + x) = *(red + x); |
390 |
*(gerr + x) = *(green + x); |
390 |
*(gerr + x) = *(green + x); |
391 |
*(berr + x) = *(blue + x); |
391 |
*(berr + x) = *(blue + x); |
392 |
} |
392 |
} |
393 |
|
393 |
|
394 |
*(rerr + x) = *(gerr + x) = *(berr + x) = 0; |
394 |
*(rerr + x) = *(gerr + x) = *(berr + x) = 0; |
Lines 425-471
Link Here
|
425 |
} |
425 |
} |
426 |
#else // !ORDEREDPSEUDO |
426 |
#else // !ORDEREDPSEUDO |
427 |
if (y < (height - 1)) { |
427 |
if (y < (height - 1)) { |
428 |
int i = offset + width; |
428 |
int i = offset + width; |
429 |
for (x = 0; x < width; x++, i++) { |
429 |
for (x = 0; x < width; x++, i++) { |
430 |
*(nrerr + x) = *(red + i); |
430 |
*(nrerr + x) = *(red + i); |
431 |
*(ngerr + x) = *(green + i); |
431 |
*(ngerr + x) = *(green + i); |
432 |
*(nberr + x) = *(blue + i); |
432 |
*(nberr + x) = *(blue + i); |
433 |
} |
433 |
} |
434 |
|
434 |
|
435 |
*(nrerr + x) = *(red + (--i)); |
435 |
*(nrerr + x) = *(red + (--i)); |
436 |
*(ngerr + x) = *(green + i); |
436 |
*(ngerr + x) = *(green + i); |
437 |
*(nberr + x) = *(blue + i); |
437 |
*(nberr + x) = *(blue + i); |
438 |
} |
438 |
} |
439 |
|
439 |
|
440 |
for (x = 0; x < width; x++) { |
440 |
for (x = 0; x < width; x++) { |
441 |
rr = rerr[x]; |
441 |
rr = rerr[x]; |
442 |
gg = gerr[x]; |
442 |
gg = gerr[x]; |
443 |
bb = berr[x]; |
443 |
bb = berr[x]; |
444 |
|
444 |
|
445 |
if (rr > 255) rr = 255; else if (rr < 0) rr = 0; |
445 |
if (rr > 255) rr = 255; else if (rr < 0) rr = 0; |
446 |
if (gg > 255) gg = 255; else if (gg < 0) gg = 0; |
446 |
if (gg > 255) gg = 255; else if (gg < 0) gg = 0; |
447 |
if (bb > 255) bb = 255; else if (bb < 0) bb = 0; |
447 |
if (bb > 255) bb = 255; else if (bb < 0) bb = 0; |
448 |
|
448 |
|
449 |
r = red_table[rr]; |
449 |
r = red_table[rr]; |
450 |
g = green_table[gg]; |
450 |
g = green_table[gg]; |
451 |
b = blue_table[bb]; |
451 |
b = blue_table[bb]; |
452 |
|
452 |
|
453 |
rer = rerr[x] - r*dd; |
453 |
rer = rerr[x] - r*dd; |
454 |
ger = gerr[x] - g*dd; |
454 |
ger = gerr[x] - g*dd; |
455 |
ber = berr[x] - b*dd; |
455 |
ber = berr[x] - b*dd; |
456 |
|
456 |
|
457 |
pixel = (r * cpccpc) + (g * cpc) + b; |
457 |
pixel = (r * cpccpc) + (g * cpc) + b; |
458 |
*pixel_data++ = colors[pixel].pixel; |
458 |
*pixel_data++ = colors[pixel].pixel; |
459 |
|
459 |
|
460 |
r = rer >> 1; |
460 |
r = rer >> 1; |
461 |
g = ger >> 1; |
461 |
g = ger >> 1; |
462 |
b = ber >> 1; |
462 |
b = ber >> 1; |
463 |
rerr[x+1] += r; |
463 |
rerr[x+1] += r; |
464 |
gerr[x+1] += g; |
464 |
gerr[x+1] += g; |
465 |
berr[x+1] += b; |
465 |
berr[x+1] += b; |
466 |
nrerr[x] += r; |
466 |
nrerr[x] += r; |
467 |
ngerr[x] += g; |
467 |
ngerr[x] += g; |
468 |
nberr[x] += b; |
468 |
nberr[x] += b; |
469 |
} |
469 |
} |
470 |
|
470 |
|
471 |
offset += width; |
471 |
offset += width; |
Lines 535-541
Link Here
|
535 |
|
535 |
|
536 |
default: |
536 |
default: |
537 |
fprintf(stderr, |
537 |
fprintf(stderr, |
538 |
"BImage::renderXImage: unsupported visual\n"); |
538 |
"BImage::renderXImage: unsupported visual\n"); |
539 |
delete [] d; |
539 |
delete [] d; |
540 |
XDestroyImage(image); |
540 |
XDestroyImage(image); |
541 |
return (XImage *) 0; |
541 |
return (XImage *) 0; |
Lines 546-557
Link Here
|
546 |
case PseudoColor: |
546 |
case PseudoColor: |
547 |
for (y = 0, offset = 0; y < height; y++) { |
547 |
for (y = 0, offset = 0; y < height; y++) { |
548 |
for (x = 0; x < width; x++, offset++) { |
548 |
for (x = 0; x < width; x++, offset++) { |
549 |
r = red_table[red[offset]]; |
549 |
r = red_table[red[offset]]; |
550 |
g = green_table[green[offset]]; |
550 |
g = green_table[green[offset]]; |
551 |
b = blue_table[blue[offset]]; |
551 |
b = blue_table[blue[offset]]; |
552 |
|
552 |
|
553 |
pixel = (r * cpccpc) + (g * cpc) + b; |
553 |
pixel = (r * cpccpc) + (g * cpc) + b; |
554 |
*pixel_data++ = colors[pixel].pixel; |
554 |
*pixel_data++ = colors[pixel].pixel; |
555 |
} |
555 |
} |
556 |
|
556 |
|
557 |
pixel_data = (ppixel_data += image->bytes_per_line); |
557 |
pixel_data = (ppixel_data += image->bytes_per_line); |
Lines 562-572
Link Here
|
562 |
case TrueColor: |
562 |
case TrueColor: |
563 |
for (y = 0, offset = 0; y < height; y++) { |
563 |
for (y = 0, offset = 0; y < height; y++) { |
564 |
for (x = 0; x < width; x++, offset++) { |
564 |
for (x = 0; x < width; x++, offset++) { |
565 |
r = red_table[red[offset]]; |
565 |
r = red_table[red[offset]]; |
566 |
g = green_table[green[offset]]; |
566 |
g = green_table[green[offset]]; |
567 |
b = blue_table[blue[offset]]; |
567 |
b = blue_table[blue[offset]]; |
568 |
|
568 |
|
569 |
pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); |
569 |
pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); |
570 |
|
570 |
|
571 |
switch (o) { |
571 |
switch (o) { |
572 |
case 16: // 16bpp LSB |
572 |
case 16: // 16bpp LSB |
Lines 616-627
Link Here
|
616 |
case GrayScale: |
616 |
case GrayScale: |
617 |
for (y = 0, offset = 0; y < height; y++) { |
617 |
for (y = 0, offset = 0; y < height; y++) { |
618 |
for (x = 0; x < width; x++, offset++) { |
618 |
for (x = 0; x < width; x++, offset++) { |
619 |
r = *(red_table + *(red + offset)); |
619 |
r = *(red_table + *(red + offset)); |
620 |
g = *(green_table + *(green + offset)); |
620 |
g = *(green_table + *(green + offset)); |
621 |
b = *(blue_table + *(blue + offset)); |
621 |
b = *(blue_table + *(blue + offset)); |
622 |
|
622 |
|
623 |
g = ((r * 30) + (g * 59) + (b * 11)) / 100; |
623 |
g = ((r * 30) + (g * 59) + (b * 11)) / 100; |
624 |
*pixel_data++ = colors[g].pixel; |
624 |
*pixel_data++ = colors[g].pixel; |
625 |
} |
625 |
} |
626 |
|
626 |
|
627 |
pixel_data = (ppixel_data += image->bytes_per_line); |
627 |
pixel_data = (ppixel_data += image->bytes_per_line); |
Lines 631-637
Link Here
|
631 |
|
631 |
|
632 |
default: |
632 |
default: |
633 |
fprintf(stderr, |
633 |
fprintf(stderr, |
634 |
"BImage::renderXImage: unsupported visual\n"); |
634 |
"BImage::renderXImage: unsupported visual\n"); |
635 |
delete [] d; |
635 |
delete [] d; |
636 |
XDestroyImage(image); |
636 |
XDestroyImage(image); |
637 |
return (XImage *) 0; |
637 |
return (XImage *) 0; |
Lines 650-656
Link Here
|
650 |
|
650 |
|
651 |
if (pixmap == None) { |
651 |
if (pixmap == None) { |
652 |
fprintf(stderr, |
652 |
fprintf(stderr, |
653 |
"BImage::renderPixmap: error creating pixmap\n"); |
653 |
"BImage::renderPixmap: error creating pixmap\n"); |
654 |
return None; |
654 |
return None; |
655 |
} |
655 |
} |
656 |
|
656 |
|
Lines 666-673
Link Here
|
666 |
} |
666 |
} |
667 |
|
667 |
|
668 |
XPutImage(control->getBaseDisplay()->getXDisplay(), pixmap, |
668 |
XPutImage(control->getBaseDisplay()->getXDisplay(), pixmap, |
669 |
DefaultGC(control->getBaseDisplay()->getXDisplay(), |
669 |
DefaultGC(control->getBaseDisplay()->getXDisplay(), |
670 |
control->getScreenInfo()->getScreenNumber()), |
670 |
control->getScreenInfo()->getScreenNumber()), |
671 |
image, 0, 0, 0, 0, width, height); |
671 |
image, 0, 0, 0, 0, width, height); |
672 |
|
672 |
|
673 |
if (image->data) { |
673 |
if (image->data) { |
Lines 1832-1839
Link Here
|
1832 |
bits_per_pixel = 0; |
1832 |
bits_per_pixel = 0; |
1833 |
for (int i = 0; i < count; i++) |
1833 |
for (int i = 0; i < count; i++) |
1834 |
if (pmv[i].depth == screen_depth) { |
1834 |
if (pmv[i].depth == screen_depth) { |
1835 |
bits_per_pixel = pmv[i].bits_per_pixel; |
1835 |
bits_per_pixel = pmv[i].bits_per_pixel; |
1836 |
break; |
1836 |
break; |
1837 |
} |
1837 |
} |
1838 |
|
1838 |
|
1839 |
XFree(pmv); |
1839 |
XFree(pmv); |
Lines 1863-1869
Link Here
|
1863 |
blue_bits = 255 / blue_mask; |
1863 |
blue_bits = 255 / blue_mask; |
1864 |
|
1864 |
|
1865 |
for (i = 0; i < 256; i++) { |
1865 |
for (i = 0; i < 256; i++) { |
1866 |
red_color_table[i] = i / red_bits; |
1866 |
red_color_table[i] = i / red_bits; |
1867 |
green_color_table[i] = i / green_bits; |
1867 |
green_color_table[i] = i / green_bits; |
1868 |
blue_color_table[i] = i / blue_bits; |
1868 |
blue_color_table[i] = i / blue_bits; |
1869 |
} |
1869 |
} |
Lines 1877-1890
Link Here
|
1877 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1877 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1878 |
|
1878 |
|
1879 |
if (ncolors > (1 << screen_depth)) { |
1879 |
if (ncolors > (1 << screen_depth)) { |
1880 |
colors_per_channel = (1 << screen_depth) / 3; |
1880 |
colors_per_channel = (1 << screen_depth) / 3; |
1881 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1881 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1882 |
} |
1882 |
} |
1883 |
|
1883 |
|
1884 |
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { |
1884 |
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { |
1885 |
fprintf(stderr, |
1885 |
fprintf(stderr, |
1886 |
"BImageControl::BImageControl: invalid colormap size %d " |
1886 |
"BImageControl::BImageControl: invalid colormap size %d " |
1887 |
"(%d/%d/%d) - reducing", |
1887 |
"(%d/%d/%d) - reducing", |
1888 |
ncolors, colors_per_channel, colors_per_channel, |
1888 |
ncolors, colors_per_channel, colors_per_channel, |
1889 |
colors_per_channel); |
1889 |
colors_per_channel); |
1890 |
|
1890 |
|
Lines 1893-1902
Link Here
|
1893 |
|
1893 |
|
1894 |
colors = new XColor[ncolors]; |
1894 |
colors = new XColor[ncolors]; |
1895 |
if (! colors) { |
1895 |
if (! colors) { |
1896 |
fprintf(stderr, |
1896 |
fprintf(stderr, |
1897 |
"BImageControl::BImageControl: error allocating " |
1897 |
"BImageControl::BImageControl: error allocating " |
1898 |
"colormap\n"); |
1898 |
"colormap\n"); |
1899 |
exit(1); |
1899 |
exit(1); |
1900 |
} |
1900 |
} |
1901 |
|
1901 |
|
1902 |
int i = 0, ii, p, r, g, b, |
1902 |
int i = 0, ii, p, r, g, b, |
Lines 1910-1938
Link Here
|
1910 |
red_bits = green_bits = blue_bits = bits; |
1910 |
red_bits = green_bits = blue_bits = bits; |
1911 |
|
1911 |
|
1912 |
for (i = 0; i < 256; i++) |
1912 |
for (i = 0; i < 256; i++) |
1913 |
red_color_table[i] = green_color_table[i] = blue_color_table[i] = |
1913 |
red_color_table[i] = green_color_table[i] = blue_color_table[i] = |
1914 |
i / bits; |
1914 |
i / bits; |
1915 |
|
1915 |
|
1916 |
for (r = 0, i = 0; r < colors_per_channel; r++) |
1916 |
for (r = 0, i = 0; r < colors_per_channel; r++) |
1917 |
for (g = 0; g < colors_per_channel; g++) |
1917 |
for (g = 0; g < colors_per_channel; g++) |
1918 |
for (b = 0; b < colors_per_channel; b++, i++) { |
1918 |
for (b = 0; b < colors_per_channel; b++, i++) { |
1919 |
colors[i].red = (r * 0xffff) / (colors_per_channel - 1); |
1919 |
colors[i].red = (r * 0xffff) / (colors_per_channel - 1); |
1920 |
colors[i].green = (g * 0xffff) / (colors_per_channel - 1); |
1920 |
colors[i].green = (g * 0xffff) / (colors_per_channel - 1); |
1921 |
colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; |
1921 |
colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; |
1922 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1922 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1923 |
} |
1923 |
} |
1924 |
|
1924 |
|
1925 |
basedisplay->grab(); |
1925 |
basedisplay->grab(); |
1926 |
|
1926 |
|
1927 |
for (i = 0; i < ncolors; i++) |
1927 |
for (i = 0; i < ncolors; i++) |
1928 |
if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
1928 |
if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
1929 |
&colors[i])) { |
1929 |
&colors[i])) { |
1930 |
fprintf(stderr, |
1930 |
fprintf(stderr, |
1931 |
"couldn't alloc color %i %i %i\n", |
1931 |
"couldn't alloc color %i %i %i\n", |
1932 |
colors[i].red, colors[i].green, colors[i].blue); |
1932 |
colors[i].red, colors[i].green, colors[i].blue); |
1933 |
colors[i].flags = 0; |
1933 |
colors[i].flags = 0; |
1934 |
} else |
1934 |
} else |
1935 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1935 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1936 |
|
1936 |
|
1937 |
basedisplay->ungrab(); |
1937 |
basedisplay->ungrab(); |
1938 |
|
1938 |
|
Lines 1940-1978
Link Here
|
1940 |
int incolors = (((1 << screen_depth) > 256) ? 256 : (1 << screen_depth)); |
1940 |
int incolors = (((1 << screen_depth) > 256) ? 256 : (1 << screen_depth)); |
1941 |
|
1941 |
|
1942 |
for (i = 0; i < incolors; i++) |
1942 |
for (i = 0; i < incolors; i++) |
1943 |
icolors[i].pixel = i; |
1943 |
icolors[i].pixel = i; |
1944 |
|
1944 |
|
1945 |
XQueryColors(basedisplay->getXDisplay(), getColormap(), icolors, |
1945 |
XQueryColors(basedisplay->getXDisplay(), getColormap(), icolors, |
1946 |
incolors); |
1946 |
incolors); |
1947 |
for (i = 0; i < ncolors; i++) { |
1947 |
for (i = 0; i < ncolors; i++) { |
1948 |
if (! colors[i].flags) { |
1948 |
if (! colors[i].flags) { |
1949 |
unsigned long chk = 0xffffffff, pixel, close = 0; |
1949 |
unsigned long chk = 0xffffffff, pixel, close = 0; |
1950 |
|
1950 |
|
1951 |
p = 2; |
1951 |
p = 2; |
1952 |
while (p--) { |
1952 |
while (p--) { |
1953 |
for (ii = 0; ii < incolors; ii++) { |
1953 |
for (ii = 0; ii < incolors; ii++) { |
1954 |
r = (colors[i].red - icolors[i].red) >> 8; |
1954 |
r = (colors[i].red - icolors[i].red) >> 8; |
1955 |
g = (colors[i].green - icolors[i].green) >> 8; |
1955 |
g = (colors[i].green - icolors[i].green) >> 8; |
1956 |
b = (colors[i].blue - icolors[i].blue) >> 8; |
1956 |
b = (colors[i].blue - icolors[i].blue) >> 8; |
1957 |
pixel = (r * r) + (g * g) + (b * b); |
1957 |
pixel = (r * r) + (g * g) + (b * b); |
1958 |
|
1958 |
|
1959 |
if (pixel < chk) { |
1959 |
if (pixel < chk) { |
1960 |
chk = pixel; |
1960 |
chk = pixel; |
1961 |
close = ii; |
1961 |
close = ii; |
1962 |
} |
1962 |
} |
1963 |
|
1963 |
|
1964 |
colors[i].red = icolors[close].red; |
1964 |
colors[i].red = icolors[close].red; |
1965 |
colors[i].green = icolors[close].green; |
1965 |
colors[i].green = icolors[close].green; |
1966 |
colors[i].blue = icolors[close].blue; |
1966 |
colors[i].blue = icolors[close].blue; |
1967 |
|
1967 |
|
1968 |
if (XAllocColor(basedisplay->getXDisplay(), getColormap(), |
1968 |
if (XAllocColor(basedisplay->getXDisplay(), getColormap(), |
1969 |
&colors[i])) { |
1969 |
&colors[i])) { |
1970 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1970 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
1971 |
break; |
1971 |
break; |
1972 |
} |
1972 |
} |
1973 |
} |
1973 |
} |
1974 |
} |
1974 |
} |
1975 |
} |
1975 |
} |
1976 |
} |
1976 |
} |
1977 |
|
1977 |
|
1978 |
break; |
1978 |
break; |
Lines 1983-2081
Link Here
|
1983 |
{ |
1983 |
{ |
1984 |
|
1984 |
|
1985 |
if (getVisual()->c_class == StaticGray) { |
1985 |
if (getVisual()->c_class == StaticGray) { |
1986 |
ncolors = 1 << screen_depth; |
1986 |
ncolors = 1 << screen_depth; |
1987 |
} else { |
1987 |
} else { |
1988 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1988 |
ncolors = colors_per_channel * colors_per_channel * colors_per_channel; |
1989 |
|
1989 |
|
1990 |
if (ncolors > (1 << screen_depth)) { |
1990 |
if (ncolors > (1 << screen_depth)) { |
1991 |
colors_per_channel = (1 << screen_depth) / 3; |
1991 |
colors_per_channel = (1 << screen_depth) / 3; |
1992 |
ncolors = |
1992 |
ncolors = |
1993 |
colors_per_channel * colors_per_channel * colors_per_channel; |
1993 |
colors_per_channel * colors_per_channel * colors_per_channel; |
1994 |
} |
1994 |
} |
1995 |
} |
1995 |
} |
1996 |
|
1996 |
|
1997 |
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { |
1997 |
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { |
1998 |
fprintf(stderr, |
1998 |
fprintf(stderr, |
1999 |
"BImageControl::BImageControl: invalid colormap size %d " |
1999 |
"BImageControl::BImageControl: invalid colormap size %d " |
2000 |
"(%d/%d/%d) - reducing", |
2000 |
"(%d/%d/%d) - reducing", |
2001 |
ncolors, colors_per_channel, colors_per_channel, |
2001 |
ncolors, colors_per_channel, colors_per_channel, |
2002 |
colors_per_channel); |
2002 |
colors_per_channel); |
2003 |
|
2003 |
|
2004 |
colors_per_channel = (1 << screen_depth) / 3; |
2004 |
colors_per_channel = (1 << screen_depth) / 3; |
2005 |
} |
2005 |
} |
2006 |
|
2006 |
|
2007 |
colors = new XColor[ncolors]; |
2007 |
colors = new XColor[ncolors]; |
2008 |
if (! colors) { |
2008 |
if (! colors) { |
2009 |
fprintf(stderr, |
2009 |
fprintf(stderr, |
2010 |
"BImageControl::BImageControl: error allocating " |
2010 |
"BImageControl::BImageControl: error allocating " |
2011 |
"colormap\n"); |
2011 |
"colormap\n"); |
2012 |
exit(1); |
2012 |
exit(1); |
2013 |
} |
2013 |
} |
2014 |
|
2014 |
|
2015 |
int i = 0, ii, p, bits = 255 / (colors_per_channel - 1); |
2015 |
int i = 0, ii, p, bits = 255 / (colors_per_channel - 1); |
2016 |
red_bits = green_bits = blue_bits = bits; |
2016 |
red_bits = green_bits = blue_bits = bits; |
2017 |
|
2017 |
|
2018 |
for (i = 0; i < 256; i++) |
2018 |
for (i = 0; i < 256; i++) |
2019 |
red_color_table[i] = green_color_table[i] = blue_color_table[i] = |
2019 |
red_color_table[i] = green_color_table[i] = blue_color_table[i] = |
2020 |
i / bits; |
2020 |
i / bits; |
2021 |
|
2021 |
|
2022 |
basedisplay->grab(); |
2022 |
basedisplay->grab(); |
2023 |
for (i = 0; i < ncolors; i++) { |
2023 |
for (i = 0; i < ncolors; i++) { |
2024 |
colors[i].red = (i * 0xffff) / (colors_per_channel - 1); |
2024 |
colors[i].red = (i * 0xffff) / (colors_per_channel - 1); |
2025 |
colors[i].green = (i * 0xffff) / (colors_per_channel - 1); |
2025 |
colors[i].green = (i * 0xffff) / (colors_per_channel - 1); |
2026 |
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);; |
2026 |
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);; |
2027 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2027 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2028 |
|
2028 |
|
2029 |
if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2029 |
if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2030 |
&colors[i])) { |
2030 |
&colors[i])) { |
2031 |
fprintf(stderr, |
2031 |
fprintf(stderr, |
2032 |
"couldn't alloc color %i %i %i\n", |
2032 |
"couldn't alloc color %i %i %i\n", |
2033 |
colors[i].red, colors[i].green, colors[i].blue); |
2033 |
colors[i].red, colors[i].green, colors[i].blue); |
2034 |
colors[i].flags = 0; |
2034 |
colors[i].flags = 0; |
2035 |
} else |
2035 |
} else |
2036 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2036 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2037 |
} |
2037 |
} |
2038 |
|
2038 |
|
2039 |
basedisplay->ungrab(); |
2039 |
basedisplay->ungrab(); |
2040 |
|
2040 |
|
2041 |
XColor icolors[256]; |
2041 |
XColor icolors[256]; |
2042 |
int incolors = (((1 << screen_depth) > 256) ? 256 : |
2042 |
int incolors = (((1 << screen_depth) > 256) ? 256 : |
2043 |
(1 << screen_depth)); |
2043 |
(1 << screen_depth)); |
2044 |
|
2044 |
|
2045 |
for (i = 0; i < incolors; i++) |
2045 |
for (i = 0; i < incolors; i++) |
2046 |
icolors[i].pixel = i; |
2046 |
icolors[i].pixel = i; |
2047 |
|
2047 |
|
2048 |
XQueryColors(basedisplay->getXDisplay(), getColormap(), icolors, |
2048 |
XQueryColors(basedisplay->getXDisplay(), getColormap(), icolors, |
2049 |
incolors); |
2049 |
incolors); |
2050 |
for (i = 0; i < ncolors; i++) { |
2050 |
for (i = 0; i < ncolors; i++) { |
2051 |
if (! colors[i].flags) { |
2051 |
if (! colors[i].flags) { |
2052 |
unsigned long chk = 0xffffffff, pixel, close = 0; |
2052 |
unsigned long chk = 0xffffffff, pixel, close = 0; |
|
|
2053 |
|
2054 |
p = 2; |
2055 |
while (p--) { |
2056 |
for (ii = 0; ii < incolors; ii++) { |
2057 |
int r = (colors[i].red - icolors[i].red) >> 8; |
2058 |
int g = (colors[i].green - icolors[i].green) >> 8; |
2059 |
int b = (colors[i].blue - icolors[i].blue) >> 8; |
2060 |
pixel = (r * r) + (g * g) + (b * b); |
2061 |
|
2062 |
if (pixel < chk) { |
2063 |
chk = pixel; |
2064 |
close = ii; |
2065 |
} |
2053 |
|
2066 |
|
2054 |
p = 2; |
2067 |
colors[i].red = icolors[close].red; |
2055 |
while (p--) { |
2068 |
colors[i].green = icolors[close].green; |
2056 |
for (ii = 0; ii < incolors; ii++) { |
2069 |
colors[i].blue = icolors[close].blue; |
2057 |
int r = (colors[i].red - icolors[i].red) >> 8; |
2070 |
|
2058 |
int g = (colors[i].green - icolors[i].green) >> 8; |
2071 |
if (XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2059 |
int b = (colors[i].blue - icolors[i].blue) >> 8; |
2072 |
&colors[i])) { |
2060 |
pixel = (r * r) + (g * g) + (b * b); |
2073 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2061 |
|
2074 |
break; |
2062 |
if (pixel < chk) { |
2075 |
} |
2063 |
chk = pixel; |
2076 |
} |
2064 |
close = ii; |
2077 |
} |
2065 |
} |
2078 |
} |
2066 |
|
|
|
2067 |
colors[i].red = icolors[close].red; |
2068 |
colors[i].green = icolors[close].green; |
2069 |
colors[i].blue = icolors[close].blue; |
2070 |
|
2071 |
if (XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2072 |
&colors[i])) { |
2073 |
colors[i].flags = DoRed|DoGreen|DoBlue; |
2074 |
break; |
2075 |
} |
2076 |
} |
2077 |
} |
2078 |
} |
2079 |
} |
2079 |
} |
2080 |
|
2080 |
|
2081 |
break; |
2081 |
break; |
Lines 2083-2090
Link Here
|
2083 |
|
2083 |
|
2084 |
default: |
2084 |
default: |
2085 |
fprintf(stderr, |
2085 |
fprintf(stderr, |
2086 |
"BImageControl::BImageControl: unsupported visual %d\n", |
2086 |
"BImageControl::BImageControl: unsupported visual %d\n", |
2087 |
getVisual()->c_class); |
2087 |
getVisual()->c_class); |
2088 |
exit(1); |
2088 |
exit(1); |
2089 |
} |
2089 |
} |
2090 |
|
2090 |
|
Lines 2113-2119
Link Here
|
2113 |
*(pixels + i) = (*(colors + i)).pixel; |
2113 |
*(pixels + i) = (*(colors + i)).pixel; |
2114 |
|
2114 |
|
2115 |
XFreeColors(basedisplay->getXDisplay(), getColormap(), |
2115 |
XFreeColors(basedisplay->getXDisplay(), getColormap(), |
2116 |
pixels, ncolors, 0); |
2116 |
pixels, ncolors, 0); |
2117 |
|
2117 |
|
2118 |
delete [] colors; |
2118 |
delete [] colors; |
2119 |
} |
2119 |
} |
Lines 2121-2128
Link Here
|
2121 |
if (cache->count()) { |
2121 |
if (cache->count()) { |
2122 |
int i, n = cache->count(); |
2122 |
int i, n = cache->count(); |
2123 |
fprintf(stderr, |
2123 |
fprintf(stderr, |
2124 |
"BImageContol::~BImageControl: pixmap cache - " |
2124 |
"BImageContol::~BImageControl: pixmap cache - " |
2125 |
"releasing %d pixmaps\n", n); |
2125 |
"releasing %d pixmaps\n", n); |
2126 |
|
2126 |
|
2127 |
for (i = 0; i < n; i++) { |
2127 |
for (i = 0; i < n; i++) { |
2128 |
Cache *tmp = cache->first(); |
2128 |
Cache *tmp = cache->first(); |
Lines 2144-2151
Link Here
|
2144 |
|
2144 |
|
2145 |
|
2145 |
|
2146 |
Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, |
2146 |
Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, |
2147 |
unsigned long texture, |
2147 |
unsigned long texture, |
2148 |
BColor *c1, BColor *c2) { |
2148 |
BColor *c1, BColor *c2) { |
2149 |
if (cache->count()) { |
2149 |
if (cache->count()) { |
2150 |
LinkedListIterator<Cache> it(cache); |
2150 |
LinkedListIterator<Cache> it(cache); |
2151 |
|
2151 |
|
Lines 2175-2181
Link Here
|
2175 |
if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; |
2175 |
if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; |
2176 |
|
2176 |
|
2177 |
Pixmap pixmap = searchCache(width, height, texture->getTexture(), |
2177 |
Pixmap pixmap = searchCache(width, height, texture->getTexture(), |
2178 |
texture->getColor(), texture->getColorTo()); |
2178 |
texture->getColor(), texture->getColorTo()); |
2179 |
if (pixmap) return pixmap; |
2179 |
if (pixmap) return pixmap; |
2180 |
|
2180 |
|
2181 |
BImage image(this, width, height); |
2181 |
BImage image(this, width, height); |
Lines 2220-2238
Link Here
|
2220 |
LinkedListIterator<Cache> it(cache); |
2220 |
LinkedListIterator<Cache> it(cache); |
2221 |
for (; it.current(); it++) { |
2221 |
for (; it.current(); it++) { |
2222 |
if (it.current()->pixmap == pixmap) { |
2222 |
if (it.current()->pixmap == pixmap) { |
2223 |
Cache *tmp = it.current(); |
2223 |
Cache *tmp = it.current(); |
2224 |
|
2224 |
|
2225 |
if (tmp->count) { |
2225 |
if (tmp->count) { |
2226 |
tmp->count--; |
2226 |
tmp->count--; |
2227 |
|
2227 |
|
2228 |
#ifdef TIMEDCACHE |
2228 |
#ifdef TIMEDCACHE |
2229 |
if (! timer) timeout(); |
2229 |
if (! timer) timeout(); |
2230 |
#else // !TIMEDCACHE |
2230 |
#else // !TIMEDCACHE |
2231 |
if (! tmp->count) timeout(); |
2231 |
if (! tmp->count) timeout(); |
2232 |
#endif // TIMEDCACHE |
2232 |
#endif // TIMEDCACHE |
2233 |
} |
2233 |
} |
2234 |
|
2234 |
|
2235 |
return; |
2235 |
return; |
2236 |
} |
2236 |
} |
2237 |
} |
2237 |
} |
2238 |
} |
2238 |
} |
Lines 2240-2259
Link Here
|
2240 |
|
2240 |
|
2241 |
|
2241 |
|
2242 |
unsigned long BImageControl::getColor(const char *colorname, |
2242 |
unsigned long BImageControl::getColor(const char *colorname, |
2243 |
unsigned char *r, unsigned char *g, |
2243 |
unsigned char *r, unsigned char *g, |
2244 |
unsigned char *b) |
2244 |
unsigned char *b) |
2245 |
{ |
2245 |
{ |
2246 |
XColor color; |
2246 |
XColor color; |
2247 |
color.pixel = 0; |
2247 |
color.pixel = 0; |
|
|
2248 |
char buffer[] = "rgb:RR/GG/BB"; |
2248 |
|
2249 |
|
2249 |
if (! XParseColor(basedisplay->getXDisplay(), getColormap(), |
2250 |
|
2250 |
colorname, &color)) { |
2251 |
|
2251 |
fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n", |
2252 |
if (! XParseColor(basedisplay->getXDisplay(), getColormap(), colorname, &color)) { |
2252 |
colorname); |
2253 |
|
2253 |
} else if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2254 |
|
2254 |
&color)) { |
2255 |
// Some (newer?) themes uses #RRGGBB instead of rgb:RR/GG/BB. Trying to decode. |
2255 |
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", |
2256 |
buffer[4] = colorname[1]; |
2256 |
colorname); |
2257 |
buffer[5] = colorname[2]; |
|
|
2258 |
buffer[7] = colorname[3]; |
2259 |
buffer[8] = colorname[4]; |
2260 |
buffer[10] = colorname[5]; |
2261 |
buffer[11] = colorname[6]; |
2262 |
|
2263 |
if (! XParseColor(basedisplay->getXDisplay(), getColormap(), buffer, &color)) |
2264 |
fprintf(stderr, "(1) BImageControl::getColor: color parse error: \"%s\"\n", colorname); |
2265 |
|
2266 |
} else if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), &color)) { |
2267 |
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", colorname); |
2257 |
} |
2268 |
} |
2258 |
|
2269 |
|
2259 |
if (color.red == 65535) *r = 0xff; |
2270 |
if (color.red == 65535) *r = 0xff; |
Lines 2272-2284
Link Here
|
2272 |
color.pixel = 0; |
2283 |
color.pixel = 0; |
2273 |
|
2284 |
|
2274 |
if (! XParseColor(basedisplay->getXDisplay(), getColormap(), |
2285 |
if (! XParseColor(basedisplay->getXDisplay(), getColormap(), |
2275 |
colorname, &color)) { |
2286 |
colorname, &color)) { |
2276 |
fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n", |
2287 |
fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n", |
2277 |
colorname); |
2288 |
colorname); |
2278 |
} else if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2289 |
} else if (! XAllocColor(basedisplay->getXDisplay(), getColormap(), |
2279 |
&color)) { |
2290 |
&color)) { |
2280 |
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", |
2291 |
fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", |
2281 |
colorname); |
2292 |
colorname); |
2282 |
} |
2293 |
} |
2283 |
|
2294 |
|
2284 |
return color.pixel; |
2295 |
return color.pixel; |
Lines 2286-2293
Link Here
|
2286 |
|
2297 |
|
2287 |
|
2298 |
|
2288 |
void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt, |
2299 |
void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt, |
2289 |
unsigned char **bmt, |
2300 |
unsigned char **bmt, |
2290 |
int *roff, int *goff, int *boff, |
2301 |
int *roff, int *goff, int *boff, |
2291 |
int *rbit, int *gbit, int *bbit) { |
2302 |
int *rbit, int *gbit, int *bbit) { |
2292 |
if (rmt) *rmt = red_color_table; |
2303 |
if (rmt) *rmt = red_color_table; |
2293 |
if (gmt) *gmt = green_color_table; |
2304 |
if (gmt) *gmt = green_color_table; |
Lines 2310-2318
Link Here
|
2310 |
|
2321 |
|
2311 |
|
2322 |
|
2312 |
void BImageControl::getGradientBuffers(unsigned int w, |
2323 |
void BImageControl::getGradientBuffers(unsigned int w, |
2313 |
unsigned int h, |
2324 |
unsigned int h, |
2314 |
unsigned int **xbuf, |
2325 |
unsigned int **xbuf, |
2315 |
unsigned int **ybuf) |
2326 |
unsigned int **ybuf) |
2316 |
{ |
2327 |
{ |
2317 |
if (w > grad_buffer_width) { |
2328 |
if (w > grad_buffer_width) { |
2318 |
if (grad_xbuffer) { |
2329 |
if (grad_xbuffer) { |
Lines 2350-2356
Link Here
|
2350 |
if (cmaps) { |
2361 |
if (cmaps) { |
2351 |
for (i = 0; i < ncmap; i++) |
2362 |
for (i = 0; i < ncmap; i++) |
2352 |
if (*(cmaps + i) == getColormap()) |
2363 |
if (*(cmaps + i) == getColormap()) |
2353 |
install = False; |
2364 |
install = False; |
2354 |
|
2365 |
|
2355 |
if (install) |
2366 |
if (install) |
2356 |
XInstallColormap(basedisplay->getXDisplay(), getColormap()); |
2367 |
XInstallColormap(basedisplay->getXDisplay(), getColormap()); |
Lines 2406-2428
Link Here
|
2406 |
else if (strstr(ts, "gradient")) { |
2417 |
else if (strstr(ts, "gradient")) { |
2407 |
texture->addTexture(BImage_Gradient); |
2418 |
texture->addTexture(BImage_Gradient); |
2408 |
if (strstr(ts, "crossdiagonal")) |
2419 |
if (strstr(ts, "crossdiagonal")) |
2409 |
texture->addTexture(BImage_CrossDiagonal); |
2420 |
texture->addTexture(BImage_CrossDiagonal); |
2410 |
else if (strstr(ts, "rectangle")) |
2421 |
else if (strstr(ts, "rectangle")) |
2411 |
texture->addTexture(BImage_Rectangle); |
2422 |
texture->addTexture(BImage_Rectangle); |
2412 |
else if (strstr(ts, "pyramid")) |
2423 |
else if (strstr(ts, "pyramid")) |
2413 |
texture->addTexture(BImage_Pyramid); |
2424 |
texture->addTexture(BImage_Pyramid); |
2414 |
else if (strstr(ts, "pipecross")) |
2425 |
else if (strstr(ts, "pipecross")) |
2415 |
texture->addTexture(BImage_PipeCross); |
2426 |
texture->addTexture(BImage_PipeCross); |
2416 |
else if (strstr(ts, "elliptic")) |
2427 |
else if (strstr(ts, "elliptic")) |
2417 |
texture->addTexture(BImage_Elliptic); |
2428 |
texture->addTexture(BImage_Elliptic); |
2418 |
else if (strstr(ts, "diagonal")) |
2429 |
else if (strstr(ts, "diagonal")) |
2419 |
texture->addTexture(BImage_Diagonal); |
2430 |
texture->addTexture(BImage_Diagonal); |
2420 |
else if (strstr(ts, "horizontal")) |
2431 |
else if (strstr(ts, "horizontal")) |
2421 |
texture->addTexture(BImage_Horizontal); |
2432 |
texture->addTexture(BImage_Horizontal); |
2422 |
else if (strstr(ts, "vertical")) |
2433 |
else if (strstr(ts, "vertical")) |
2423 |
texture->addTexture(BImage_Vertical); |
2434 |
texture->addTexture(BImage_Vertical); |
2424 |
else |
2435 |
else |
2425 |
texture->addTexture(BImage_Diagonal); |
2436 |
texture->addTexture(BImage_Diagonal); |
2426 |
} else |
2437 |
} else |
2427 |
texture->addTexture(BImage_Solid); |
2438 |
texture->addTexture(BImage_Solid); |
2428 |
|
2439 |
|
Lines 2437-2445
Link Here
|
2437 |
|
2448 |
|
2438 |
if (! (texture->getTexture() & BImage_Flat)) |
2449 |
if (! (texture->getTexture() & BImage_Flat)) |
2439 |
if (strstr(ts, "bevel2")) |
2450 |
if (strstr(ts, "bevel2")) |
2440 |
texture->addTexture(BImage_Bevel2); |
2451 |
texture->addTexture(BImage_Bevel2); |
2441 |
else |
2452 |
else |
2442 |
texture->addTexture(BImage_Bevel1); |
2453 |
texture->addTexture(BImage_Bevel1); |
2443 |
|
2454 |
|
2444 |
#ifdef INTERLACE |
2455 |
#ifdef INTERLACE |
2445 |
if (strstr(ts, "interlaced")) |
2456 |
if (strstr(ts, "interlaced")) |