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>
130static char *
gIconPaths[7] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
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 =
"";
406 if (!fp)
return nullptr;
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)) {
437 else if (magic == 0x50)
488 Warning(
"Scale",
"Visual not initiated");
505 set_output_threshold(0);
507 static ASImageImportParams iparams;
511 iparams.filter = SCL_DO_ALL;
512 iparams.gamma = SCREEN_GAMMA;
513 iparams.gamma_table = NULL;
515 iparams.format = ASA_ASImage;
517 iparams.subimage = 0;
518 iparams.return_animation_delay = -1;
524 ASImage *image =
nullptr;
535 iparams.subimage = ext.
Atoi();
537 ext = strrchr(fname.
Data(),
'.') + 1;
540 image = file2ASImage_extra(fname.
Data(), &iparams);
552 unsigned char *
bitmap =
nullptr;
558 if (!handler || ((handler->
LoadPlugin() == -1))) {
577 image = bitmap2asimage(
bitmap,
w,
h, 0,
nullptr);
657 Error(
"WriteImage",
"no image in memory. Draw something first");
662 Error(
"WriteImage",
"no file name specified");
667 if ((s = strrchr(
file,
'.'))) {
671 Error(
"WriteImage",
"cannot determine a valid file type");
679 Error(
"WriteImage",
"not a valid file type was specified");
685 ASImageFileTypes atype = (ASImageFileTypes)mytype;
693 static ASImageExportParams parms;
698 parms.xpm.type = atype;
699 parms.xpm.flags = EXPORT_ALPHA;
700 parms.xpm.dither = 4;
701 parms.xpm.opaque_threshold = 127;
702 parms.xpm.max_colors = 512;
705 ASImage2bmp(im, fname.
Data(),
nullptr);
708 ASImage2xcf(im, fname.
Data(),
nullptr);
711 parms.png.type = atype;
712 parms.png.flags = EXPORT_ALPHA;
716 parms.jpeg.type = atype;
717 parms.jpeg.flags = 0;
718 parms.jpeg.quality = aquality;
721 parms.gif.type = atype;
722 parms.gif.flags = EXPORT_ALPHA;
723 parms.gif.dither = 0;
724 parms.gif.opaque_threshold = 0;
728 parms.gif.type = atype;
729 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
730 parms.gif.dither = 0;
731 parms.gif.opaque_threshold = 0;
732 parms.gif.animate_repeats = 0;
745 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
746 parms.gif.animate_repeats = 0;
747 }
else if(sufix==
"") {
764 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
765 parms.gif.animate_repeats = atoi(s);
774 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
775 parms.gif.animate_repeats = 0;
776 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
782 delay = atoi(sDelay);
783 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
784 parms.gif.animate_repeats = atoi(sRepeats);
786 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
790 parms.gif.animate_delay = delay;
792 int i1 = fname.
Index(
"gif+");
794 fname = fname(0, i1 + 3);
797 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
803 parms.tiff.type = atype;
804 parms.tiff.flags = EXPORT_ALPHA;
805 parms.tiff.rows_per_strip = 0;
806 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
807 TIFF_COMPRESSION_NONE;
808 parms.tiff.jpeg_quality = 100;
809 parms.tiff.opaque_threshold = 0;
812 Error(
"WriteImage",
"file type %s not yet supported", s);
816 if (!ASImage2file(im,
nullptr, fname.
Data(), atype, &parms)) {
817 Error(
"WriteImage",
"error writing file %s",
file);
835 if (s ==
"jpg" || s ==
"jpeg")
874 astype = ASIT_Xpm;
break;
876 astype = ASIT_ZCompressedXpm;
break;
878 astype = ASIT_GZCompressedXpm;
break;
880 astype = ASIT_Png;
break;
882 astype = ASIT_Jpeg;
break;
884 astype = ASIT_Xcf;
break;
886 astype = ASIT_Ppm;
break;
888 astype = ASIT_Pnm;
break;
890 astype = ASIT_Bmp;
break;
892 astype = ASIT_Ico;
break;
894 astype = ASIT_Cur;
break;
896 astype = ASIT_Gif;
break;
898 astype = ASIT_Gif;
break;
900 astype = ASIT_Tiff;
break;
902 astype = ASIT_Xbm;
break;
904 astype = ASIT_Targa;
break;
906 astype = ASIT_XMLScript;
break;
908 astype = ASIT_Unknown;
914 case ASIT_ZCompressedXpm:
916 case ASIT_GZCompressedXpm:
959 asquality = 25;
break;
961 asquality = 75;
break;
963 asquality = 50;
break;
965 asquality = 100;
break;
971 if (asquality > 0 && asquality <= 25)
973 if (asquality > 26 && asquality <= 50)
975 if (asquality > 51 && asquality <= 75)
977 if (asquality > 76 && asquality <= 100)
997 Warning(
"SetImage",
"Visual not initiated");
1015 ASVectorPalette asPalette;
1019 for (col = 0; col < 4; col++)
1020 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1027 asPalette.points =
new Double_t[asPalette.npoints];
1028 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1032 height, &asPalette, ASA_ASImage,
1035 delete [] asPalette.points;
1036 for (col = 0; col < 4; col++)
1037 delete [] asPalette.channels[col];
1081 Error(
"FromPad",
"pad cannot be 0");
1086 Warning(
"FromPad",
"Visual not initiated");
1096 if (
gROOT->IsBatch()) {
1104 if (itmp && itmp->
fImage) {
1113 if (itmp && itmp->
fImage && (itmp !=
this)) {
1115 if (itmp->
fImage->alt.argb32) {
1117 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1118 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1145 static int x11 = -1;
1146 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1151 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0,
w,
h);
1156 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
1177 Error(
"Draw",
"no image set");
1205 gPad->Range(-left / (1.0 - left - right),
1206 -bottom / (1.0 - top - bottom),
1207 1 + right / (1.0 - left - right),
1208 1 + top / ( 1.0 - top - bottom));
1209 gPad->RangeAxis(0, 0, 1, 1);
1232 wsrc = wsrc ? wsrc : im->width;
1233 hsrc = hsrc ? hsrc : im->height;
1235 static int x11 = -1;
1236 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1243 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1250 char *bits =
new char[ww*hh];
1252 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1253 xsrc, ysrc, ww, 0,
nullptr);
1255 for (yy = 0; yy < hh; yy++) {
1256 imdec->decode_image_scanline(imdec);
1257 CARD32 *
a = imdec->buffer.alpha;
1259 for (xx = 0; xx < ww; xx++) {
1274 stop_image_decoding(&imdec);
1277 (
const char *)bits, ww, hh);
1295 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1296 asimage2drawable(
fgVisual,
wid, im, (GC)
gc, xsrc, ysrc,
x,
y, wsrc, hsrc, 1);
1298 ASImage *img =
nullptr;
1299 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1301 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1302 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1304 bits = (
unsigned char *)img->alt.argb32;
1311 if (
gPad &&
gPad->GetGLDevice() != -1) {
1313 painter->DrawPixels(bits, wsrc, hsrc,
x,
y, !
option.Contains(
"opaque"));
1317 if (!
option.Contains(
"opaque")) {
1328 destroy_asimage(&img);
1353 xsrc, ysrc, wsrc, hsrc, opt);
1372 Error(
"Paint",
"no image set");
1377 Warning(
"Paint",
"Visual not initiated");
1381 Int_t tile_x = 0, tile_y = 0;
1382 CARD32 tile_tint = 0;
1391 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1394 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1397 Error(
"Paint",
"tile option error");
1405 if (!
fImage->alt.vector) {
1418 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1419 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1422 if ((to_w < 25 || to_h < 25) && !expand) {
1423 Error(
"Paint",
"pad too small to display an image");
1435 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1436 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1438 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1439 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1444 ASImage *grad_im =
nullptr;
1452 grad.type = GRADIENT_Top2Bottom;
1453 grad.color =
new ARGB32[grad.npoints];
1454 grad.offset =
new double[grad.npoints];
1457 Int_t oldPt = grad.npoints -
pt -1;
1458 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1459 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1461 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1462 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1466 pal_h, SCL_DO_COLOR,
1469 delete [] grad.color;
1470 delete [] grad.offset;
1478 to_w, to_h, tile_tint, ASA_ASImage,
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");
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,
nullptr);
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,
nullptr);
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;
1714 gPad->ExecuteEvent(event, px, py);
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");
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");
2091 Int_t rflip = flip/90;
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(
nullptr, 0, 0,
nullptr);
2223 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2226 Display *disp = (Display*)
gVirtualX->GetDisplay();
2232 if (!vis ||
cmap == 0) {
2233 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2235 fgVisual = create_asvisual_for_id(disp, screen, depth,
2236 XVisualIDFromVisual(vis),
cmap,
nullptr);
2240 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2253 Warning(
"StartPaletteEditor",
"Image not valid");
2256 if (!
fImage->alt.vector) {
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");
2285 img,
nullptr,
kTRUE);
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,
2329 0, 0, ww, 0,
nullptr);
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,
nullptr);
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(
nullptr,
fImage, SCL_DO_ALL, 0,
y,
2442 img->width,
height,
nullptr)) ==
nullptr) {
2443 Warning(
"GetPixels",
"Failed to create image decoder");
2452 imdec->decode_image_scanline(imdec);
2455 if ((
r == (
Int_t)imdec->buffer.red[i]) &&
2456 (
g == (
Int_t)imdec->buffer.green[i]) &&
2457 (
b == (
Int_t)imdec->buffer.blue[i])) {
2459 r = (
Int_t)imdec->buffer.red[i];
2460 g = (
Int_t)imdec->buffer.green[i];
2461 b = (
Int_t)imdec->buffer.blue[i];
2468 stop_image_decoding(&imdec);
2480 Warning(
"GetVecArray",
"Bad Image");
2483 if (
fImage->alt.vector) {
2484 return fImage->alt.vector;
2502 Warning(
"GetArray",
"Bad Image");
2508 if (
fImage->alt.vector) {
2513 ASImageDecoder *imdec;
2524 if ((imdec = start_image_decoding(
nullptr, img, SCL_DO_ALL, 0, 0,
2525 img->width, 0,
nullptr)) ==
nullptr) {
2526 Warning(
"GetArray",
"Failed to create image decoder");
2531 CARD32
r = 0,
g = 0,
b = 0;
2535 for (
UInt_t k = 0; k <
h; k++) {
2536 imdec->decode_image_scanline(imdec);
2538 for (
UInt_t i = 0; i <
w; ++i) {
2539 if ((
r == imdec->buffer.red[i]) &&
2540 (
g == imdec->buffer.green[i]) &&
2541 (
b == imdec->buffer.blue[i])) {
2543 r = imdec->buffer.red[i];
2544 g = imdec->buffer.green[i];
2545 b = imdec->buffer.blue[i];
2553 stop_image_decoding(&imdec);
2576 const char *color,
const char *font_name,
2580 ARGB32 text_color = ARGB32_Black;
2581 ASImage *fore_im =
nullptr;
2582 ASImage *text_im =
nullptr;
2586 Warning(
"DrawText",
"Visual not initiated");
2594 if (fn.
Last(
'/') == 0) fn = fn(1, fn.
Length() - 1);
2607 parse_argb_color(color, &text_color);
2620 Warning(
"DrawText",
"cannot create Font Manager");
2629 Warning(
"DrawText",
"cannot find a font %s", font_name);
2641 text_im = draw_text(
text, font, (ASText3DType)
type, 0);
2646 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2648 if ((tmp->width !=
width) || (tmp->height !=
height)) {
2652 destroy_asimage(&tmp);
2659 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2660 destroy_asimage(&text_im);
2668 ASImage *rendered_im;
2669 ASImageLayer layers[2];
2671 init_image_layers(&(layers[0]), 2);
2672 fore_im->back_color = text_color;
2673 layers[0].im = rimg;
2674 layers[0].dst_x = 0;
2675 layers[0].dst_y = 0;
2676 layers[0].clip_width = rimg->width;
2677 layers[0].clip_height = rimg->height;
2678 layers[0].bevel =
nullptr;
2679 layers[1].im = fore_im;
2680 layers[1].dst_x =
x;
2681 layers[1].dst_y =
y;
2682 layers[1].clip_width = fore_im->width;
2683 layers[1].clip_height = fore_im->height;
2685 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2688 destroy_asimage(&fore_im);
2721 Warning(
"Merge",
"Visual not initiated");
2725 ASImage *rendered_im;
2726 ASImageLayer layers[2];
2728 init_image_layers(&(layers[0]), 2);
2730 layers[0].dst_x = 0;
2731 layers[0].dst_y = 0;
2732 layers[0].clip_width =
fImage->width;
2733 layers[0].clip_height =
fImage->height;
2734 layers[0].bevel =
nullptr;
2735 layers[1].im = ((
TASImage*)im)->fImage;
2736 layers[1].dst_x =
x;
2737 layers[1].dst_y =
y;
2738 layers[1].clip_width = im->
GetWidth();
2739 layers[1].clip_height = im->
GetHeight();
2740 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2758 Warning(
"Blur",
"Visual not initiated");
2763 fImage = create_asimage(100, 100, 0);
2766 Warning(
"Blur",
"Failed to create image");
2773 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2774 vr > 0 ? vr : 3, SCL_DO_ALL,
2787 Warning(
"Clone",
"Image not initiated");
2794 Warning(
"Clone",
"Failed to create image");
2810 if (
fImage->alt.argb32) {
2812 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2813 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2833 Warning(
"Vectorize",
"Visual not initiated");
2838 fImage = create_asimage(100, 100, 0);
2841 Warning(
"Vectorize",
"Failed to create image");
2852 dither = dither > 7 ? 7 : dither;
2854 res = colormap_asimage(
fImage, &
cmap, max_colors, dither, opaque_threshold);
2866 g = INDEX_SHIFT_GREEN(
cmap.entries[res[i]].green);
2867 b = INDEX_SHIFT_BLUE(
cmap.entries[res[i]].blue);
2868 r = INDEX_SHIFT_RED(
cmap.entries[res[i]].red);
2870 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2881 g = INDEX_SHIFT_GREEN(
cmap.entries[j].green);
2882 b = INDEX_SHIFT_BLUE(
cmap.entries[j].blue);
2883 r = INDEX_SHIFT_RED(
cmap.entries[j].red);
2884 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2886 v = (
v>>12) & 0x0FFF;
2901 if (res) safefree(res);
2947 Warning(
"HSV",
"Visual not initiated");
2955 Warning(
"HSV",
"Failed to create image");
2967 ASImage *rendered_im =
nullptr;
2971 hue, radius,
H, S, V, ASA_ASImage, 100,
2972 ASIMAGE_QUALITY_TOP);
2975 Warning(
"HSV",
"Failed to create rendered image");
3013 Warning(
"Gradient",
"Visual not initiated");
3017 ASImage *rendered_im =
nullptr;
3018 ASGradient gradient;
3020 int reverse = 0, npoints1 = 0, npoints2 = 0;
3027 if ((
angle > 2 * 180 * 15 / 16) || (
angle < 2 * 180 * 1 / 16)) {
3028 gradient.type = GRADIENT_Left2Right;
3029 }
else if (
angle < 2 * 180 * 3 / 16) {
3030 gradient.type = GRADIENT_TopLeft2BottomRight;
3031 }
else if (
angle < 2 * 180 * 5 / 16) {
3032 gradient.type = GRADIENT_Top2Bottom;
3033 }
else if (
angle < 2 * 180 * 7 / 16) {
3034 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
3035 }
else if (
angle < 2 * 180 * 9 / 16) {
3036 gradient.type = GRADIENT_Left2Right; reverse = 1;
3037 }
else if (
angle < 2 * 180 * 11 / 16) {
3038 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3039 }
else if (
angle < 2 * 180 * 13 / 16) {
3040 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3042 gradient.type = GRADIENT_BottomLeft2TopRight;
3045 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3047 for (npoints1 = 0; *
p; npoints1++) {
3049 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3051 for ( ; isspace((
int)*
p);
p++) { }
3054 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3056 for (npoints2 = 0; *
p; npoints2++) {
3058 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3060 for ( ; isspace((
int)*
p);
p++) { }
3065 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3074 gradient.color =
new ARGB32[npoints1];
3075 gradient.offset =
new double[npoints1];
3077 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3079 for (npoints1 = 0; *
p; ) {
3083 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3085 for ( ; isspace((
int)*
p);
p++) { }
3087 col = str(pb -
colors,
p - pb);
3089 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3092 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3097 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3099 for (npoints2 = 0; *
p; ) {
3103 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3106 gradient.offset[npoints2] = strtod(pb, &pb);
3108 if (pb ==
p) npoints2++;
3110 for ( ; isspace((
int)*
p);
p++) { }
3113 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3114 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3117 gradient.npoints = npoints1;
3119 if (npoints2 && (gradient.npoints > npoints2)) {
3120 gradient.npoints = npoints2;
3123 for (i = 0; i < gradient.npoints/2; i++) {
3124 int i2 = gradient.npoints - 1 - i;
3125 ARGB32
c = gradient.color[i];
3126 double o = gradient.offset[i];
3127 gradient.color[i] = gradient.color[i2];
3128 gradient.color[i2] =
c;
3129 gradient.offset[i] = gradient.offset[i2];
3130 gradient.offset[i2] = o;
3132 for (i = 0; i < gradient.npoints; i++) {
3133 gradient.offset[i] = 1.0 - gradient.offset[i];
3139 delete [] gradient.color;
3140 delete [] gradient.offset;
3144 Warning(
"Gradient",
"Failed to create gradient image");
3153 ASImageLayer layers[2];
3155 init_image_layers(&(layers[0]), 2);
3157 layers[0].dst_x = 0;
3158 layers[0].dst_y = 0;
3159 layers[0].clip_width =
fImage->width;
3160 layers[0].clip_height =
fImage->height;
3161 layers[0].bevel =
nullptr;
3162 layers[1].im = rendered_im;
3163 layers[1].dst_x =
x;
3164 layers[1].dst_y =
y;
3165 layers[1].clip_width =
width;
3166 layers[1].clip_height =
height;
3167 layers[1].merge_scanlines = alphablend_scanlines;
3172 Warning(
"Gradient",
"Failed to create merged image");
3176 destroy_asimage(&rendered_im);
3191 cmp = (cmp * 12) / 10;
3193 return (cmp > 255) ? 255 : cmp;
3214 return (background >> 1) & 0x7F7F7F7F;
3225 a = ARGB32_ALPHA8(
foreground) + ARGB32_ALPHA8(background);
3227 r = ARGB32_RED8(
foreground) + ARGB32_RED8(background);
3229 g = ARGB32_GREEN8(
foreground) + ARGB32_GREEN8(background);
3231 b = ARGB32_BLUE8(
foreground) + ARGB32_BLUE8(background);
3234 return MAKE_ARGB32(
a,
r,
g,
b);
3250 const char *hi_color,
const char *lo_color,
UShort_t thick,
3254 Warning(
"Bevel",
"Visual not initiated");
3261 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3262 parse_argb_color(hi_color, &
hi);
3263 parse_argb_color(lo_color, &lo);
3266 bevel.lo_color =
hi;
3268 bevel.hi_color = lo;
3271 bevel.hi_color =
hi;
3273 bevel.lo_color = lo;
3278 int extra_hilite = 2;
3279 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3280 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3282 if (bevel.top_outline > 1) {
3283 bevel.top_inline += bevel.top_outline - 1;
3286 if (bevel.left_outline > 1) {
3287 bevel.left_inline += bevel.left_outline - 1;
3290 if (bevel.right_outline > 1) {
3291 bevel.right_inline += bevel.right_outline - 1;
3294 if (bevel.bottom_outline > 1) {
3295 bevel.bottom_inline += bevel.bottom_outline - 1;
3299 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3305 Warning(
"Bevel",
"Failed to create image");
3317 ASImageLayer layers[2];
3318 init_image_layers(&(layers[0]), 2);
3321 layers[0].dst_x = 0;
3322 layers[0].dst_y = 0;
3323 layers[0].clip_width =
fImage->width;
3324 layers[0].clip_height =
fImage->height;
3325 layers[0].bevel =
nullptr;
3327 UInt_t w =
width - (bevel.left_outline + bevel.right_outline);
3328 UInt_t h =
height - (bevel.top_outline + bevel.bottom_outline);
3329 ASImage *bevel_im = create_asimage(
w,
h, 0);
3332 Warning(
"Bevel",
"Failed to create bevel image");
3336 layers[1].im = bevel_im;
3337 fill_asimage(
fgVisual, bevel_im, 0, 0,
w,
h, fill);
3339 layers[1].dst_x =
x;
3340 layers[1].dst_y =
y;
3341 layers[1].clip_width =
width;
3342 layers[1].clip_height =
height;
3343 layers[1].bevel = &bevel;
3344 layers[1].merge_scanlines = alphablend_scanlines;
3348 destroy_asimage(&bevel_im);
3351 Warning(
"Bevel",
"Failed to image");
3371 Warning(
"Pad",
"Visual not initiated");
3376 fImage = create_asimage(100, 100, 0);
3379 Warning(
"Pad",
"Failed to create image");
3386 ARGB32 color = ARGB32_White;
3387 parse_argb_color(col, &color);
3398 Warning(
"Pad",
"Failed to create output image");
3415 Warning(
"Crop",
"Visual not initiated");
3431 Warning(
"Crop",
"input size larger than image");
3434 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3438 Warning(
"Crop",
"Failed to start image decoding");
3446 Warning(
"Crop",
"Failed to create image");
3450 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3454 Warning(
"Crop",
"Failed to start image output");
3455 destroy_asimage(&img);
3456 if (imdec)
delete [] imdec;
3465 imdec->decode_image_scanline(imdec);
3466 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3469 stop_image_decoding(&imdec);
3470 stop_image_output(&imout);
3494 Warning(
"Append",
"Visual not initiated");
3512 }
else if (opt ==
"/") {
3533 Warning(
"BeginPaint",
"Visual not initiated");
3548 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3551 Warning(
"BeginPaint",
"Failed to create image");
3565 Warning(
"EndPaint",
"no image");
3569 if (!
fImage->alt.argb32)
return;
3572 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3575 Warning(
"EndPaint",
"Failed to create image");
3592 Warning(
"GetArgbArray",
"no image");
3597 if (!img)
return nullptr;
3599 if (!img->alt.argb32) {
3609 return (
UInt_t *)img->alt.argb32;
3620 Warning(
"GetRgbaArray",
"no image");
3625 if (!img)
return nullptr;
3627 if (!img->alt.argb32) {
3644 for (i = 0; i < img->height; i++) {
3645 for (j = 0; j < img->width; j++) {
3647 argb = img->alt.argb32[idx];
3649 rgb = argb & 0x00ffffff;
3650 rgba = (rgb << 8) +
a;
3665 Warning(
"GetScanline",
"no image");
3670 CARD32 *ret =
new CARD32[img->width];
3672 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3673 0,
y, img->width, 1,
nullptr);
3677 Warning(
"GetScanline",
"Failed to start image decoding");
3685 imdec->decode_image_scanline(imdec);
3686 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3687 stop_image_decoding(&imdec);
3702#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3703#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3704 "movl %1,%%edi \n" \
3705 "movl %2,%%ecx \n" \
3710 :"g" (val), "g" (dst), "g" (lng) \
3711 :"eax","edi","ecx" \
3715 #define _MEMSET_(dst, lng, val) do {\
3716 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3720#define FillSpansInternal(npt, ppt, widths, color) do {\
3721 UInt_t yy = ppt[0].fY*fImage->width;\
3722 for (UInt_t i = 0; i < npt; i++) {\
3723 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3724 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3736 Warning(
"FillRectangle",
"Visual not initiated");
3741 Warning(
"FillRectangle",
"no image");
3745 if (!
fImage->alt.argb32) {
3749 if (!
fImage->alt.argb32) {
3750 Warning(
"FillRectangle",
"Failed to get pixel array");
3754 ARGB32 color = (ARGB32)col;
3768 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3776 if (!
fImage->alt.argb32) {
3781 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3813 Warning(
"Fill",
"Visual not initiated");
3817 ARGB32 color = ARGB32_White;
3820 parse_argb_color(col, &color);
3838 ARGB32 color = (ARGB32)col;
3841 if (!thick) thick = 1;
3849 thick += (
x - half);
3860 if (
x + w < fImage->
width) {
3873 ARGB32 color = (ARGB32)col;
3876 if (!thick) thick = 1;
3884 thick += (
y - half);
3907 const char *col,
UInt_t thick)
3909 ARGB32 color = ARGB32_White;
3910 parse_argb_color(col, &color);
3922 int x,
y, xend, yend;
3929 Warning(
"DrawLine",
"Visual not initiated");
3934 Warning(
"DrawLine",
"no image");
3938 if (!
fImage->alt.argb32) {
3942 if (!
fImage->alt.argb32) {
3943 Warning(
"DrawLine",
"Failed to get pixel array");
3947 ARGB32 color = (ARGB32)col;
3952 if (!dx && !dy)
return;
3974 i2 = i1 - (dx << 1);
3991 q = (
y2 -
y1) * ydir;
4024 i2 = i1 - (dy << 1);
4041 q = (
x2 -
x1) * xdir;
4079 const char *col,
UInt_t thick)
4082 Warning(
"DrawRectangle",
"Visual not initiated");
4094 if (!
fImage->alt.argb32) {
4098 if (!
fImage->alt.argb32) {
4099 Warning(
"DrawRectangle",
"Failed to get pixel array");
4103 ARGB32 color = ARGB32_White;
4104 parse_argb_color(col, &color);
4124 ARGB32 color = ARGB32_White;
4135 parse_argb_color(col, &color);
4141 parse_argb_color(col, &color);
4171 ARGB32 color = (ARGB32)col;
4181 thick += (
y - half);
4184 thick = thick <= 0 ? 1 : thick;
4193 x2 =
x2 < tmp ? tmp :
x2;
4205 if (i >= pDash[iDash]) {
4209 if (iDash >= nDash) {
4225 ARGB32 color = (ARGB32)col;
4235 thick += (
x - half);
4238 thick = thick <= 0 ? 1 : thick;
4246 y2 =
y2 < tmp ? tmp :
y2;
4253 if (
x + w < fImage->
width) {
4261 if (i >= pDash[iDash]) {
4265 if (iDash >= nDash) {
4281 int x,
y, xend, yend;
4291 char *pDash =
new char[nDash];
4296 for (i = 0; i < (
int)nDash; i++) {
4302 i2 = i1 - (dx << 1);
4320 q = (
y2 -
y1) * ydir;
4325 if ((iDash%2) == 0) {
4337 if (i >= pDash[iDash]) {
4341 if (iDash >= nDash) {
4349 if ((iDash%2) == 0) {
4361 if (i >= pDash[iDash]) {
4365 if (iDash >= nDash) {
4374 for (i = 0; i < (
int)nDash; i++) {
4380 i2 = i1 - (dy << 1);
4398 q = (
x2 -
x1) * xdir;
4403 if ((iDash%2) == 0) {
4417 if (i >= pDash[iDash]) {
4421 if (iDash >= nDash) {
4429 if ((iDash%2) == 0) {
4443 if (i >= pDash[iDash]) {
4447 if (iDash >= nDash) {
4465 double x,
y, xend=0, yend=0, x0, y0;
4473 double *xDash =
new double[nDash];
4474 double *yDash =
new double[nDash];
4479 for (i = 0; i < (
int)nDash; i++) {
4480 xDash[i] = tDash[i] * ac;
4481 yDash[i] = tDash[i] * as;
4485 xDash[i] = xDash[i]/2;
4486 yDash[i] = yDash[i]/2;
4488 xDash[i] = xDash[i]*2;
4489 yDash[i] = yDash[i]*2;
4506 q = (
y2 -
y1) * ydir;
4513 while ((
x < xend) && (
y < yend)) {
4517 if ((iDash%2) == 0) {
4527 if (iDash >= nDash) {
4532 while ((
x < xend) && (
y > yend)) {
4536 if ((iDash%2) == 0) {
4546 if (iDash >= nDash) {
4565 q = (
x2 -
x1) * xdir;
4572 while ((
x < xend) && (
y < yend)) {
4576 if ((iDash%2) == 0) {
4586 if (iDash >= nDash) {
4591 while ((
x > xend) && (
y < yend)) {
4595 if ((iDash%2) == 0) {
4605 if (iDash >= nDash) {
4619 const char *pDash,
const char *col,
UInt_t thick)
4623 Warning(
"DrawDashLine",
"Visual not initiated");
4628 Warning(
"DrawDashLine",
"no image");
4632 if (!
fImage->alt.argb32) {
4636 if (!
fImage->alt.argb32) {
4637 Warning(
"DrawDashLine",
"Failed to get pixel array");
4641 if ((nDash < 2) || !pDash || (nDash%2)) {
4642 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4646 ARGB32 color = ARGB32_White;
4647 parse_argb_color(col, &color);
4651 }
else if (
y1 ==
y2) {
4665 ARGB32 color = ARGB32_White;
4666 parse_argb_color(col, &color);
4673 for (
UInt_t i = 1; i < nn; i++) {
4690 Warning(
"PutPixel",
"Visual not initiated");
4695 Warning(
"PutPixel",
"no image");
4699 if (!
fImage->alt.argb32) {
4703 if (!
fImage->alt.argb32) {
4704 Warning(
"PutPixel",
"Failed to get pixel array");
4709 parse_argb_color(col, &color);
4711 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4712 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4725 Warning(
"PolyPoint",
"Visual not initiated");
4730 Warning(
"PolyPoint",
"no image");
4734 if (!
fImage->alt.argb32) {
4738 if (!
fImage->alt.argb32) {
4739 Warning(
"PolyPoint",
"Failed to get pixel array");
4744 Warning(
"PolyPoint",
"No points specified");
4751 parse_argb_color(col, &color);
4757 for (i = 0; i < npt; i++) {
4758 ipt[i].
fX += ppt[i].
fX;
4759 ipt[i].
fY += ppt[i].
fY;
4764 for (i = 0; i < npt; i++) {
4765 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4766 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4768 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4784 if (!nseg || !seg) {
4785 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4791 for (
UInt_t i = 0; i < nseg; i++) {
4792 pt[0].fX = seg->
fX1;
4793 pt[1].fX = seg->
fX2;
4794 pt[0].fY = seg->
fY1;
4795 pt[1].fY = seg->
fY2;
4809 Warning(
"FillSpans",
"Visual not initiated");
4814 Warning(
"FillSpans",
"no image");
4818 if (!
fImage->alt.argb32) {
4822 if (!
fImage->alt.argb32) {
4823 Warning(
"FillSpans",
"Failed to get pixel array");
4827 if (!npt || !ppt || !widths || (stipple && (!
w || !
h))) {
4828 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4829 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple,
w,
h);
4834 parse_argb_color(col, &color);
4839 for (
UInt_t i = 0; i < npt; i++) {
4841 for (
UInt_t j = 0; j < widths[i]; j++) {
4842 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4853 if (stipple[ii >> 3] & (1 << (ii%8))) {
4867 Warning(
"FillSpans",
"Visual not initiated");
4872 Warning(
"FillSpans",
"no image");
4876 if (!
fImage->alt.argb32) {
4880 if (!
fImage->alt.argb32) {
4881 Warning(
"FillSpans",
"Failed to get pixel array");
4885 if (!npt || !ppt || !widths || !tile) {
4886 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4887 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4899 for (
UInt_t i = 0; i < npt; i++) {
4902 for (
UInt_t j = 0; j < widths[i]; j++) {
4903 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4921 Warning(
"CropSpans",
"Visual not initiated");
4926 Warning(
"CropSpans",
"no image");
4930 if (!
fImage->alt.argb32) {
4934 if (!
fImage->alt.argb32) {
4935 Warning(
"CropSpans",
"Failed to get pixel array");
4939 if (!npt || !ppt || !widths) {
4940 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4945 int y1 = ppt[npt-1].
fY;
4953 for (
y = 0; (
int)
y < y0;
y++) {
4956 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4961 for (i = 0; i < npt; i++) {
4962 for (
x = 0; (
int)
x < ppt[i].fX;
x++) {
4964 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4966 for (
x = ppt[i].fX + widths[i] + 1;
x <
fImage->width;
x++) {