89#include "RConfigure.h"
100# include "Windows4root.h"
104# define X_DISPLAY_MISSING 1
106# include <afterbase.h>
108# include <win32/config.h>
109# include <win32/afterbase.h>
110# define X_DISPLAY_MISSING 1
112# include <afterimage.h>
137#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER
138#pragma GCC diagnostic ignored "-Wstrict-aliasing"
159#define _alphaBlend(bot, top) {\
160 __argb32__ *T = (__argb32__*)(top);\
161 __argb32__ *B = (__argb32__*)(bot);\
166 B->a = ((B->a*aa)>>8) + T->a;\
167 B->r = (B->r*aa + T->r*T->a)>>8;\
168 B->g = (B->g*aa + T->g*T->a)>>8;\
169 B->b = (B->b*aa + T->b*T->a)>>8;\
236 fImage = create_asimage(
w ?
w : 20,
h ?
h : 20, 0);
303 if (img.
fImage->alt.vector) {
324 if (
this != &img && img.
IsValid()) {
333 if (img.
fImage->alt.vector) {
383 const char *delim =
":";
385 const char *delim =
";";
387 while (icon_path.
Tokenize(token, from, delim) &&
cnt < 6) {
403 FILE *fp = fopen(
file,
"rb");
404 const char *ret =
"";
408 if (!fread(&magic, 1, 1, fp)) {
416 if (!fread(&magic, 1, 1, fp)) {
420 if (!fread(&magic, 1, 1, fp)) {
425 ret = (magic == 1) ?
"ico" :
"cur";
430 if (!fread(&magic, 1, 1, fp)) {
435 if (magic == 0x21) ret =
"ps";
436 else if (magic == 0x50) ret =
"pdf";
486 Warning(
"Scale",
"Visual not initiated");
503 set_output_threshold(0);
505 static ASImageImportParams iparams;
509 iparams.filter = SCL_DO_ALL;
510 iparams.gamma = SCREEN_GAMMA;
511 iparams.gamma_table = NULL;
513 iparams.format = ASA_ASImage;
515 iparams.subimage = 0;
516 iparams.return_animation_delay = -1;
533 iparams.subimage = ext.
Atoi();
535 ext = strrchr(fname.
Data(),
'.') + 1;
538 image = file2ASImage_extra(fname.
Data(), &iparams);
550 unsigned char *
bitmap = 0;
556 if (!handler || ((handler->
LoadPlugin() == -1))) {
575 image = bitmap2asimage(
bitmap,
w,
h, 0, 0);
655 Error(
"WriteImage",
"no image loaded");
660 Error(
"WriteImage",
"no file name specified");
665 if ((
s = strrchr(
file,
'.'))) {
669 Error(
"WriteImage",
"cannot determine a valid file type");
677 Error(
"WriteImage",
"not a valid file type was specified");
683 ASImageFileTypes atype = (ASImageFileTypes)mytype;
691 static ASImageExportParams parms;
696 parms.xpm.type = atype;
697 parms.xpm.flags = EXPORT_ALPHA;
698 parms.xpm.dither = 4;
699 parms.xpm.opaque_threshold = 127;
700 parms.xpm.max_colors = 512;
703 ASImage2bmp(im, fname.
Data(), 0);
706 ASImage2xcf(im, fname.
Data(), 0);
709 parms.png.type = atype;
710 parms.png.flags = EXPORT_ALPHA;
714 parms.jpeg.type = atype;
715 parms.jpeg.flags = 0;
716 parms.jpeg.quality = aquality;
719 parms.gif.type = atype;
720 parms.gif.flags = EXPORT_ALPHA;
721 parms.gif.dither = 0;
722 parms.gif.opaque_threshold = 0;
726 parms.gif.type = atype;
727 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
728 parms.gif.dither = 0;
729 parms.gif.opaque_threshold = 0;
730 parms.gif.animate_repeats = 0;
743 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
744 parms.gif.animate_repeats = 0;
745 }
else if(sufix==
"") {
762 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
763 parms.gif.animate_repeats = atoi(
s);
772 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
773 parms.gif.animate_repeats = 0;
774 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
780 delay = atoi(sDelay);
781 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
782 parms.gif.animate_repeats = atoi(sRepeats);
784 Error(
"WriteImage",
"gif suffix %s not yet supported",
s);
788 parms.gif.animate_delay = delay;
790 int i1 = fname.
Index(
"gif+");
792 fname = fname(0, i1 + 3);
795 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
801 parms.tiff.type = atype;
802 parms.tiff.flags = EXPORT_ALPHA;
803 parms.tiff.rows_per_strip = 0;
804 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
805 TIFF_COMPRESSION_NONE;
806 parms.tiff.jpeg_quality = 100;
807 parms.tiff.opaque_threshold = 0;
810 Error(
"WriteImage",
"file type %s not yet supported",
s);
814 if (!ASImage2file(im, 0, fname.
Data(), atype, &parms)) {
815 Error(
"WriteImage",
"error writing file %s",
file);
833 if (
s ==
"jpg" ||
s ==
"jpeg")
849 if (
s.Contains(
"gif+"))
872 astype = ASIT_Xpm;
break;
874 astype = ASIT_ZCompressedXpm;
break;
876 astype = ASIT_GZCompressedXpm;
break;
878 astype = ASIT_Png;
break;
880 astype = ASIT_Jpeg;
break;
882 astype = ASIT_Xcf;
break;
884 astype = ASIT_Ppm;
break;
886 astype = ASIT_Pnm;
break;
888 astype = ASIT_Bmp;
break;
890 astype = ASIT_Ico;
break;
892 astype = ASIT_Cur;
break;
894 astype = ASIT_Gif;
break;
896 astype = ASIT_Gif;
break;
898 astype = ASIT_Tiff;
break;
900 astype = ASIT_Xbm;
break;
902 astype = ASIT_Targa;
break;
904 astype = ASIT_XMLScript;
break;
906 astype = ASIT_Unknown;
912 case ASIT_ZCompressedXpm:
914 case ASIT_GZCompressedXpm:
957 asquality = 25;
break;
959 asquality = 75;
break;
961 asquality = 50;
break;
963 asquality = 100;
break;
969 if (asquality > 0 && asquality <= 25)
971 if (asquality > 26 && asquality <= 50)
973 if (asquality > 51 && asquality <= 75)
975 if (asquality > 76 && asquality <= 100)
995 Warning(
"SetImage",
"Visual not initiated");
1013 ASVectorPalette asPalette;
1017 for (col = 0; col < 4; col++)
1018 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1025 asPalette.points =
new Double_t[asPalette.npoints];
1026 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1030 height, &asPalette, ASA_ASImage,
1033 delete [] asPalette.points;
1034 for (col = 0; col < 4; col++)
1035 delete [] asPalette.channels[col];
1079 Error(
"FromPad",
"pad cannot be 0");
1084 Warning(
"FromPad",
"Visual not initiated");
1094 if (
gROOT->IsBatch()) {
1102 if (itmp && itmp->
fImage) {
1111 if (itmp && itmp->
fImage && (itmp !=
this)) {
1113 if (itmp->
fImage->alt.argb32) {
1115 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1116 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1143 static int x11 = -1;
1144 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1149 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0,
w,
h);
1154 fImage = bitmap2asimage(bits,
w,
h, 0, 0);
1175 Error(
"Draw",
"no image set");
1193 rname =
"new TCanvas(\"" + rname +
Form(
"\", %d, %d);",
w,
h);
1203 gPad->Range(-left / (1.0 - left - right),
1204 -bottom / (1.0 - top - bottom),
1205 1 + right / (1.0 - left - right),
1206 1 + top / ( 1.0 - top - bottom));
1207 gPad->RangeAxis(0, 0, 1, 1);
1230 wsrc = wsrc ? wsrc : im->width;
1231 hsrc = hsrc ? hsrc : im->height;
1233 static int x11 = -1;
1234 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1241 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1248 char *bits =
new char[ww*hh];
1250 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1251 xsrc, ysrc, ww, 0, 0);
1253 for (yy = 0; yy < hh; yy++) {
1254 imdec->decode_image_scanline(imdec);
1255 CARD32 *
a = imdec->buffer.alpha;
1257 for (xx = 0; xx < ww; xx++) {
1272 stop_image_decoding(&imdec);
1275 (
const char *)bits, ww, hh);
1293 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1294 asimage2drawable(
fgVisual,
wid, im, (GC)
gc, xsrc, ysrc,
x,
y, wsrc, hsrc, 1);
1297 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1299 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1300 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1302 bits = (
unsigned char *)img->alt.argb32;
1309 if (
gPad &&
gPad->GetGLDevice() != -1) {
1311 painter->DrawPixels(bits, wsrc, hsrc,
x,
y, !
option.Contains(
"opaque"));
1315 if (!
option.Contains(
"opaque")) {
1326 destroy_asimage(&img);
1351 xsrc, ysrc, wsrc, hsrc, opt);
1370 Error(
"Paint",
"no image set");
1375 Warning(
"Paint",
"Visual not initiated");
1379 Int_t tile_x = 0, tile_y = 0;
1380 CARD32 tile_tint = 0;
1389 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1392 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1395 Error(
"Paint",
"tile option error");
1403 if (!
fImage->alt.vector) {
1416 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1417 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1420 if ((to_w < 25 || to_h < 25) && !expand) {
1421 Error(
"Paint",
"pad too small to display an image");
1433 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1434 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1436 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1437 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1442 ASImage *grad_im = 0;
1450 grad.type = GRADIENT_Top2Bottom;
1451 grad.color =
new ARGB32[grad.npoints];
1452 grad.offset =
new double[grad.npoints];
1455 Int_t oldPt = grad.npoints -
pt -1;
1456 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1457 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1459 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1460 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1464 pal_h, SCL_DO_COLOR,
1467 delete [] grad.color;
1468 delete [] grad.offset;
1476 to_w, to_h, tile_tint, ASA_ASImage,
1503 ASImage *tmpImage = 0;
1514 destroy_asimage(&tmpImage);
1529 Error(
"Paint",
"image could not be rendered to display");
1533 int tox = expand ? 0 :
int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1534 int toy = expand ? 0 :
int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1536 if (!
gROOT->IsBatch()) {
1551 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1552 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1553 min, max, ndiv,
"+LU");
1558 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1559 min, max, ndiv,
"+L");
1569 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1574 dump->
Merge(&tgrad,
"alphablend", pal_Ax, pal_Ay);
1584 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1585 min, max, ndiv,
"+L");
1589 Warning(
"Paint",
"PDF not implemented yet");
1592 Warning(
"Paint",
"SVG not implemented yet");
1600 if ((color = (
TColor*)
colors->FindObject(
"Image_PS")) == 0)
1601 color =
new TColor(
colors->GetEntries(), 1., 1., 1.,
"Image_PS");
1612 x2 =
x1+dx/image->width;
1614 y2 =
y1+dy/image->height;
1617 x2 =
x1+(dx*(1-
gPad->GetRightMargin()-
gPad->GetLeftMargin()))/image->width;
1619 y2 =
y1+(dy*(1-
gPad->GetTopMargin()-
gPad->GetBottomMargin()))/image->height;
1624 ASImageDecoder *imdec = start_image_decoding(
fgVisual, image, SCL_DO_ALL,
1625 0, 0, image->width, image->height, 0);
1627 for (
Int_t yt = 0; yt < (
Int_t)image->height; yt++) {
1628 imdec->decode_image_scanline(imdec);
1629 for (
Int_t xt = 0; xt < (
Int_t)image->width; xt++)
1631 imdec->buffer.green[xt],
1632 imdec->buffer.blue[xt]);
1634 stop_image_decoding(&imdec);
1639 Double_t xconv = (
gPad->AbsPixeltoX(pal_Ax + pal_w) -
gPad->AbsPixeltoX(pal_Ax)) / grad_im->width;
1640 Double_t yconv = (
gPad->AbsPixeltoY(pal_Ay - pal_h) -
gPad->AbsPixeltoY(pal_Ay)) / grad_im->height;
1641 x1 =
gPad->AbsPixeltoX(pal_Ax);
1643 y2 =
gPad->AbsPixeltoY(pal_Ay);
1648 imdec = start_image_decoding(
fgVisual, grad_im, SCL_DO_ALL,
1649 0, 0, grad_im->width, grad_im->height, 0);
1651 for (
Int_t yt = 0; yt < (
Int_t)grad_im->height; yt++) {
1652 imdec->decode_image_scanline(imdec);
1653 for (
Int_t xt = 0; xt < (
Int_t)grad_im->width; xt++)
1655 imdec->buffer.green[xt],
1656 imdec->buffer.blue[xt]);
1659 stop_image_decoding(&imdec);
1670 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1671 min, max, ndiv,
"+L");
1677 destroy_asimage(&grad_im);
1686 Int_t pxl, pyl, pxt, pyt;
1693 if (px1 < px2) {pxl = px1; pxt = px2;}
1694 else {pxl = px2; pxt = px1;}
1695 if (py1 < py2) {pyl = py1; pyt = py2;}
1696 else {pyl = py2; pyt = py1;}
1698 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1709 static std::unique_ptr<TBox> ZoomBox;
1720 static Int_t px1old, py1old, px2old, py2old;
1721 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
1732 if (imgX < 0) px = px - imgX;
1733 if (imgY < 0) py = py - imgY;
1738 if (imgX >= (
int)image->width) px = px - imgX + image->width - 1;
1739 if (imgY >= (
int)image->height) py = py - imgY + image->height - 1;
1744 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1745 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1746 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1747 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1748 px1old = px; py1old = py;
1764 ZoomBox->SetX1(
gPad->AbsPixeltoX(pxl));
1765 ZoomBox->SetY1(
gPad->AbsPixeltoY(pyl));
1766 ZoomBox->SetX2(
gPad->AbsPixeltoX(pxt));
1767 ZoomBox->SetY2(
gPad->AbsPixeltoY(pyt));
1769 ZoomBox = std::make_unique<TBox>(pxl, pyl, pxt, pyt);
1770 ZoomBox->SetFillStyle(0);
1771 ZoomBox->Draw(
"l*");
1790 Int_t imgX1 = px1old -
gPad->XtoAbsPixel(0);
1791 Int_t imgY1 = py1old -
gPad->YtoAbsPixel(1);
1792 Int_t imgX2 = px -
gPad->XtoAbsPixel(0);
1793 Int_t imgY2 = py -
gPad->YtoAbsPixel(1);
1795 imgY1 = image->height - 1 - imgY1;
1796 imgY2 = image->height - 1 - imgY2;
1802 Zoom((imgX1 < imgX2) ? imgX1 : imgX2, (imgY1 < imgY2) ? imgY1 : imgY2,
1820 static char info[64];
1826 px -=
gPad->XtoAbsPixel(0);
1827 py -=
gPad->YtoAbsPixel(1);
1830 if (px < 0 || py < 0)
return info;
1834 if (px >= (
int)image->width || py >= (
int)image->height)
1837 py = image->height - 1 - py;
1844 if (
fImage->alt.vector) {
1845 snprintf(info,64,
"x: %d y: %d %.5g",
1848 snprintf(info,64,
"x: %d y: %d", px, py);
1864 Warning(
"SetPalette",
"Visual not initiated");
1869 Warning(
"SetPalette",
"Image not valid");
1873 if (
fImage->alt.vector == 0)
1879 ASVectorPalette asPalette;
1881 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1882 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1883 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1884 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1890 asPalette.points =
new double[asPalette.npoints];
1891 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1897 delete [] asPalette.points;
1898 for (
Int_t col = 0; col < 4; col++)
1899 delete [] asPalette.channels[col];
1918 Warning(
"Scale",
"Image not initiated");
1923 Warning(
"Scale",
"Visual not initiated");
1931 if (toWidth > 30000)
1933 if (toHeight > 30000)
1936 ASImage *img = scale_asimage(
fgVisual,
fImage, toWidth, toHeight,
1953 Warning(
"Scale",
"Image not initiated");
1958 Warning(
"Scale",
"Visual not initiated");
1966 if (toWidth > 30000)
1968 if (toHeight > 30000)
1972 yStart, yEnd, toWidth, toHeight,
1988 Warning(
"Tile",
"Image not initiated");
1993 Warning(
"Tile",
"Visual not initiated");
2001 if (toWidth > 30000)
2003 if (toHeight > 30000)
2006 ASImage *img = tile_asimage(
fgVisual,
fImage, 0, 0, toWidth, toHeight, 0,
2028 Warning(
"Zoom",
"Image not valid");
2050 Warning(
"UnZoom",
"Image not valid");
2078 Warning(
"Flip",
"Image not valid");
2082 Warning(
"Flip",
"Visual not initiated");
2086 if (
fImage->alt.vector) {
2087 Warning(
"Flip",
"flip does not work for data images");
2125 Warning(
"Mirror",
"Image not valid");
2130 Warning(
"Mirror",
"Visual not initiated");
2134 if (
fImage->alt.vector) {
2135 Warning(
"Mirror",
"mirror does not work for data images");
2205 if (inbatch && !noX) {
2216 fgVisual = create_asvisual(0, 0, 0, 0);
2223 fgVisual = create_asvisual(0, 0, 0, 0);
2226 Display *disp = (Display*)
gVirtualX->GetDisplay();
2232 if (vis == 0 ||
cmap == 0) {
2233 fgVisual = create_asvisual(0, 0, 0, 0);
2235 fgVisual = create_asvisual_for_id(disp, screen, depth,
2236 XVisualIDFromVisual(vis),
cmap, 0);
2240 fgVisual = create_asvisual(0, 0, 0, 0);
2253 Warning(
"StartPaletteEditor",
"Image not valid");
2256 if (
fImage->alt.vector == 0) {
2257 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2272 Warning(
"GetPixmap",
"Visual not initiated");
2280 static int x11 = -1;
2281 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2287 if (!
fImage->alt.argb32) {
2290 ret =
gVirtualX->CreatePixmapFromData((
unsigned char*)
fImage->alt.argb32,
2306 Warning(
"GetMask",
"Visual not initiated");
2313 Warning(
"GetMask",
"No image");
2318 UInt_t ow = img->width%8;
2319 UInt_t ww = img->width - ow + (ow ? 8 : 0);
2326 char *bits =
new char[ww*hh];
2328 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALPHA,
2335 for (
y = 0;
y < hh;
y++) {
2336 imdec->decode_image_scanline(imdec);
2337 CARD32 *
a = imdec->buffer.alpha;
2339 for (
x = 0;
x < ww;
x++) {
2353 stop_image_decoding(&imdec);
2354 pxmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), (
const char *)bits,
2366 Warning(
"SetImage",
"Visual not initiated");
2380 static int x11 = -1;
2381 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2393 fImage = bitmap2asimage(bits,
w,
h, 0, 0);
2398 fImage = bitmap2asimage(bits,
w,
h, 0, mask_bits);
2399 delete [] mask_bits;
2410 Warning(
"GetPixels",
"Wrong Image");
2415 ASImageDecoder *imdec;
2429 if ((
x >= (
int)img->width) || (
y >= (
int)img->height)) {
2433 if ((
int)(
x +
width) > (
int)img->width) {
2437 if ((
int)(
y +
height) > (
int)img->height) {
2441 if ((imdec = start_image_decoding(0,
fImage, SCL_DO_ALL, 0,
y,
2442 img->width,
height, 0)) == 0) {
2443 Warning(
"GetPixels",
"Failed to create image decoder");
2454 imdec->decode_image_scanline(imdec);
2457 if ((
r == (
Int_t)imdec->buffer.red[i]) &&
2458 (
g == (
Int_t)imdec->buffer.green[i]) &&
2459 (
b == (
Int_t)imdec->buffer.blue[i])) {
2461 r = (
Int_t)imdec->buffer.red[i];
2462 g = (
Int_t)imdec->buffer.green[i];
2463 b = (
Int_t)imdec->buffer.blue[i];
2470 stop_image_decoding(&imdec);
2482 Warning(
"GetVecArray",
"Bad Image");
2485 if (
fImage->alt.vector) {
2486 return fImage->alt.vector;
2504 Warning(
"GetArray",
"Bad Image");
2510 if (
fImage->alt.vector) {
2515 ASImageDecoder *imdec;
2526 if ((imdec = start_image_decoding(0, img, SCL_DO_ALL, 0, 0,
2527 img->width, 0, 0)) == 0) {
2528 Warning(
"GetArray",
"Failed to create image decoder");
2539 for (
UInt_t k = 0; k <
h; k++) {
2540 imdec->decode_image_scanline(imdec);
2542 for (
UInt_t i = 0; i <
w; ++i) {
2543 if ((
r == imdec->buffer.red[i]) &&
2544 (
g == imdec->buffer.green[i]) &&
2545 (
b == imdec->buffer.blue[i])) {
2547 r = imdec->buffer.red[i];
2548 g = imdec->buffer.green[i];
2549 b = imdec->buffer.blue[i];
2557 stop_image_decoding(&imdec);
2580 const char *color,
const char *font_name,
2584 ARGB32 text_color = ARGB32_Black;
2585 ASImage *fore_im = 0;
2586 ASImage *text_im = 0;
2590 Warning(
"DrawText",
"Visual not initiated");
2598 if (fn.
Last(
'/') == 0) fn = fn(1, fn.
Length() - 1);
2611 parse_argb_color(color, &text_color);
2624 Warning(
"DrawText",
"cannot create Font Manager");
2633 Warning(
"DrawText",
"cannot find a font %s", font_name);
2645 text_im = draw_text(
text, font, (ASText3DType)
type, 0);
2650 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2652 if ((tmp->width !=
width) || (tmp->height !=
height)) {
2656 destroy_asimage(&tmp);
2663 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2664 destroy_asimage(&text_im);
2672 ASImage *rendered_im;
2673 ASImageLayer layers[2];
2675 init_image_layers(&(layers[0]), 2);
2676 fore_im->back_color = text_color;
2677 layers[0].im = rimg;
2678 layers[0].dst_x = 0;
2679 layers[0].dst_y = 0;
2680 layers[0].clip_width = rimg->width;
2681 layers[0].clip_height = rimg->height;
2682 layers[0].bevel = 0;
2683 layers[1].im = fore_im;
2684 layers[1].dst_x =
x;
2685 layers[1].dst_y =
y;
2686 layers[1].clip_width = fore_im->width;
2687 layers[1].clip_height = fore_im->height;
2689 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2692 destroy_asimage(&fore_im);
2725 Warning(
"Merge",
"Visual not initiated");
2729 ASImage *rendered_im;
2730 ASImageLayer layers[2];
2732 init_image_layers(&(layers[0]), 2);
2734 layers[0].dst_x = 0;
2735 layers[0].dst_y = 0;
2736 layers[0].clip_width =
fImage->width;
2737 layers[0].clip_height =
fImage->height;
2738 layers[0].bevel = 0;
2739 layers[1].im = ((
TASImage*)im)->fImage;
2740 layers[1].dst_x =
x;
2741 layers[1].dst_y =
y;
2742 layers[1].clip_width = im->
GetWidth();
2743 layers[1].clip_height = im->
GetHeight();
2744 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2762 Warning(
"Blur",
"Visual not initiated");
2767 fImage = create_asimage(100, 100, 0);
2770 Warning(
"Blur",
"Failed to create image");
2777 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2778 vr > 0 ? vr : 3, SCL_DO_ALL,
2791 Warning(
"Clone",
"Image not initiated");
2798 Warning(
"Clone",
"Failed to create image");
2814 if (
fImage->alt.argb32) {
2816 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2817 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2837 Warning(
"Vectorize",
"Visual not initiated");
2842 fImage = create_asimage(100, 100, 0);
2845 Warning(
"Vectorize",
"Failed to create image");
2856 dither = dither > 7 ? 7 : dither;
2858 res = colormap_asimage(
fImage, &
cmap, max_colors, dither, opaque_threshold);
2870 g = INDEX_SHIFT_GREEN(
cmap.entries[res[i]].green);
2871 b = INDEX_SHIFT_BLUE(
cmap.entries[res[i]].blue);
2872 r = INDEX_SHIFT_RED(
cmap.entries[res[i]].red);
2874 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2885 g = INDEX_SHIFT_GREEN(
cmap.entries[j].green);
2886 b = INDEX_SHIFT_BLUE(
cmap.entries[j].blue);
2887 r = INDEX_SHIFT_RED(
cmap.entries[j].red);
2888 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2890 v = (
v>>12) & 0x0FFF;
2905 if (res) safefree(res);
2951 Warning(
"HSV",
"Visual not initiated");
2959 Warning(
"HSV",
"Failed to create image");
2971 ASImage *rendered_im = 0;
2975 hue, radius,
H,
S, V, ASA_ASImage, 100,
2976 ASIMAGE_QUALITY_TOP);
2979 Warning(
"HSV",
"Failed to create rendered image");
3017 Warning(
"Gradient",
"Visual not initiated");
3021 ASImage *rendered_im = 0;
3022 ASGradient gradient;
3024 int reverse = 0, npoints1 = 0, npoints2 = 0;
3031 if ((
angle > 2 * 180 * 15 / 16) || (
angle < 2 * 180 * 1 / 16)) {
3032 gradient.type = GRADIENT_Left2Right;
3033 }
else if (
angle < 2 * 180 * 3 / 16) {
3034 gradient.type = GRADIENT_TopLeft2BottomRight;
3035 }
else if (
angle < 2 * 180 * 5 / 16) {
3036 gradient.type = GRADIENT_Top2Bottom;
3037 }
else if (
angle < 2 * 180 * 7 / 16) {
3038 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
3039 }
else if (
angle < 2 * 180 * 9 / 16) {
3040 gradient.type = GRADIENT_Left2Right; reverse = 1;
3041 }
else if (
angle < 2 * 180 * 11 / 16) {
3042 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3043 }
else if (
angle < 2 * 180 * 13 / 16) {
3044 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3046 gradient.type = GRADIENT_BottomLeft2TopRight;
3049 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3051 for (npoints1 = 0; *
p; npoints1++) {
3053 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3055 for ( ; isspace((
int)*
p);
p++) { }
3058 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3060 for (npoints2 = 0; *
p; npoints2++) {
3062 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3064 for ( ; isspace((
int)*
p);
p++) { }
3069 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3078 gradient.color =
new ARGB32[npoints1];
3079 gradient.offset =
new double[npoints1];
3081 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3083 for (npoints1 = 0; *
p; ) {
3087 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3089 for ( ; isspace((
int)*
p);
p++) { }
3091 col = str(pb -
colors,
p - pb);
3093 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3096 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3101 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3103 for (npoints2 = 0; *
p; ) {
3107 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3110 gradient.offset[npoints2] = strtod(pb, &pb);
3112 if (pb ==
p) npoints2++;
3114 for ( ; isspace((
int)*
p);
p++) { }
3117 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3118 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3121 gradient.npoints = npoints1;
3123 if (npoints2 && (gradient.npoints > npoints2)) {
3124 gradient.npoints = npoints2;
3127 for (i = 0; i < gradient.npoints/2; i++) {
3128 int i2 = gradient.npoints - 1 - i;
3129 ARGB32
c = gradient.color[i];
3130 double o = gradient.offset[i];
3131 gradient.color[i] = gradient.color[i2];
3132 gradient.color[i2] =
c;
3133 gradient.offset[i] = gradient.offset[i2];
3134 gradient.offset[i2] = o;
3136 for (i = 0; i < gradient.npoints; i++) {
3137 gradient.offset[i] = 1.0 - gradient.offset[i];
3143 delete [] gradient.color;
3144 delete [] gradient.offset;
3148 Warning(
"Gradient",
"Failed to create gradient image");
3157 ASImageLayer layers[2];
3159 init_image_layers(&(layers[0]), 2);
3161 layers[0].dst_x = 0;
3162 layers[0].dst_y = 0;
3163 layers[0].clip_width =
fImage->width;
3164 layers[0].clip_height =
fImage->height;
3165 layers[0].bevel = 0;
3166 layers[1].im = rendered_im;
3167 layers[1].dst_x =
x;
3168 layers[1].dst_y =
y;
3169 layers[1].clip_width =
width;
3170 layers[1].clip_height =
height;
3171 layers[1].merge_scanlines = alphablend_scanlines;
3176 Warning(
"Gradient",
"Failed to create merged image");
3180 destroy_asimage(&rendered_im);
3195 cmp = (cmp * 12) / 10;
3197 return (cmp > 255) ? 255 : cmp;
3218 return (background >> 1) & 0x7F7F7F7F;
3229 a = ARGB32_ALPHA8(
foreground) + ARGB32_ALPHA8(background);
3231 r = ARGB32_RED8(
foreground) + ARGB32_RED8(background);
3233 g = ARGB32_GREEN8(
foreground) + ARGB32_GREEN8(background);
3235 b = ARGB32_BLUE8(
foreground) + ARGB32_BLUE8(background);
3238 return MAKE_ARGB32(
a,
r,
g,
b);
3254 const char *hi_color,
const char *lo_color,
UShort_t thick,
3258 Warning(
"Bevel",
"Visual not initiated");
3265 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3266 parse_argb_color(hi_color, &
hi);
3267 parse_argb_color(lo_color, &lo);
3270 bevel.lo_color =
hi;
3272 bevel.hi_color = lo;
3275 bevel.hi_color =
hi;
3277 bevel.lo_color = lo;
3282 int extra_hilite = 2;
3283 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3284 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3286 if (bevel.top_outline > 1) {
3287 bevel.top_inline += bevel.top_outline - 1;
3290 if (bevel.left_outline > 1) {
3291 bevel.left_inline += bevel.left_outline - 1;
3294 if (bevel.right_outline > 1) {
3295 bevel.right_inline += bevel.right_outline - 1;
3298 if (bevel.bottom_outline > 1) {
3299 bevel.bottom_inline += bevel.bottom_outline - 1;
3303 ARGB32
fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3309 Warning(
"Bevel",
"Failed to create image");
3321 ASImageLayer layers[2];
3322 init_image_layers(&(layers[0]), 2);
3325 layers[0].dst_x = 0;
3326 layers[0].dst_y = 0;
3327 layers[0].clip_width =
fImage->width;
3328 layers[0].clip_height =
fImage->height;
3329 layers[0].bevel = 0;
3331 UInt_t w =
width - (bevel.left_outline + bevel.right_outline);
3332 UInt_t h =
height - (bevel.top_outline + bevel.bottom_outline);
3333 ASImage *bevel_im = create_asimage(
w,
h, 0);
3336 Warning(
"Bevel",
"Failed to create bevel image");
3340 layers[1].im = bevel_im;
3343 layers[1].dst_x =
x;
3344 layers[1].dst_y =
y;
3345 layers[1].clip_width =
width;
3346 layers[1].clip_height =
height;
3347 layers[1].bevel = &bevel;
3348 layers[1].merge_scanlines = alphablend_scanlines;
3352 destroy_asimage(&bevel_im);
3355 Warning(
"Bevel",
"Failed to image");
3375 Warning(
"Pad",
"Visual not initiated");
3380 fImage = create_asimage(100, 100, 0);
3383 Warning(
"Pad",
"Failed to create image");
3390 ARGB32 color = ARGB32_White;
3391 parse_argb_color(col, &color);
3402 Warning(
"Pad",
"Failed to create output image");
3419 Warning(
"Crop",
"Visual not initiated");
3435 Warning(
"Crop",
"input size larger than image");
3438 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3442 Warning(
"Crop",
"Failed to start image decoding");
3450 Warning(
"Crop",
"Failed to create image");
3454 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3458 Warning(
"Crop",
"Failed to start image output");
3459 destroy_asimage(&img);
3460 if (imdec)
delete [] imdec;
3469 imdec->decode_image_scanline(imdec);
3470 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3473 stop_image_decoding(&imdec);
3474 stop_image_output(&imout);
3498 Warning(
"Append",
"Visual not initiated");
3516 }
else if (opt ==
"/") {
3537 Warning(
"BeginPaint",
"Visual not initiated");
3552 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3555 Warning(
"BeginPaint",
"Failed to create image");
3569 Warning(
"EndPaint",
"no image");
3573 if (!
fImage->alt.argb32)
return;
3576 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3579 Warning(
"EndPaint",
"Failed to create image");
3596 Warning(
"GetArgbArray",
"no image");
3603 if (!img->alt.argb32) {
3613 return (
UInt_t *)img->alt.argb32;
3624 Warning(
"GetRgbaArray",
"no image");
3631 if (!img->alt.argb32) {
3649 for (i = 0; i < img->height; i++) {
3650 for (j = 0; j < img->width; j++) {
3652 argb = img->alt.argb32[idx];
3654 rgb = argb & 0x00ffffff;
3655 rgba = (rgb << 8) +
a;
3670 Warning(
"GetScanline",
"no image");
3675 CARD32 *ret =
new CARD32[img->width];
3677 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3678 0,
y, img->width, 1, 0);
3682 Warning(
"GetScanline",
"Failed to start image decoding");
3690 imdec->decode_image_scanline(imdec);
3691 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3692 stop_image_decoding(&imdec);
3707#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3708#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3709 "movl %1,%%edi \n" \
3710 "movl %2,%%ecx \n" \
3715 :"g" (val), "g" (dst), "g" (lng) \
3716 :"eax","edi","ecx" \
3720 #define _MEMSET_(dst, lng, val) do {\
3721 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3725#define FillSpansInternal(npt, ppt, widths, color) do {\
3726 UInt_t yy = ppt[0].fY*fImage->width;\
3727 for (UInt_t i = 0; i < npt; i++) {\
3728 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3729 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3741 Warning(
"FillRectangle",
"Visual not initiated");
3746 Warning(
"FillRectangle",
"no image");
3750 if (!
fImage->alt.argb32) {
3754 if (!
fImage->alt.argb32) {
3755 Warning(
"FillRectangle",
"Failed to get pixel array");
3759 ARGB32 color = (ARGB32)col;
3773 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3781 if (!
fImage->alt.argb32) {
3786 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3818 Warning(
"Fill",
"Visual not initiated");
3822 ARGB32 color = ARGB32_White;
3825 parse_argb_color(col, &color);
3843 ARGB32 color = (ARGB32)col;
3846 if (!thick) thick = 1;
3854 thick += (
x - half);
3865 if (
x + w < fImage->
width) {
3878 ARGB32 color = (ARGB32)col;
3881 if (!thick) thick = 1;
3889 thick += (
y - half);
3912 const char *col,
UInt_t thick)
3914 ARGB32 color = ARGB32_White;
3915 parse_argb_color(col, &color);
3927 int x,
y, xend, yend;
3934 Warning(
"DrawLine",
"Visual not initiated");
3939 Warning(
"DrawLine",
"no image");
3943 if (!
fImage->alt.argb32) {
3947 if (!
fImage->alt.argb32) {
3948 Warning(
"DrawLine",
"Failed to get pixel array");
3952 ARGB32 color = (ARGB32)col;
3957 if (!dx && !dy)
return;
3979 i2 = i1 - (dx << 1);
3996 q = (
y2 -
y1) * ydir;
4029 i2 = i1 - (dy << 1);
4046 q = (
x2 -
x1) * xdir;
4084 const char *col,
UInt_t thick)
4087 Warning(
"DrawRectangle",
"Visual not initiated");
4099 if (!
fImage->alt.argb32) {
4103 if (!
fImage->alt.argb32) {
4104 Warning(
"DrawRectangle",
"Failed to get pixel array");
4108 ARGB32 color = ARGB32_White;
4109 parse_argb_color(col, &color);
4129 ARGB32 color = ARGB32_White;
4140 parse_argb_color(col, &color);
4146 parse_argb_color(col, &color);
4176 ARGB32 color = (ARGB32)col;
4186 thick += (
y - half);
4189 thick = thick <= 0 ? 1 : thick;
4198 x2 =
x2 < tmp ? tmp :
x2;
4210 if (i >= pDash[iDash]) {
4214 if (iDash >= nDash) {
4230 ARGB32 color = (ARGB32)col;
4240 thick += (
x - half);
4243 thick = thick <= 0 ? 1 : thick;
4251 y2 =
y2 < tmp ? tmp :
y2;
4258 if (
x + w < fImage->
width) {
4266 if (i >= pDash[iDash]) {
4270 if (iDash >= nDash) {
4286 int x,
y, xend, yend;
4296 char *pDash =
new char[nDash];
4301 for (i = 0; i < (
int)nDash; i++) {
4307 i2 = i1 - (dx << 1);
4325 q = (
y2 -
y1) * ydir;
4330 if ((iDash%2) == 0) {
4342 if (i >= pDash[iDash]) {
4346 if (iDash >= nDash) {
4354 if ((iDash%2) == 0) {
4366 if (i >= pDash[iDash]) {
4370 if (iDash >= nDash) {
4379 for (i = 0; i < (
int)nDash; i++) {
4385 i2 = i1 - (dy << 1);
4403 q = (
x2 -
x1) * xdir;
4408 if ((iDash%2) == 0) {
4422 if (i >= pDash[iDash]) {
4426 if (iDash >= nDash) {
4434 if ((iDash%2) == 0) {
4448 if (i >= pDash[iDash]) {
4452 if (iDash >= nDash) {
4470 double x,
y, xend=0, yend=0, x0, y0;
4478 double *xDash =
new double[nDash];
4479 double *yDash =
new double[nDash];
4484 for (i = 0; i < (
int)nDash; i++) {
4485 xDash[i] = tDash[i] * ac;
4486 yDash[i] = tDash[i] *
as;
4490 xDash[i] = xDash[i]/2;
4491 yDash[i] = yDash[i]/2;
4493 xDash[i] = xDash[i]*2;
4494 yDash[i] = yDash[i]*2;
4511 q = (
y2 -
y1) * ydir;
4518 while ((
x < xend) && (
y < yend)) {
4522 if ((iDash%2) == 0) {
4532 if (iDash >= nDash) {
4537 while ((
x < xend) && (
y > yend)) {
4541 if ((iDash%2) == 0) {
4551 if (iDash >= nDash) {
4570 q = (
x2 -
x1) * xdir;
4577 while ((
x < xend) && (
y < yend)) {
4581 if ((iDash%2) == 0) {
4591 if (iDash >= nDash) {
4596 while ((
x > xend) && (
y < yend)) {
4600 if ((iDash%2) == 0) {
4610 if (iDash >= nDash) {
4624 const char *pDash,
const char *col,
UInt_t thick)
4628 Warning(
"DrawDashLine",
"Visual not initiated");
4633 Warning(
"DrawDashLine",
"no image");
4637 if (!
fImage->alt.argb32) {
4641 if (!
fImage->alt.argb32) {
4642 Warning(
"DrawDashLine",
"Failed to get pixel array");
4646 if ((nDash < 2) || !pDash || (nDash%2)) {
4647 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4651 ARGB32 color = ARGB32_White;
4652 parse_argb_color(col, &color);
4656 }
else if (
y1 ==
y2) {
4670 ARGB32 color = ARGB32_White;
4671 parse_argb_color(col, &color);
4678 for (
UInt_t i = 1; i < nn; i++) {
4695 Warning(
"PutPixel",
"Visual not initiated");
4700 Warning(
"PutPixel",
"no image");
4704 if (!
fImage->alt.argb32) {
4708 if (!
fImage->alt.argb32) {
4709 Warning(
"PutPixel",
"Failed to get pixel array");
4714 parse_argb_color(col, &color);
4716 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4717 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4730 Warning(
"PolyPoint",
"Visual not initiated");
4735 Warning(
"PolyPoint",
"no image");
4739 if (!
fImage->alt.argb32) {
4743 if (!
fImage->alt.argb32) {
4744 Warning(
"PolyPoint",
"Failed to get pixel array");
4749 Warning(
"PolyPoint",
"No points specified");
4756 parse_argb_color(col, &color);
4762 for (i = 0; i < npt; i++) {
4763 ipt[i].
fX += ppt[i].
fX;
4764 ipt[i].
fY += ppt[i].
fY;
4769 for (i = 0; i < npt; i++) {
4770 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4771 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4773 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4789 if (!nseg || !seg) {
4790 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4796 for (
UInt_t i = 0; i < nseg; i++) {
4797 pt[0].fX = seg->
fX1;
4798 pt[1].fX = seg->
fX2;
4799 pt[0].fY = seg->
fY1;
4800 pt[1].fY = seg->
fY2;
4814 Warning(
"FillSpans",
"Visual not initiated");
4819 Warning(
"FillSpans",
"no image");
4823 if (!
fImage->alt.argb32) {
4827 if (!
fImage->alt.argb32) {
4828 Warning(
"FillSpans",
"Failed to get pixel array");
4832 if (!npt || !ppt || !widths || (stipple && (!
w || !
h))) {
4833 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4834 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple,
w,
h);
4839 parse_argb_color(col, &color);
4844 for (
UInt_t i = 0; i < npt; i++) {
4846 for (
UInt_t j = 0; j < widths[i]; j++) {
4847 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4858 if (stipple[ii >> 3] & (1 << (ii%8))) {
4872 Warning(
"FillSpans",
"Visual not initiated");
4877 Warning(
"FillSpans",
"no image");
4881 if (!
fImage->alt.argb32) {
4885 if (!
fImage->alt.argb32) {
4886 Warning(
"FillSpans",
"Failed to get pixel array");
4890 if (!npt || !ppt || !widths || !tile) {
4891 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4892 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4904 for (
UInt_t i = 0; i < npt; i++) {
4907 for (
UInt_t j = 0; j < widths[i]; j++) {
4908 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4926 Warning(
"CropSpans",
"Visual not initiated");
4931 Warning(
"CropSpans",
"no image");
4935 if (!
fImage->alt.argb32) {
4939 if (!
fImage->alt.argb32) {
4940 Warning(
"CropSpans",
"Failed to get pixel array");
4944 if (!npt || !ppt || !widths) {
4945 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4950 int y1 = ppt[npt-1].
fY;
4958 for (
y = 0; (
int)
y < y0;
y++) {