64#include "RConfigure.h"
102# include "Windows4root.h"
106# define X_DISPLAY_MISSING 1
108# include <afterbase.h>
110# include <win32/config.h>
111# include <win32/afterbase.h>
112# define X_DISPLAY_MISSING 1
114# include <afterimage.h>
132static char *
gIconPaths[7] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
139#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER
140#pragma GCC diagnostic ignored "-Wstrict-aliasing"
161#define _alphaBlend(bot, top) {\
162 __argb32__ *T = (__argb32__*)(top);\
163 __argb32__ *B = (__argb32__*)(bot);\
168 B->a = ((B->a*aa)>>8) + T->a;\
169 B->r = (B->r*aa + T->r*T->a)>>8;\
170 B->g = (B->g*aa + T->g*T->a)>>8;\
171 B->b = (B->b*aa + T->b*T->a)>>8;\
238 fImage = create_asimage(
w ?
w : 20,
h ?
h : 20, 0);
305 if (img.
fImage->alt.vector) {
326 if (
this != &img && img.
IsValid()) {
335 if (img.
fImage->alt.vector) {
385 const char *delim =
":";
387 const char *delim =
";";
389 while (icon_path.
Tokenize(token, from, delim) && cnt < 6) {
405 FILE *fp = fopen(
file,
"rb");
406 const char *ret =
"";
408 if (!fp)
return nullptr;
410 if (!fread(&magic, 1, 1, fp)) {
418 if (!fread(&magic, 1, 1, fp)) {
422 if (!fread(&magic, 1, 1, fp)) {
427 ret = (magic == 1) ?
"ico" :
"cur";
432 if (!fread(&magic, 1, 1, fp)) {
439 else if (magic == 0x50)
490 Warning(
"Scale",
"Visual not initiated");
507 set_output_threshold(0);
509 static ASImageImportParams iparams;
513 iparams.filter = SCL_DO_ALL;
514 iparams.gamma = SCREEN_GAMMA;
515 iparams.gamma_table = NULL;
517 iparams.format = ASA_ASImage;
519 iparams.subimage = 0;
520 iparams.return_animation_delay = -1;
526 ASImage *image =
nullptr;
537 iparams.subimage = ext.
Atoi();
539 ext = strrchr(fname.
Data(),
'.') + 1;
542 image = file2ASImage_extra(fname.
Data(), &iparams);
554 unsigned char *
bitmap =
nullptr;
560 if (!handler || ((handler->
LoadPlugin() == -1))) {
579 image = bitmap2asimage(
bitmap,
w,
h, 0,
nullptr);
659 Error(
"WriteImage",
"no image in memory. Draw something first");
664 Error(
"WriteImage",
"no file name specified");
669 if ((s = strrchr(
file,
'.'))) {
673 Error(
"WriteImage",
"cannot determine a valid file type");
681 Error(
"WriteImage",
"not a valid file type was specified");
687 ASImageFileTypes atype = (ASImageFileTypes)mytype;
695 static ASImageExportParams parms;
700 parms.xpm.type = atype;
701 parms.xpm.flags = EXPORT_ALPHA;
702 parms.xpm.dither = 4;
703 parms.xpm.opaque_threshold = 127;
704 parms.xpm.max_colors = 512;
707 ASImage2bmp(im, fname.
Data(),
nullptr);
710 ASImage2xcf(im, fname.
Data(),
nullptr);
713 parms.png.type = atype;
714 parms.png.flags = EXPORT_ALPHA;
718 parms.jpeg.type = atype;
719 parms.jpeg.flags = 0;
720 parms.jpeg.quality = aquality;
723 parms.gif.type = atype;
724 parms.gif.flags = EXPORT_ALPHA;
725 parms.gif.dither = 0;
726 parms.gif.opaque_threshold = 0;
730 parms.gif.type = atype;
731 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
732 parms.gif.dither = 0;
733 parms.gif.opaque_threshold = 0;
734 parms.gif.animate_repeats = 0;
747 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
748 parms.gif.animate_repeats = 0;
749 }
else if(sufix==
"") {
766 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
767 parms.gif.animate_repeats = atoi(s);
776 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
777 parms.gif.animate_repeats = 0;
778 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
784 delay = atoi(sDelay);
785 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
786 parms.gif.animate_repeats = atoi(sRepeats);
788 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
792 parms.gif.animate_delay = delay;
794 int i1 = fname.
Index(
"gif+");
796 fname = fname(0, i1 + 3);
799 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
805 parms.tiff.type = atype;
806 parms.tiff.flags = EXPORT_ALPHA;
807 parms.tiff.rows_per_strip = 0;
808 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
809 TIFF_COMPRESSION_NONE;
810 parms.tiff.jpeg_quality = 100;
811 parms.tiff.opaque_threshold = 0;
814 Error(
"WriteImage",
"file type %s not yet supported", s);
818 if (!ASImage2file(im,
nullptr, fname.
Data(), atype, &parms)) {
819 Error(
"WriteImage",
"error writing file %s",
file);
837 if (s ==
"jpg" || s ==
"jpeg")
876 astype = ASIT_Xpm;
break;
878 astype = ASIT_ZCompressedXpm;
break;
880 astype = ASIT_GZCompressedXpm;
break;
882 astype = ASIT_Png;
break;
884 astype = ASIT_Jpeg;
break;
886 astype = ASIT_Xcf;
break;
888 astype = ASIT_Ppm;
break;
890 astype = ASIT_Pnm;
break;
892 astype = ASIT_Bmp;
break;
894 astype = ASIT_Ico;
break;
896 astype = ASIT_Cur;
break;
898 astype = ASIT_Gif;
break;
900 astype = ASIT_Gif;
break;
902 astype = ASIT_Tiff;
break;
904 astype = ASIT_Xbm;
break;
906 astype = ASIT_Targa;
break;
908 astype = ASIT_XMLScript;
break;
910 astype = ASIT_Unknown;
916 case ASIT_ZCompressedXpm:
918 case ASIT_GZCompressedXpm:
961 asquality = 25;
break;
963 asquality = 75;
break;
965 asquality = 50;
break;
967 asquality = 100;
break;
973 if (asquality > 0 && asquality <= 25)
975 if (asquality > 26 && asquality <= 50)
977 if (asquality > 51 && asquality <= 75)
979 if (asquality > 76 && asquality <= 100)
999 Warning(
"SetImage",
"Visual not initiated");
1017 ASVectorPalette asPalette;
1021 for (col = 0; col < 4; col++)
1022 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1029 asPalette.points =
new Double_t[asPalette.npoints];
1030 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1034 height, &asPalette, ASA_ASImage,
1037 delete [] asPalette.points;
1038 for (col = 0; col < 4; col++)
1039 delete [] asPalette.channels[col];
1083 Error(
"FromPad",
"pad cannot be 0");
1088 Warning(
"FromPad",
"Visual not initiated");
1098 if (
gROOT->IsBatch()) {
1106 if (itmp && itmp->
fImage) {
1115 if (itmp && itmp->
fImage && (itmp !=
this)) {
1117 if (itmp->
fImage->alt.argb32) {
1119 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1120 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1147 static int x11 = -1;
1148 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1153 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0,
w,
h);
1158 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
1179 Error(
"Draw",
"no image set");
1197 rname =
"new TCanvas(\"" + rname +
Form(
"\", %d, %d);",
w,
h);
1207 gPad->Range(-left / (1.0 - left - right),
1208 -bottom / (1.0 - top - bottom),
1209 1 + right / (1.0 - left - right),
1210 1 + top / ( 1.0 - top - bottom));
1211 gPad->RangeAxis(0, 0, 1, 1);
1234 wsrc = wsrc ? wsrc : im->width;
1235 hsrc = hsrc ? hsrc : im->height;
1237 static int x11 = -1;
1238 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1245 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1252 char *bits =
new char[ww*hh];
1254 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1255 xsrc, ysrc, ww, 0,
nullptr);
1257 for (yy = 0; yy < hh; yy++) {
1258 imdec->decode_image_scanline(imdec);
1259 CARD32 *
a = imdec->buffer.alpha;
1261 for (xx = 0; xx < ww; xx++) {
1276 stop_image_decoding(&imdec);
1279 (
const char *)bits, ww, hh);
1297 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1298 asimage2drawable(
fgVisual,
wid, im, (GC)
gc, xsrc, ysrc,
x,
y, wsrc, hsrc, 1);
1300 ASImage *img =
nullptr;
1301 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1303 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1304 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1306 bits = (
unsigned char *)img->alt.argb32;
1313 if (
gPad &&
gPad->GetGLDevice() != -1) {
1315 painter->DrawPixels(bits, wsrc, hsrc,
x,
y, !
option.Contains(
"opaque"));
1319 if (!
option.Contains(
"opaque")) {
1330 destroy_asimage(&img);
1355 xsrc, ysrc, wsrc, hsrc, opt);
1374 Error(
"Paint",
"no image set");
1379 Warning(
"Paint",
"Visual not initiated");
1383 Int_t tile_x = 0, tile_y = 0;
1384 CARD32 tile_tint = 0;
1393 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1396 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1399 Error(
"Paint",
"tile option error");
1407 if (!
fImage->alt.vector) {
1420 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1421 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1424 if ((to_w < 25 || to_h < 25) && !expand) {
1425 Error(
"Paint",
"pad too small to display an image");
1437 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1438 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1440 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1441 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1446 ASImage *grad_im =
nullptr;
1454 grad.type = GRADIENT_Top2Bottom;
1455 grad.color =
new ARGB32[grad.npoints];
1456 grad.offset =
new double[grad.npoints];
1459 Int_t oldPt = grad.npoints -
pt -1;
1460 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1461 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1463 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1464 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1468 pal_h, SCL_DO_COLOR,
1471 delete [] grad.color;
1472 delete [] grad.offset;
1480 to_w, to_h, tile_tint, ASA_ASImage,
1516 destroy_asimage(&tmpImage);
1531 Error(
"Paint",
"image could not be rendered to display");
1535 int tox = expand ? 0 :
int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1536 int toy = expand ? 0 :
int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1538 if (!
gROOT->IsBatch()) {
1553 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1554 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1555 min, max, ndiv,
"+LU");
1560 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1561 min, max, ndiv,
"+L");
1571 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1576 dump->
Merge(&tgrad,
"alphablend", pal_Ax, pal_Ay);
1586 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1587 min, max, ndiv,
"+L");
1591 Warning(
"Paint",
"PDF not implemented yet");
1594 Warning(
"Paint",
"SVG not implemented yet");
1603 color =
new TColor(
colors->GetEntries(), 1., 1., 1.,
"Image_PS");
1614 x2 =
x1+dx/image->width;
1616 y2 =
y1+dy/image->height;
1619 x2 =
x1+(dx*(1-
gPad->GetRightMargin()-
gPad->GetLeftMargin()))/image->width;
1621 y2 =
y1+(dy*(1-
gPad->GetTopMargin()-
gPad->GetBottomMargin()))/image->height;
1626 ASImageDecoder *imdec = start_image_decoding(
fgVisual, image, SCL_DO_ALL,
1627 0, 0, image->width, image->height,
nullptr);
1629 for (
Int_t yt = 0; yt < (
Int_t)image->height; yt++) {
1630 imdec->decode_image_scanline(imdec);
1631 for (
Int_t xt = 0; xt < (
Int_t)image->width; xt++)
1633 imdec->buffer.green[xt],
1634 imdec->buffer.blue[xt]);
1636 stop_image_decoding(&imdec);
1641 Double_t xconv = (
gPad->AbsPixeltoX(pal_Ax + pal_w) -
gPad->AbsPixeltoX(pal_Ax)) / grad_im->width;
1642 Double_t yconv = (
gPad->AbsPixeltoY(pal_Ay - pal_h) -
gPad->AbsPixeltoY(pal_Ay)) / grad_im->height;
1643 x1 =
gPad->AbsPixeltoX(pal_Ax);
1645 y2 =
gPad->AbsPixeltoY(pal_Ay);
1650 imdec = start_image_decoding(
fgVisual, grad_im, SCL_DO_ALL,
1651 0, 0, grad_im->width, grad_im->height,
nullptr);
1653 for (
Int_t yt = 0; yt < (
Int_t)grad_im->height; yt++) {
1654 imdec->decode_image_scanline(imdec);
1655 for (
Int_t xt = 0; xt < (
Int_t)grad_im->width; xt++)
1657 imdec->buffer.green[xt],
1658 imdec->buffer.blue[xt]);
1661 stop_image_decoding(&imdec);
1672 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1673 min, max, ndiv,
"+L");
1679 destroy_asimage(&grad_im);
1688 Int_t pxl, pyl, pxt, pyt;
1695 if (px1 < px2) {pxl = px1; pxt = px2;}
1696 else {pxl = px2; pxt = px1;}
1697 if (py1 < py2) {pyl = py1; pyt = py2;}
1698 else {pyl = py2; pyt = py1;}
1700 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1711 static std::unique_ptr<TBox> ZoomBox;
1722 static Int_t px1old, py1old, px2old, py2old;
1723 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
1734 if (imgX < 0) px = px - imgX;
1735 if (imgY < 0) py = py - imgY;
1740 if (imgX >= (
int)image->width) px = px - imgX + image->width - 1;
1741 if (imgY >= (
int)image->height) py = py - imgY + image->height - 1;
1746 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1747 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1748 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1749 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1750 px1old = px; py1old = py;
1766 ZoomBox->SetX1(
gPad->AbsPixeltoX(pxl));
1767 ZoomBox->SetY1(
gPad->AbsPixeltoY(pyl));
1768 ZoomBox->SetX2(
gPad->AbsPixeltoX(pxt));
1769 ZoomBox->SetY2(
gPad->AbsPixeltoY(pyt));
1771 ZoomBox = std::make_unique<TBox>(pxl, pyl, pxt, pyt);
1772 ZoomBox->SetFillStyle(0);
1773 ZoomBox->Draw(
"l*");
1792 Int_t imgX1 = px1old -
gPad->XtoAbsPixel(0);
1793 Int_t imgY1 = py1old -
gPad->YtoAbsPixel(1);
1794 Int_t imgX2 = px -
gPad->XtoAbsPixel(0);
1795 Int_t imgY2 = py -
gPad->YtoAbsPixel(1);
1797 imgY1 = image->height - 1 - imgY1;
1798 imgY2 = image->height - 1 - imgY2;
1804 Zoom((imgX1 < imgX2) ? imgX1 : imgX2, (imgY1 < imgY2) ? imgY1 : imgY2,
1822 static char info[64];
1828 px -=
gPad->XtoAbsPixel(0);
1829 py -=
gPad->YtoAbsPixel(1);
1832 if (px < 0 || py < 0)
return info;
1836 if (px >= (
int)image->width || py >= (
int)image->height)
1839 py = image->height - 1 - py;
1846 if (
fImage->alt.vector) {
1847 snprintf(info,64,
"x: %d y: %d %.5g",
1850 snprintf(info,64,
"x: %d y: %d", px, py);
1866 Warning(
"SetPalette",
"Visual not initiated");
1871 Warning(
"SetPalette",
"Image not valid");
1881 ASVectorPalette asPalette;
1883 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1884 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1885 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1886 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1892 asPalette.points =
new double[asPalette.npoints];
1893 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1899 delete [] asPalette.points;
1900 for (
Int_t col = 0; col < 4; col++)
1901 delete [] asPalette.channels[col];
1920 Warning(
"Scale",
"Image not initiated");
1925 Warning(
"Scale",
"Visual not initiated");
1933 if (toWidth > 30000)
1935 if (toHeight > 30000)
1938 ASImage *img = scale_asimage(
fgVisual,
fImage, toWidth, toHeight,
1955 Warning(
"Scale",
"Image not initiated");
1960 Warning(
"Scale",
"Visual not initiated");
1968 if (toWidth > 30000)
1970 if (toHeight > 30000)
1974 yStart, yEnd, toWidth, toHeight,
1990 Warning(
"Tile",
"Image not initiated");
1995 Warning(
"Tile",
"Visual not initiated");
2003 if (toWidth > 30000)
2005 if (toHeight > 30000)
2008 ASImage *img = tile_asimage(
fgVisual,
fImage, 0, 0, toWidth, toHeight, 0,
2030 Warning(
"Zoom",
"Image not valid");
2052 Warning(
"UnZoom",
"Image not valid");
2080 Warning(
"Flip",
"Image not valid");
2084 Warning(
"Flip",
"Visual not initiated");
2088 if (
fImage->alt.vector) {
2089 Warning(
"Flip",
"flip does not work for data images");
2127 Warning(
"Mirror",
"Image not valid");
2132 Warning(
"Mirror",
"Visual not initiated");
2136 if (
fImage->alt.vector) {
2137 Warning(
"Mirror",
"mirror does not work for data images");
2207 if (inbatch && !noX) {
2218 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2225 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2228 Display *disp = (Display*)
gVirtualX->GetDisplay();
2234 if (!vis ||
cmap == 0) {
2235 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2237 fgVisual = create_asvisual_for_id(disp, screen, depth,
2238 XVisualIDFromVisual(vis),
cmap,
nullptr);
2242 fgVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
2255 Warning(
"StartPaletteEditor",
"Image not valid");
2258 if (!
fImage->alt.vector) {
2259 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2274 Warning(
"GetPixmap",
"Visual not initiated");
2282 static int x11 = -1;
2283 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2287 img,
nullptr,
kTRUE);
2289 if (!
fImage->alt.argb32) {
2292 ret =
gVirtualX->CreatePixmapFromData((
unsigned char*)
fImage->alt.argb32,
2308 Warning(
"GetMask",
"Visual not initiated");
2315 Warning(
"GetMask",
"No image");
2320 UInt_t ow = img->width%8;
2321 UInt_t ww = img->width - ow + (ow ? 8 : 0);
2328 char *bits =
new char[ww*hh];
2330 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALPHA,
2331 0, 0, ww, 0,
nullptr);
2337 for (
y = 0;
y < hh;
y++) {
2338 imdec->decode_image_scanline(imdec);
2339 CARD32 *
a = imdec->buffer.alpha;
2341 for (
x = 0;
x < ww;
x++) {
2355 stop_image_decoding(&imdec);
2356 pxmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), (
const char *)bits,
2368 Warning(
"SetImage",
"Visual not initiated");
2382 static int x11 = -1;
2383 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2395 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
2400 fImage = bitmap2asimage(bits,
w,
h, 0, mask_bits);
2401 delete [] mask_bits;
2412 Warning(
"GetPixels",
"Wrong Image");
2417 ASImageDecoder *imdec;
2431 if ((
x >= (
int)img->width) || (
y >= (
int)img->height)) {
2435 if ((
int)(
x +
width) > (
int)img->width) {
2439 if ((
int)(
y +
height) > (
int)img->height) {
2443 if ((imdec = start_image_decoding(
nullptr,
fImage, SCL_DO_ALL, 0,
y,
2444 img->width,
height,
nullptr)) ==
nullptr) {
2445 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(
nullptr, img, SCL_DO_ALL, 0, 0,
2527 img->width, 0,
nullptr)) ==
nullptr) {
2528 Warning(
"GetArray",
"Failed to create image decoder");
2533 CARD32
r = 0,
g = 0,
b = 0;
2537 for (
UInt_t k = 0; k <
h; k++) {
2538 imdec->decode_image_scanline(imdec);
2540 for (
UInt_t i = 0; i <
w; ++i) {
2541 if ((
r == imdec->buffer.red[i]) &&
2542 (
g == imdec->buffer.green[i]) &&
2543 (
b == imdec->buffer.blue[i])) {
2545 r = imdec->buffer.red[i];
2546 g = imdec->buffer.green[i];
2547 b = imdec->buffer.blue[i];
2555 stop_image_decoding(&imdec);
2578 const char *color,
const char *font_name,
2582 ARGB32 text_color = ARGB32_Black;
2583 ASImage *fore_im =
nullptr;
2584 ASImage *text_im =
nullptr;
2588 Warning(
"DrawText",
"Visual not initiated");
2596 if (fn.
Last(
'/') == 0) fn = fn(1, fn.
Length() - 1);
2609 parse_argb_color(color, &text_color);
2622 Warning(
"DrawText",
"cannot create Font Manager");
2631 Warning(
"DrawText",
"cannot find a font %s", font_name);
2643 text_im = draw_text(
text, font, (ASText3DType)
type, 0);
2648 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2650 if ((tmp->width !=
width) || (tmp->height !=
height)) {
2654 destroy_asimage(&tmp);
2661 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2662 destroy_asimage(&text_im);
2670 ASImage *rendered_im;
2671 ASImageLayer layers[2];
2673 init_image_layers(&(layers[0]), 2);
2674 fore_im->back_color = text_color;
2675 layers[0].im = rimg;
2676 layers[0].dst_x = 0;
2677 layers[0].dst_y = 0;
2678 layers[0].clip_width = rimg->width;
2679 layers[0].clip_height = rimg->height;
2680 layers[0].bevel =
nullptr;
2681 layers[1].im = fore_im;
2682 layers[1].dst_x =
x;
2683 layers[1].dst_y =
y;
2684 layers[1].clip_width = fore_im->width;
2685 layers[1].clip_height = fore_im->height;
2687 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2690 destroy_asimage(&fore_im);
2723 Warning(
"Merge",
"Visual not initiated");
2727 ASImage *rendered_im;
2728 ASImageLayer layers[2];
2730 init_image_layers(&(layers[0]), 2);
2732 layers[0].dst_x = 0;
2733 layers[0].dst_y = 0;
2734 layers[0].clip_width =
fImage->width;
2735 layers[0].clip_height =
fImage->height;
2736 layers[0].bevel =
nullptr;
2737 layers[1].im = ((
TASImage*)im)->fImage;
2738 layers[1].dst_x =
x;
2739 layers[1].dst_y =
y;
2740 layers[1].clip_width = im->
GetWidth();
2741 layers[1].clip_height = im->
GetHeight();
2742 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2760 Warning(
"Blur",
"Visual not initiated");
2765 fImage = create_asimage(100, 100, 0);
2768 Warning(
"Blur",
"Failed to create image");
2775 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2776 vr > 0 ? vr : 3, SCL_DO_ALL,
2789 Warning(
"Clone",
"Image not initiated");
2796 Warning(
"Clone",
"Failed to create image");
2812 if (
fImage->alt.argb32) {
2814 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2815 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2835 Warning(
"Vectorize",
"Visual not initiated");
2840 fImage = create_asimage(100, 100, 0);
2843 Warning(
"Vectorize",
"Failed to create image");
2854 dither = dither > 7 ? 7 : dither;
2856 res = colormap_asimage(
fImage, &
cmap, max_colors, dither, opaque_threshold);
2868 g = INDEX_SHIFT_GREEN(
cmap.entries[res[i]].green);
2869 b = INDEX_SHIFT_BLUE(
cmap.entries[res[i]].blue);
2870 r = INDEX_SHIFT_RED(
cmap.entries[res[i]].red);
2872 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2883 g = INDEX_SHIFT_GREEN(
cmap.entries[j].green);
2884 b = INDEX_SHIFT_BLUE(
cmap.entries[j].blue);
2885 r = INDEX_SHIFT_RED(
cmap.entries[j].red);
2886 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2888 v = (
v>>12) & 0x0FFF;
2903 if (res) safefree(res);
2949 Warning(
"HSV",
"Visual not initiated");
2957 Warning(
"HSV",
"Failed to create image");
2969 ASImage *rendered_im =
nullptr;
2973 hue, radius,
H, S, V, ASA_ASImage, 100,
2974 ASIMAGE_QUALITY_TOP);
2977 Warning(
"HSV",
"Failed to create rendered image");
3015 Warning(
"Gradient",
"Visual not initiated");
3019 ASImage *rendered_im =
nullptr;
3020 ASGradient gradient;
3022 int reverse = 0, npoints1 = 0, npoints2 = 0;
3029 if ((
angle > 2 * 180 * 15 / 16) || (
angle < 2 * 180 * 1 / 16)) {
3030 gradient.type = GRADIENT_Left2Right;
3031 }
else if (
angle < 2 * 180 * 3 / 16) {
3032 gradient.type = GRADIENT_TopLeft2BottomRight;
3033 }
else if (
angle < 2 * 180 * 5 / 16) {
3034 gradient.type = GRADIENT_Top2Bottom;
3035 }
else if (
angle < 2 * 180 * 7 / 16) {
3036 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
3037 }
else if (
angle < 2 * 180 * 9 / 16) {
3038 gradient.type = GRADIENT_Left2Right; reverse = 1;
3039 }
else if (
angle < 2 * 180 * 11 / 16) {
3040 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3041 }
else if (
angle < 2 * 180 * 13 / 16) {
3042 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3044 gradient.type = GRADIENT_BottomLeft2TopRight;
3047 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3049 for (npoints1 = 0; *
p; npoints1++) {
3051 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3053 for ( ; isspace((
int)*
p);
p++) { }
3056 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3058 for (npoints2 = 0; *
p; npoints2++) {
3060 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3062 for ( ; isspace((
int)*
p);
p++) { }
3067 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3076 gradient.color =
new ARGB32[npoints1];
3077 gradient.offset =
new double[npoints1];
3079 for (
p = (
char*)
colors; isspace((
int)*
p);
p++) { }
3081 for (npoints1 = 0; *
p; ) {
3085 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3087 for ( ; isspace((
int)*
p);
p++) { }
3089 col = str(pb -
colors,
p - pb);
3091 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3094 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3099 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3101 for (npoints2 = 0; *
p; ) {
3105 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3108 gradient.offset[npoints2] = strtod(pb, &pb);
3110 if (pb ==
p) npoints2++;
3112 for ( ; isspace((
int)*
p);
p++) { }
3115 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3116 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3119 gradient.npoints = npoints1;
3121 if (npoints2 && (gradient.npoints > npoints2)) {
3122 gradient.npoints = npoints2;
3125 for (i = 0; i < gradient.npoints/2; i++) {
3126 int i2 = gradient.npoints - 1 - i;
3127 ARGB32
c = gradient.color[i];
3128 double o = gradient.offset[i];
3129 gradient.color[i] = gradient.color[i2];
3130 gradient.color[i2] =
c;
3131 gradient.offset[i] = gradient.offset[i2];
3132 gradient.offset[i2] = o;
3134 for (i = 0; i < gradient.npoints; i++) {
3135 gradient.offset[i] = 1.0 - gradient.offset[i];
3141 delete [] gradient.color;
3142 delete [] gradient.offset;
3146 Warning(
"Gradient",
"Failed to create gradient image");
3155 ASImageLayer layers[2];
3157 init_image_layers(&(layers[0]), 2);
3159 layers[0].dst_x = 0;
3160 layers[0].dst_y = 0;
3161 layers[0].clip_width =
fImage->width;
3162 layers[0].clip_height =
fImage->height;
3163 layers[0].bevel =
nullptr;
3164 layers[1].im = rendered_im;
3165 layers[1].dst_x =
x;
3166 layers[1].dst_y =
y;
3167 layers[1].clip_width =
width;
3168 layers[1].clip_height =
height;
3169 layers[1].merge_scanlines = alphablend_scanlines;
3174 Warning(
"Gradient",
"Failed to create merged image");
3178 destroy_asimage(&rendered_im);
3193 cmp = (cmp * 12) / 10;
3195 return (cmp > 255) ? 255 : cmp;
3216 return (background >> 1) & 0x7F7F7F7F;
3227 a = ARGB32_ALPHA8(
foreground) + ARGB32_ALPHA8(background);
3229 r = ARGB32_RED8(
foreground) + ARGB32_RED8(background);
3231 g = ARGB32_GREEN8(
foreground) + ARGB32_GREEN8(background);
3233 b = ARGB32_BLUE8(
foreground) + ARGB32_BLUE8(background);
3236 return MAKE_ARGB32(
a,
r,
g,
b);
3252 const char *hi_color,
const char *lo_color,
UShort_t thick,
3256 Warning(
"Bevel",
"Visual not initiated");
3263 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3264 parse_argb_color(hi_color, &
hi);
3265 parse_argb_color(lo_color, &lo);
3268 bevel.lo_color =
hi;
3270 bevel.hi_color = lo;
3273 bevel.hi_color =
hi;
3275 bevel.lo_color = lo;
3280 int extra_hilite = 2;
3281 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3282 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3284 if (bevel.top_outline > 1) {
3285 bevel.top_inline += bevel.top_outline - 1;
3288 if (bevel.left_outline > 1) {
3289 bevel.left_inline += bevel.left_outline - 1;
3292 if (bevel.right_outline > 1) {
3293 bevel.right_inline += bevel.right_outline - 1;
3296 if (bevel.bottom_outline > 1) {
3297 bevel.bottom_inline += bevel.bottom_outline - 1;
3301 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3307 Warning(
"Bevel",
"Failed to create image");
3319 ASImageLayer layers[2];
3320 init_image_layers(&(layers[0]), 2);
3323 layers[0].dst_x = 0;
3324 layers[0].dst_y = 0;
3325 layers[0].clip_width =
fImage->width;
3326 layers[0].clip_height =
fImage->height;
3327 layers[0].bevel =
nullptr;
3329 UInt_t w =
width - (bevel.left_outline + bevel.right_outline);
3330 UInt_t h =
height - (bevel.top_outline + bevel.bottom_outline);
3331 ASImage *bevel_im = create_asimage(
w,
h, 0);
3334 Warning(
"Bevel",
"Failed to create bevel image");
3338 layers[1].im = bevel_im;
3339 fill_asimage(
fgVisual, bevel_im, 0, 0,
w,
h, fill);
3341 layers[1].dst_x =
x;
3342 layers[1].dst_y =
y;
3343 layers[1].clip_width =
width;
3344 layers[1].clip_height =
height;
3345 layers[1].bevel = &bevel;
3346 layers[1].merge_scanlines = alphablend_scanlines;
3350 destroy_asimage(&bevel_im);
3353 Warning(
"Bevel",
"Failed to image");
3373 Warning(
"Pad",
"Visual not initiated");
3378 fImage = create_asimage(100, 100, 0);
3381 Warning(
"Pad",
"Failed to create image");
3388 ARGB32 color = ARGB32_White;
3389 parse_argb_color(col, &color);
3400 Warning(
"Pad",
"Failed to create output image");
3417 Warning(
"Crop",
"Visual not initiated");
3433 Warning(
"Crop",
"input size larger than image");
3436 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3440 Warning(
"Crop",
"Failed to start image decoding");
3448 Warning(
"Crop",
"Failed to create image");
3452 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3456 Warning(
"Crop",
"Failed to start image output");
3457 destroy_asimage(&img);
3458 if (imdec)
delete [] imdec;
3467 imdec->decode_image_scanline(imdec);
3468 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3471 stop_image_decoding(&imdec);
3472 stop_image_output(&imout);
3496 Warning(
"Append",
"Visual not initiated");
3514 }
else if (opt ==
"/") {
3535 Warning(
"BeginPaint",
"Visual not initiated");
3550 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3553 Warning(
"BeginPaint",
"Failed to create image");
3567 Warning(
"EndPaint",
"no image");
3571 if (!
fImage->alt.argb32)
return;
3574 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3577 Warning(
"EndPaint",
"Failed to create image");
3594 Warning(
"GetArgbArray",
"no image");
3599 if (!img)
return nullptr;
3601 if (!img->alt.argb32) {
3611 return (
UInt_t *)img->alt.argb32;
3622 Warning(
"GetRgbaArray",
"no image");
3627 if (!img)
return nullptr;
3629 if (!img->alt.argb32) {
3646 for (i = 0; i < img->height; i++) {
3647 for (j = 0; j < img->width; j++) {
3649 argb = img->alt.argb32[idx];
3651 rgb = argb & 0x00ffffff;
3652 rgba = (rgb << 8) +
a;
3667 Warning(
"GetScanline",
"no image");
3672 CARD32 *ret =
new CARD32[img->width];
3674 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3675 0,
y, img->width, 1,
nullptr);
3679 Warning(
"GetScanline",
"Failed to start image decoding");
3687 imdec->decode_image_scanline(imdec);
3688 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3689 stop_image_decoding(&imdec);
3704#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3705#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3706 "movl %1,%%edi \n" \
3707 "movl %2,%%ecx \n" \
3712 :"g" (val), "g" (dst), "g" (lng) \
3713 :"eax","edi","ecx" \
3717 #define _MEMSET_(dst, lng, val) do {\
3718 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3722#define FillSpansInternal(npt, ppt, widths, color) do {\
3723 UInt_t yy = ppt[0].fY*fImage->width;\
3724 for (UInt_t i = 0; i < npt; i++) {\
3725 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3726 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3738 Warning(
"FillRectangle",
"Visual not initiated");
3743 Warning(
"FillRectangle",
"no image");
3747 if (!
fImage->alt.argb32) {
3751 if (!
fImage->alt.argb32) {
3752 Warning(
"FillRectangle",
"Failed to get pixel array");
3756 ARGB32 color = (ARGB32)col;
3770 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3778 if (!
fImage->alt.argb32) {
3783 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3815 Warning(
"Fill",
"Visual not initiated");
3819 ARGB32 color = ARGB32_White;
3822 parse_argb_color(col, &color);
3840 ARGB32 color = (ARGB32)col;
3843 if (!thick) thick = 1;
3851 thick += (
x - half);
3862 if (
x + w < fImage->
width) {
3875 ARGB32 color = (ARGB32)col;
3878 if (!thick) thick = 1;
3886 thick += (
y - half);
3909 const char *col,
UInt_t thick)
3911 ARGB32 color = ARGB32_White;
3912 parse_argb_color(col, &color);
3924 int x,
y, xend, yend;
3931 Warning(
"DrawLine",
"Visual not initiated");
3936 Warning(
"DrawLine",
"no image");
3940 if (!
fImage->alt.argb32) {
3944 if (!
fImage->alt.argb32) {
3945 Warning(
"DrawLine",
"Failed to get pixel array");
3949 ARGB32 color = (ARGB32)col;
3954 if (!dx && !dy)
return;
3976 i2 = i1 - (dx << 1);
3993 q = (
y2 -
y1) * ydir;
4026 i2 = i1 - (dy << 1);
4043 q = (
x2 -
x1) * xdir;
4081 const char *col,
UInt_t thick)
4084 Warning(
"DrawRectangle",
"Visual not initiated");
4096 if (!
fImage->alt.argb32) {
4100 if (!
fImage->alt.argb32) {
4101 Warning(
"DrawRectangle",
"Failed to get pixel array");
4105 ARGB32 color = ARGB32_White;
4106 parse_argb_color(col, &color);
4126 ARGB32 color = ARGB32_White;
4137 parse_argb_color(col, &color);
4143 parse_argb_color(col, &color);
4173 ARGB32 color = (ARGB32)col;
4183 thick += (
y - half);
4186 thick = thick <= 0 ? 1 : thick;
4195 x2 =
x2 < tmp ? tmp :
x2;
4207 if (i >= pDash[iDash]) {
4211 if (iDash >= nDash) {
4227 ARGB32 color = (ARGB32)col;
4237 thick += (
x - half);
4240 thick = thick <= 0 ? 1 : thick;
4248 y2 =
y2 < tmp ? tmp :
y2;
4255 if (
x + w < fImage->
width) {
4263 if (i >= pDash[iDash]) {
4267 if (iDash >= nDash) {
4283 int x,
y, xend, yend;
4293 char *pDash =
new char[nDash];
4298 for (i = 0; i < (
int)nDash; i++) {
4304 i2 = i1 - (dx << 1);
4322 q = (
y2 -
y1) * ydir;
4327 if ((iDash%2) == 0) {
4339 if (i >= pDash[iDash]) {
4343 if (iDash >= nDash) {
4351 if ((iDash%2) == 0) {
4363 if (i >= pDash[iDash]) {
4367 if (iDash >= nDash) {
4376 for (i = 0; i < (
int)nDash; i++) {
4382 i2 = i1 - (dy << 1);
4400 q = (
x2 -
x1) * xdir;
4405 if ((iDash%2) == 0) {
4419 if (i >= pDash[iDash]) {
4423 if (iDash >= nDash) {
4431 if ((iDash%2) == 0) {
4445 if (i >= pDash[iDash]) {
4449 if (iDash >= nDash) {
4467 double x,
y, xend=0, yend=0, x0, y0;
4475 double *xDash =
new double[nDash];
4476 double *yDash =
new double[nDash];
4481 for (i = 0; i < (
int)nDash; i++) {
4482 xDash[i] = tDash[i] * ac;
4483 yDash[i] = tDash[i] * as;
4487 xDash[i] = xDash[i]/2;
4488 yDash[i] = yDash[i]/2;
4490 xDash[i] = xDash[i]*2;
4491 yDash[i] = yDash[i]*2;
4508 q = (
y2 -
y1) * ydir;
4515 while ((
x < xend) && (
y < yend)) {
4519 if ((iDash%2) == 0) {
4529 if (iDash >= nDash) {
4534 while ((
x < xend) && (
y > yend)) {
4538 if ((iDash%2) == 0) {
4548 if (iDash >= nDash) {
4567 q = (
x2 -
x1) * xdir;
4574 while ((
x < xend) && (
y < yend)) {
4578 if ((iDash%2) == 0) {
4588 if (iDash >= nDash) {
4593 while ((
x > xend) && (
y < yend)) {
4597 if ((iDash%2) == 0) {
4607 if (iDash >= nDash) {
4621 const char *pDash,
const char *col,
UInt_t thick)
4625 Warning(
"DrawDashLine",
"Visual not initiated");
4630 Warning(
"DrawDashLine",
"no image");
4634 if (!
fImage->alt.argb32) {
4638 if (!
fImage->alt.argb32) {
4639 Warning(
"DrawDashLine",
"Failed to get pixel array");
4643 if ((nDash < 2) || !pDash || (nDash%2)) {
4644 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4648 ARGB32 color = ARGB32_White;
4649 parse_argb_color(col, &color);
4653 }
else if (
y1 ==
y2) {
4667 ARGB32 color = ARGB32_White;
4668 parse_argb_color(col, &color);
4675 for (
UInt_t i = 1; i < nn; i++) {
4692 Warning(
"PutPixel",
"Visual not initiated");
4697 Warning(
"PutPixel",
"no image");
4701 if (!
fImage->alt.argb32) {
4705 if (!
fImage->alt.argb32) {
4706 Warning(
"PutPixel",
"Failed to get pixel array");
4711 parse_argb_color(col, &color);
4713 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4714 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4727 Warning(
"PolyPoint",
"Visual not initiated");
4732 Warning(
"PolyPoint",
"no image");
4736 if (!
fImage->alt.argb32) {
4740 if (!
fImage->alt.argb32) {
4741 Warning(
"PolyPoint",
"Failed to get pixel array");
4746 Warning(
"PolyPoint",
"No points specified");
4753 parse_argb_color(col, &color);
4759 for (i = 0; i < npt; i++) {
4760 ipt[i].
fX += ppt[i].
fX;
4761 ipt[i].
fY += ppt[i].
fY;
4766 for (i = 0; i < npt; i++) {
4767 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4768 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4770 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4786 if (!nseg || !seg) {
4787 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4793 for (
UInt_t i = 0; i < nseg; i++) {
4794 pt[0].fX = seg->
fX1;
4795 pt[1].fX = seg->
fX2;
4796 pt[0].fY = seg->
fY1;
4797 pt[1].fY = seg->
fY2;
4811 Warning(
"FillSpans",
"Visual not initiated");
4816 Warning(
"FillSpans",
"no image");
4820 if (!
fImage->alt.argb32) {
4824 if (!
fImage->alt.argb32) {
4825 Warning(
"FillSpans",
"Failed to get pixel array");
4829 if (!npt || !ppt || !widths || (stipple && (!
w || !
h))) {
4830 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4831 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple,
w,
h);
4836 parse_argb_color(col, &color);
4841 for (
UInt_t i = 0; i < npt; i++) {
4843 for (
UInt_t j = 0; j < widths[i]; j++) {
4844 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4855 if (stipple[ii >> 3] & (1 << (ii%8))) {
4869 Warning(
"FillSpans",
"Visual not initiated");
4874 Warning(
"FillSpans",
"no image");
4878 if (!
fImage->alt.argb32) {
4882 if (!
fImage->alt.argb32) {
4883 Warning(
"FillSpans",
"Failed to get pixel array");
4887 if (!npt || !ppt || !widths || !tile) {
4888 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4889 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4901 for (
UInt_t i = 0; i < npt; i++) {
4904 for (
UInt_t j = 0; j < widths[i]; j++) {
4905 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4923 Warning(
"CropSpans",
"Visual not initiated");
4928 Warning(
"CropSpans",
"no image");
4932 if (!
fImage->alt.argb32) {
4936 if (!
fImage->alt.argb32) {
4937 Warning(
"CropSpans",
"Failed to get pixel array");
4941 if (!npt || !ppt || !widths) {
4942 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4947 int y1 = ppt[npt-1].
fY;
4955 for (
y = 0; (
int)
y < y0;
y++) {
4958 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4963 for (i = 0; i < npt; i++) {
4964 for (
x = 0; (
int)
x < ppt[i].fX;
x++) {
4966 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4968 for (
x = ppt[i].fX + widths[i] + 1;
x <
fImage->width;
x++) {
4970 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4978 if (idx < sz)
fImage->alt.argb32[idx] = 0;
5012 Warning(
"CopyArea",
"Visual not initiated");
5017 Warning(
"CopyArea",
"no image");
5022 ASImage *out = ((
TASImage*)dst)->GetImage();
5028 xsrc = xsrc < 0 ? 0 : xsrc;
5029 ysrc = ysrc < 0 ? 0 : ysrc;
5031 if ((xsrc >= (
int)
fImage->width) || (ysrc >= (
int)
fImage->height))
return;
5037 if (!
fImage->alt.argb32) {
5040 if (!out->alt.argb32) {
5042 out = ((
TASImage*)dst)->GetImage();
5045 if (
fImage->alt.argb32 && out->alt.argb32) {
5046 for (
y = 0;
y < (
int)
h;
y++) {
5047 for (
x = 0;
x < (
int)
w;
x++) {
5048 idx =
Idx(yy +
x + xsrc);
5049 if ((
x + xdst < 0) || (ydst +
y < 0) ||
5050 (
x + xdst >= (
int)out->width) || (
y + ydst >= (
int)out->height) )
continue;
5052 idx2 =
Idx((ydst +
y)*out->width +
x + xdst);
5056 out->alt.argb32[idx2] = 0;
5059 out->alt.argb32[idx2] &=
fImage->alt.argb32[idx];
5062 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] & (~out->alt.argb32[idx2]);
5065 out->alt.argb32[idx2] &= ~fImage->alt.argb32[idx];
5070 out->alt.argb32[idx2] ^=
fImage->alt.argb32[idx];
5073 out->alt.argb32[idx2] |=
fImage->alt.argb32[idx];
5076 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) & (~out->alt.argb32[idx2]);
5079 out->alt.argb32[idx2] ^= ~fImage->alt.argb32[idx];
5082 out->alt.argb32[idx2] = ~out->alt.argb32[idx2];
5085 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] | (~out->alt.argb32[idx2]);
5088 out->alt.argb32[idx2] = ~fImage->alt.argb32[idx];
5091 out->alt.argb32[idx2] |= ~fImage->alt.argb32[idx];
5094 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) | (~out->alt.argb32[idx2]);
5097 out->alt.argb32[idx2] = 0xFFFFFFFF;
5101 out->alt.argb32[idx2] =
fImage->alt.argb32[idx];
5125 int i, j, ix, iy,
w,
h;
5127 ARGB32 color = 0xFFFFFFFF;
5134 for (i = 0; i < nx; i++) {
5136 for (j = 0; j < ny; j++) {
5137 icol = (ARGB32)ic[i + (nx*j)];
5138 if (icol != color) {
5192 return (ptMin - ptsStart);
5208 int mr = 0, m1r = 0;
5209 int incr1l = 0, incr2l = 0;
5210 int incr1r = 0, incr2r = 0;
5215 int nextleft, nextright;
5218 TPoint *firstPoint =
nullptr;
5219 UInt_t *firstWidth =
nullptr;
5228 Warning(
"GetPolygonSpans",
"Visual not initiated");
5233 Warning(
"GetPolygonSpans",
"no image");
5237 if (!
fImage->alt.argb32) {
5241 if (!
fImage->alt.argb32) {
5242 Warning(
"GetPolygonSpans",
"Failed to get pixel array");
5246 if ((npt < 3) || !ppt) {
5247 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%zx", npt, (
size_t)ppt);
5256 if ((npt < 3) || (dy < 0))
return kFALSE;
5258 ptsOut = firstPoint =
new TPoint[dy];
5262 nextleft = nextright = imin;
5263 y = ppt[nextleft].
fY;
5268 if (ppt[nextleft].fY ==
y) {
5274 if (nextleft >= (
int)npt) {
5281 ppt[left].fX, ppt[nextleft].fX,
5282 xl, dl, ml, m1l, incr1l, incr2l);
5286 if (ppt[nextright].fY ==
y) {
5292 if (nextright < 0) {
5299 ppt[right].fX, ppt[nextright].fX,
5300 xr, dr, mr, m1r, incr1r, incr2r);
5305 i =
TMath::Min(ppt[nextleft].fY, ppt[nextright].fY) -
y;
5309 delete [] firstWidth;
5310 delete [] firstPoint;
5319 *(
width++) = xr - xl;
5320 (ptsOut++)->fX = xl;
5322 *(
width++) = xl - xr;
5323 (ptsOut++)->fX = xr;
5331 }
while (
y !=
ymax);
5333 *nspans =
UInt_t(ptsOut - firstPoint);
5334 *outPoint = firstPoint;
5335 *outWidth = firstWidth;
5348 TPoint *firstPoint =
nullptr;
5349 UInt_t *firstWidth =
nullptr;
5352 ARGB32 color = ARGB32_White;
5353 parse_argb_color(col, &color);
5356 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5359 FillSpans(nspans, firstPoint, firstWidth, col, stipple,
w,
h);
5363 delete [] firstWidth;
5364 delete [] firstPoint;
5367 if (firstWidth)
delete [] firstWidth;
5368 if (firstPoint)
delete [] firstPoint;
5379 TPoint *firstPoint =
nullptr;
5380 UInt_t *firstWidth =
nullptr;
5385 FillSpans(nspans, firstPoint, firstWidth, tile);
5388 delete [] firstWidth;
5389 delete [] firstPoint;
5392 if (firstWidth)
delete [] firstWidth;
5393 if (firstPoint)
delete [] firstPoint;
5403 TPoint *firstPoint =
nullptr;
5404 UInt_t *firstWidth =
nullptr;
5409 CropSpans(nspans, firstPoint, firstWidth);
5412 delete [] firstWidth;
5413 delete [] firstPoint;
5416 if (firstWidth)
delete [] firstWidth;
5417 if (firstPoint)
delete [] firstPoint;
5430 Warning(
"DrawFillArea",
"Visual not initiated");
5435 Warning(
"DrawFillArea",
"no image");
5439 if (!
fImage->alt.argb32) {
5443 if (!
fImage->alt.argb32) {
5444 Warning(
"DrawFillArea",
"Failed to get pixel array");
5448 if ((count < 3) || !ptsIn) {
5449 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5458 ARGB32 color = ARGB32_White;
5459 parse_argb_color(col, &color);
5477 static const UInt_t gEdgeTableEntryCacheSize = 200;
5478 static EdgeTableEntry gEdgeTableEntryCache[gEdgeTableEntryCacheSize];
5480 if (count < gEdgeTableEntryCacheSize) {
5491 ptsOut = firstPoint;
5513 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5516 FillSpans(nPts, firstPoint, firstWidth, col, stipple,
w,
h);
5518 ptsOut = firstPoint;
5529 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5532 FillSpans(nPts, firstPoint, firstWidth, col, stipple,
w,
h);
5536 if (
del)
delete [] pETEs;
5546 Warning(
"DrawFillArea",
"Visual not initiated");
5551 Warning(
"DrawFillArea",
"no image");
5555 if (!
fImage->alt.argb32) {
5559 if (!
fImage->alt.argb32) {
5560 Warning(
"DrawFillArea",
"Failed to get pixel array");
5564 if ((count < 3) || !ptsIn) {
5565 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5594 ptsOut = firstPoint;
5616 FillSpans(nPts, firstPoint, firstWidth, tile);
5617 ptsOut = firstPoint;
5626 FillSpans(nPts, firstPoint, firstWidth, tile);
5637 ASDrawContext *ctx =
new ASDrawContext;
5639 ctx->canvas_width = im->width;
5640 ctx->canvas_height = im->height;
5641 ctx->canvas = im->alt.argb32;
5642 ctx->scratch_canvas =
nullptr;
5644 ctx->flags = ASDrawCTX_CanvasIsARGB;
5645 asim_set_custom_brush_colored( ctx, brush);
5655 if (ctx->scratch_canvas)
free(ctx->scratch_canvas);
5669 Int_t sz = thick*thick;
5676 matrix =
new CARD32[sz];
5679 for (
int i = 0; i < sz; i++) {
5680 matrix[i] = (CARD32)color;
5684 brush.matrix = matrix;
5685 brush.width = thick;
5686 brush.height = thick;
5687 brush.center_y = brush.center_x = thick/2;
5696 if (xx1 ==
fImage->width) --xx1;
5697 if (yy1 ==
fImage->height) --yy1;
5698 if (xx2 ==
fImage->width) --xx2;
5699 if (yy2 ==
fImage->height) --yy2;
5701 asim_move_to(ctx, xx1, yy1);
5702 asim_line_to(ctx, xx2, yy2);
5717 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
5721 FT_Bitmap *source = (FT_Bitmap*)
bitmap;
5722 UChar_t d = 0, *s = source->buffer;
5724 Int_t dots =
Int_t(source->width * source->rows);
5728 yy = y0 = by > 0 ? by *
fImage->width : 0;
5729 for (
y = 0;
y < (
int) source->rows;
y++) {
5731 if ((byy >= (
int)
fImage->height) || (byy <0))
continue;
5733 for (
x = 0;
x < (
int) source->width;
x++) {
5735 if ((bxx >= (
int)
fImage->width) || (bxx < 0))
continue;
5737 idx =
Idx(bxx + yy);
5738 r += ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
5739 g += ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
5740 b += (
fImage->alt.argb32[idx] & 0x0000ff);
5750 col[0] = (
r << 16) + (
g << 8) +
b;
5752 Int_t col4r = (col[4] & 0xff0000) >> 16;
5753 Int_t col4g = (col[4] & 0x00ff00) >> 8;
5754 Int_t col4b = (col[4] & 0x0000ff);
5757 for (
x = 3;
x > 0;
x--) {
5759 Int_t colxr = (col4r*
x +
r*xx) >> 2;
5760 Int_t colxg = (col4g*
x +
g*xx) >> 2;
5761 Int_t colxb = (col4b*
x +
b*xx) >> 2;
5762 col[
x] = (colxr << 16) + (colxg << 8) + colxb;
5768 Int_t clipx1=0, clipx2=0, clipy1=0, clipy2=0;
5773 clipx1 =
gPad->XtoAbsPixel(
gPad->GetX1())*is;
5774 clipx2 =
gPad->XtoAbsPixel(
gPad->GetX2())*is;
5775 clipy1 =
gPad->YtoAbsPixel(
gPad->GetY1())*is;
5776 clipy2 =
gPad->YtoAbsPixel(
gPad->GetY2())*is;
5780 for (
y = 0;
y < (
int) source->rows;
y++) {
5783 for (
x = 0;
x < (
int) source->width;
x++) {
5787 d = ((
d + 10) * 5) >> 8;
5791 if ( noClip || ((
x < (
int) source->width) &&
5792 (bxx < (
int)clipx2) && (bxx >= (
int)clipx1) &&
5793 (byy >= (
int)clipy2) && (byy < (
int)clipy1) )) {
5794 idx =
Idx(bxx + yy);
5795 acolor = (ARGB32)col[
d];
5799 fImage->alt.argb32[idx] = acolor;
5818 Warning(
"DrawText",
"Visual not initiated");
5822 if (!
fImage->alt.argb32) {
5837 ttfsize =
text->GetTextSize()*wh;
5839 ttfsize =
text->GetTextSize()*hh;
5847 const wchar_t *wcsTitle =
reinterpret_cast<const wchar_t *
>(
text->GetWcsTitle());
5848 if (wcsTitle != NULL) {
5861 ARGB32 color = ARGB32_White;
5915 if (align == 1 || align == 2 || align == 3) {
5917 }
else if (align == 4 || align == 5 || align == 6) {
5924 if (align == 3 || align == 6 || align == 9) {
5926 }
else if (align == 2 || align == 5 || align == 8) {
5933 ftal.x = (ftal.x >> 6);
5934 ftal.y = (ftal.y >> 6);
5939 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal,
nullptr, 1 ))
continue;
5942 FT_Bitmap *source = &
bitmap->bitmap;
5973 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal,
nullptr, 1 ))
continue;
5976 FT_Bitmap *source = &
bitmap->bitmap;
5991 static ASImageExportParams params;
5999 ret = ASImage2xpmRawBuff(img, (CARD8 **)buffer,
size,
nullptr);
6002 ret = ASImage2PNGBuff(img, (CARD8 **)buffer,
size, ¶ms);
6046 static ASImageImportParams params;
6050 params.filter = SCL_DO_ALL;
6051 params.gamma = SCREEN_GAMMA;
6052 params.gamma_table =
nullptr;
6053 params.compression = 0;
6054 params.format = ASA_ASImage;
6055 params.search_path =
nullptr;
6056 params.subimage = 0;
6061 char *ptr = buffer[0];
6062 while (isspace((
int)*ptr)) ++ptr;
6064 fImage = xpm_data2ASImage((
const char**)buffer, ¶ms);
6066 fImage = xpmRawBuff2ASImage((
const char*)*buffer, ¶ms);
6071 fImage = PNGBuff2ASimage((CARD8 *)*buffer, ¶ms);
6104 static char *buf =
nullptr;
6106 ASImage *img =
nullptr;
6126 ASImage *rendered_im;
6127 ASImageLayer layers[2];
6128 init_image_layers(&(layers[0]), 2);
6130 layers[0].dst_x = 0;
6131 layers[0].dst_y = 0;
6132 layers[0].clip_width = img->width;
6133 layers[0].clip_height = img->height;
6134 layers[0].bevel =
nullptr;
6136 layers[1].dst_x = 0;
6137 layers[1].dst_y = 0;
6138 layers[1].clip_width = img->width;
6139 layers[1].clip_height = img->height;
6140 layers[1].merge_scanlines = blend_scanlines_name2func(
"tint");
6141 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, img->width, img->height,
6143 destroy_asimage(&img);
6147 ASImage *padimg =
nullptr;
6152 padimg = pad_asimage(
fgVisual, img, 0,
d, sz, sz, 0x00ffffff,
6156 padimg = pad_asimage(
fgVisual, img,
d, 0, sz, sz, 0x00ffffff,
6161 destroy_asimage(&img);
6166 ASImage2xpmRawBuff(padimg, (CARD8 **)ptr, &
size,
nullptr);
6169 destroy_asimage(&padimg);
6182 if (
b.IsReading()) {
6183 Version_t version =
b.ReadVersion(&R__s, &R__c);
6188 if ( version == 1 ) {
6189 Int_t fileVersion =
b.GetVersionOwner();
6190 if (fileVersion > 0 && fileVersion < 50000 ) {
6198 if ( fileVersion < 40200 ) {
6217 if (image_type != 0) {
6219 char *buffer =
new char[
size];
6220 b.ReadFastArray(buffer,
size);
6245 image_type =
fImage->alt.vector ? 0 : 1;
6248 if (image_type != 0) {
6249 char *buffer =
nullptr;
6252 b.WriteFastArray(buffer,
size);
6260 b.SetByteCount(R__c,
kTRUE);
6269 if (
fImage->alt.vector) {
6310 if ((start > 0) && (stop - start > 0)) {
6321 Int_t sz = thick*thick;
6325 ARGB32 color = ARGB32_White;
6326 parse_argb_color(col, &color);
6331 matrix =
new CARD32[sz];
6334 for (
int i = 0; i < sz; i++) {
6335 matrix[i] = (CARD32)color;
6339 brush.matrix = matrix;
6340 brush.width = thick;
6341 brush.height = thick;
6342 brush.center_y = brush.center_x = thick/2;
6345 asim_cube_bezier(ctx,
x1,
y1,
x2,
y2,
x3, y3);
6358 const char *col,
Int_t thick)
6360 thick = !thick ? 1 : thick;
6361 Int_t sz = thick*thick;
6365 ARGB32 color = ARGB32_White;
6366 parse_argb_color(col, &color);
6371 matrix =
new CARD32[sz];
6374 for (
int i = 0; i < sz; i++) {
6375 matrix[i] = (CARD32)color;
6379 brush.matrix = matrix;
6380 brush.width = thick > 0 ? thick : 1;
6381 brush.height = thick > 0 ? thick : 1;
6382 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6385 asim_straight_ellips(ctx,
x,
y, rx, ry, thick < 0);
6399 thick = !thick ? 1 : thick;
6400 Int_t sz = thick*thick;
6404 ARGB32 color = ARGB32_White;
6405 parse_argb_color(col, &color);
6411 matrix =
new CARD32[sz];
6414 for (
int i = 0; i < sz; i++) {
6415 matrix[i] = (CARD32)color;
6419 brush.matrix = matrix;
6420 brush.height = brush.width = thick > 0 ? thick : 1;
6421 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6424 asim_circle(ctx,
x,
y,
r, thick < 0);
6438 const char *col,
Int_t thick)
6440 thick = !thick ? 1 : thick;
6441 Int_t sz = thick*thick;
6445 ARGB32 color = ARGB32_White;
6446 parse_argb_color(col, &color);
6451 matrix =
new CARD32[sz];
6454 for (
int i = 0; i < sz; i++) {
6455 matrix[i] = (CARD32)color;
6459 brush.matrix = matrix;
6460 brush.width = thick > 0 ? thick : 1;
6461 brush.height = thick > 0 ? thick : 1;
6462 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6465 asim_ellips(ctx,
x,
y, rx, ry,
angle, thick < 0);
6478 const char *col,
Int_t thick)
6480 thick = !thick ? 1 : thick;
6481 Int_t sz = thick*thick;
6485 ARGB32 color = ARGB32_White;
6486 parse_argb_color(col, &color);
6491 matrix =
new CARD32[sz];
6494 for (
int i = 0; i < sz; i++) {
6495 matrix[i] = (CARD32)color;
6499 brush.matrix = matrix;
6500 brush.width = thick > 0 ? thick : 1;
6501 brush.height = thick > 0 ? thick : 1;
6502 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6505 asim_ellips2(ctx,
x,
y, rx, ry,
angle, thick < 0);
6517 const char * ,
const char * )
6531 Warning(
"Gray",
"Image not initiated");
6536 Warning(
"Gray",
"Visual not initiated");
6543 ASImage *sav =
nullptr;
6561 if (
fImage->alt.argb32) {
6563 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
6565 for (i = 0; i <
fImage->height; i++) {
6566 for (j = 0; j <
fImage->width; j++) {
6569 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6570 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6571 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6572 l = (57*
r + 181*
g + 18*
b)/256;
6580 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
6592 Warning(
"ToGray",
"Failed to start image output");
6599 CARD32 *aa = imdec->buffer.alpha;
6600 CARD32 *rr = imdec->buffer.red;
6601 CARD32 *gg = imdec->buffer.green;
6602 CARD32 *bb = imdec->buffer.blue;
6607 for (i = 0; i <
fImage->height; i++) {
6608 imdec->decode_image_scanline(imdec);
6609 result.flags = imdec->buffer.flags;
6610 result.back_color = imdec->buffer.back_color;
6612 for (j = 0; j <
fImage->width; j++) {
6613 l = (57*rr[j] + 181*gg[j]+ 18*bb[j])/256;
6619 imout->output_image_scanline(imout, &
result, 1);
6622 stop_image_decoding(&imdec);
6623 stop_image_output(&imout);
6663 Warning(
"FromWindow",
"Visual not initiated");
6671 static int x11 = -1;
6672 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
6682 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
6697 for (
UInt_t i = 0; i <
h/2; ++i) {
6698 memcpy(xx, buf + 4*
w*i, 4*
w);
6699 memcpy(buf + 4*
w*i, buf + 4*
w*(
h-i-1), 4*
w);
6700 memcpy(buf + 4*
w*(
h-i-1), xx, 4*
w);
6704 fImage = bitmap2asimage(buf,
w,
h, 0,
nullptr);
6728 gPad->Range(-left / (1.0 - left - right),
6729 -bottom / (1.0 - top - bottom),
6730 1 + right / (1.0 - left - right),
6731 1 + top / ( 1.0 - top - bottom));
6732 gPad->RangeAxis(0, 0, 1, 1);
6742 char *buf =
nullptr;
6757 name.ReplaceAll(
".",
"_");
6766 out << std::endl << str << std::endl << std::endl;
6769 out << xpm <<
"_img = TImage::Create();" << std::endl;
6770 out <<
" " << xpm <<
"_img->SetImageBuffer( (char **)" << xpm <<
", TImage::kXpm);" << std::endl;
6771 out <<
" " << xpm <<
"_img->Draw();" << std::endl;
6784 static char buf[32];
6785 FILE *fp = fopen(
name,
"rb+");
6788 printf(
"file %s : failed to open\n",
name);
6792 if (!fread(buf, 1, 20, fp)) {
6797 char dpi1 = (set & 0xffff) >> 8;
6798 char dpi2 = set & 0xff;
6803 for (i = 0; i < 20; i++) {
6804 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6805 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6811 if (i == 20 || dpi+4 >= 20) {
6813 printf(
"file %s : wrong JPEG format\n",
name);
6820 buf[dpi + 1] = dpi1;
6821 buf[dpi + 2] = dpi2;
6824 buf[dpi + 3] = dpi1;
6825 buf[dpi + 4] = dpi2;
6828 fwrite(buf, 1, 20, fp);
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t Window_t
Window handle.
@ kGXorReverse
src OR NOT dst
@ kGXnand
NOT src OR NOT dst.
@ kGXandReverse
src AND NOT dst
@ kGXorInverted
NOT src OR dst.
@ kGXandInverted
NOT src AND dst.
@ kGXequiv
NOT src XOR dst.
@ kGXnor
NOT src AND NOT dst.
@ kGXcopyInverted
NOT src.
Handle_t GContext_t
Graphics context handle.
Handle_t Drawable_t
Drawable handle.
const Mask_t kGCClipYOrigin
static const double x3[11]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
static ARGB32 GetShadow(ARGB32 background)
Calculate shadow color.
static const UInt_t kBrushCacheSize
static CARD32 gBrushCache[kBrushCacheSize *kBrushCacheSize]
static unsigned long kAllPlanes
static ARGB32 GetAverage(ARGB32 foreground, ARGB32 background)
Get average.
static char * gIconPaths[7]
static int GetPolyYBounds(TPoint *pts, int n, int *by, int *ty)
Get poly bounds along Y.
static CARD8 MakeComponentHilite(int cmp)
Make component hilite.
static ARGB32 GetHilite(ARGB32 background)
Calculate highlite color.
static const UInt_t NUMPTSTOBUFFER
static ASFontManager * gFontManager
static void init_icon_paths()
Set icons paths.
#define _MEMSET_(dst, lng, val)
#define FillSpansInternal(npt, ppt, widths, color)
static ASDrawContext * create_draw_context_argb32(ASImage *im, ASDrawTool *brush)
Create draw context.
#define _alphaBlend(bot, top)
static void destroy_asdraw_context32(ASDrawContext *ctx)
Destroy asdraw context32.
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
static int InsertionSort(EdgeTableEntry *AET)
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2)
static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
static void FreeStorage(ScanLineListBlock *pSLLBlock)
static void CreateETandAET(int count, TPoint *pts, EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void cmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t del
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void foreground
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char FillPolygon
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t FillRectangle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pxm
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TStyle * gStyle
R__EXTERN const char * gProgName
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualPS * gVirtualPS
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths) override
Crop spans.
void Gradient(UInt_t angle=0, const char *colors="#FFFFFF #000000", const char *offsets=nullptr, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Render multipoint gradient inside rectangle of size (width, height) at position (x,...
void Blur(Double_t hr=3, Double_t vr=3) override
Perform Gaussian blur of the image (useful for drop shadows).
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
void StartPaletteEditor() override
Start palette editor.
void Bevel(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0, const char *hi="#ffdddddd", const char *lo="#ff555555", UShort_t thick=1, Bool_t pressed=kFALSE) override
Bevel is used to create 3D effect while drawing buttons, or any other image that needs to be framed.
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
UInt_t GetWidth() const override
Return width of original image not of the displayed image.
Double_t fMinValue
! min value in image
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col="#000000", Int_t thick=1) override
Draw an ellipse.
void Paint(Option_t *option="") override
Paint image.
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
void SetPaletteEnabled(Bool_t on=kTRUE) override
Switch on/off the image palette.
static Bool_t fgInit
global flag to init afterimage only once
const char * GetTitle() const override
Title is used to keep 32x32 xpm image's thumbnail.
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h) override
Creates an image (screenshot) from a RGBA buffer.
void HSV(UInt_t hue=0, UInt_t radius=360, Int_t H=0, Int_t S=0, Int_t V=0, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
This function will tile original image to specified size with offsets requested, and then it will go ...
void Tile(UInt_t width, UInt_t height) override
Tile the original image.
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Write image to specified file.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Is the mouse in the image ?
char * GetObjectInfo(Int_t px, Int_t py) const override
Get image pixel coordinates and the pixel value at the mouse pointer.
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col="#000000", UInt_t thick=1) override
Draw a line.
Double_t fMaxValue
! max value in image
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height) override
The area of an image displayed in a pad is defined by this function.
UInt_t fZoomWidth
! width of zoomed image in image pixels
Bool_t fEditable
! kTRUE image can be resized, moved by resizing/moving gPad
TObject * Clone(const char *newname) const override
Clone image.
Int_t fZoomUpdate
! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops
Bool_t IsValid() const override
TClass * IsA() const override
void DrawCubeBezier(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t x3, Int_t y3, const char *col="#000000", UInt_t thick=1) override
Draw a cubic bezier line.
void DrawFillArea(UInt_t npt, TPoint *ppt, const char *col="#000000", const char *stipple=nullptr, UInt_t w=16, UInt_t h=16) override
Fill a polygon (any type convex, non-convex).
void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick)
Draw a vertical line.
UInt_t * GetRgbaArray() override
Return a pointer to an array[width x height] of RGBA32 values.
void FillRectangle(const char *col=nullptr, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified col...
void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col="#000000", Int_t thick=1) override
Draw a straight ellipse.
Double_t * GetVecArray() override
Return a pointer to internal array[width x height] of double values [0,1].
void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col="#000000", Int_t thick=1) override
Draw a circle.
ASImage * fImage
! pointer to image structure of original image
void Gray(Bool_t on=kTRUE) override
Convert RGB image to Gray image and vice versa.
void DrawText(Int_t x=0, Int_t y=0, const char *text="", Int_t size=12, const char *color=nullptr, const char *font="fixed", EText3DType type=TImage::kPlain, const char *fore_file=nullptr, Float_t angle=0) override
Draw text of size (in pixels for TrueType fonts) at position (x, y) with color specified by hex strin...
UInt_t fZoomHeight
! hight of zoomed image in image pixels
void Pad(const char *color="#00FFFFFF", UInt_t left=0, UInt_t right=0, UInt_t top=0, UInt_t bottom=0) override
Enlarge image, padding it with specified color on each side in accordance with requested geometry.
static THashTable * fgPlugList
! hash table containing loaded plugins
UInt_t * GetArgbArray() override
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible...
Bool_t SetImageBuffer(char **buffer, EImageFileTypes type=TImage::kPng) override
Create image from compressed buffer.
Double_t * Vectorize(UInt_t max_colors=256, UInt_t dither=4, Int_t opaque_threshold=1) override
Reduce color-depth of an image and fills vector of "scientific data" [0...1].
Int_t Idx(Int_t idx)
Return a valid index in fImage tables to avoid seg-fault by accessing out of indices out of array's r...
void FillPolygon(UInt_t npt, TPoint *ppt, const char *col="#000000", const char *stipple=nullptr, UInt_t w=16, UInt_t h=16) override
Fill a convex polygon with background color or bitmap.
void SetDefaults()
Set default parameters.
void CopyArea(TImage *dst, Int_t xsrc, Int_t ysrc, UInt_t w, UInt_t h, Int_t xdst=0, Int_t ydst=0, Int_t gfunc=3, EColorChan chan=kAllChan) override
Copy source region to the destination image.
void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Draw wide line.
Pixmap_t GetMask() override
Returns image mask pixmap (alpha channel).
UInt_t * GetScanline(UInt_t y) override
Return a pointer to scan-line.
void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, const char *col="#000000", const char *stipple=nullptr, UInt_t w=16, UInt_t h=16) override
Fill spans with specified color or/and stipple.
void DrawEllips2(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col="#000000", Int_t thick=1) override
Draw an ellipse.
void Draw(Option_t *option="") override
Draw image.
void CropPolygon(UInt_t npt, TPoint *ppt) override
Crop a convex polygon.
static const ASVisual * GetVisual()
Return visual.
void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col="#000000", UInt_t thick=1, TImage::ECoordMode mode=kCoordModeOrigin) override
Draw a polyline.
void PolyPoint(UInt_t npt, TPoint *ppt, const char *col="#000000", TImage::ECoordMode mode=kCoordModeOrigin) override
Draw a poly point.
static void Image2Drawable(ASImage *im, Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="")
Draw asimage on drawable.
void Merge(const TImage *im, const char *op="alphablend", Int_t x=0, Int_t y=0) override
Merge two images.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t *ic) override
Draw a cell array.
void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height)
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified col...
void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=nullptr) override
Flood fill.
TASImage * fScaledImage
! temporary scaled and zoomed image produced from original image
Bool_t IsEditable() const override
UInt_t fZoomOffX
! X - offset for zooming in image pixels
void ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Read specified image file.
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng) override
Return in-memory buffer compressed according image type.
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd, UInt_t toWidth, UInt_t toHeight) override
Another method of enlarging images where corners remain unchanged, but middle part gets tiled.
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette=nullptr) override
Deletes the old image and creates a new image depending on the values of imageData.
void DrawTextTTF(Int_t x, Int_t y, const char *text, Int_t size, UInt_t color, const char *font_name, Float_t angle)
Draw text using TrueType fonts.
void PutPixel(Int_t x, Int_t y, const char *col="#000000") override
Draw a point at the specified position.
void Browse(TBrowser *) override
Browse image.
void DrawDashZTLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed line with thick pixel width.
void DestroyImage()
Destroy image.
static Bool_t InitVisual()
Static function to initialize the ASVisual.
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
void UnZoom() override
Un-zoom the image to original size.
void Streamer(TBuffer &) override
Streamer for ROOT I/O.
TArrayL * GetPixels(Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Return 2D array of machine dependent pixel values.
void PaintImage(Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="") override
Draw image on the drawable wid (pixmap, window) at x,y position.
ASImage * fGrayImage
! gray image
void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed vertical line.
void SetTitle(const char *title="") override
Set a title for an image.
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col="#000000", UInt_t thick=1) override
Draw a rectangle.
void Append(const TImage *im, const char *option="+", const char *color="#00000000") override
Append image.
void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed horizontal line.
void DrawDashLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, const char *col="#000000", UInt_t thick=1) override
Draw a dashed line.
void SetPalette(const TImagePalette *palette) override
Set a new palette to an image.
void Scale(UInt_t width, UInt_t height) override
Scale the original image.
TASImage()
Default image constructor.
TASImage & operator=(const TASImage &img)
Image assignment operator.
void Mirror(Bool_t vert=kTRUE) override
Mirror image in place.
void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col)
Draw a dashed line with one pixel width.
void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1) override
Draw segments.
Pixmap_t GetPixmap() override
Returns image pixmap.
void FromWindow(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Create an image (screenshot) from specified window.
TArrayD * GetArray(UInt_t w=0, UInt_t h=0, TImagePalette *pal=gWebImagePalette) override
In case of vectorized image return an associated array of doubles otherwise this method creates and r...
void Flip(Int_t flip=180) override
Flip image in place.
Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth)
The code is based on Xserver/mi/mipolycon.c "Copyright 1987, 1998 The Open Group".
void Crop(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Crop an image.
void EndPaint() override
EndPaint does internal RLE compression of image data.
void BeginPaint(Bool_t fast=kTRUE) override
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
static ASVisual * fgVisual
pointer to visual structure
virtual ~TASImage()
Image destructor, clean up image and visual.
void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const
Return the zoom parameters.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
UInt_t GetScaledHeight() const
Return height of the displayed image not of the original image.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute mouse events.
void FromPad(TVirtualPad *pad, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Create an image from the given pad, afterwards this image can be saved in any of the supported image ...
UInt_t GetHeight() const override
Return height of original image not of the displayed image.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, const char *col="#000000", UInt_t thick=1, Int_t mode=0) override
Draw a box.
Bool_t fIsGray
! kTRUE if image is gray
void CreateThumbnail()
Create image thumbnail.
Array of doubles (64 bits per element).
void AddAt(Double_t c, Int_t i)
Set the double c value at position i in the array.
const Double_t * GetArray() const
Array of longs (32 or 64 bits per element).
void AddAt(Long_t c, Int_t i)
Add long c at position i. Check for out of bounds.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Bool_t fConstRatio
keep aspect ratio of image on the screen
EImageQuality GetImageQuality() const
Bool_t GetConstRatio() const
virtual const TImagePalette & GetPalette() const
TImagePalette fPalette
color palette for value -> color conversion
virtual void Streamer(TBuffer &)
UInt_t GetImageCompression() const
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Using a TBrowser one can browse all ROOT objects.
Buffer base class used for serializing objects.
The color creation and management class.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
const char * AsHexString() const
Return color as hexadecimal string.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
void Draw(Option_t *option="") override
Draw this frame with its current attributes.
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
THashTable implements a hash table to store TObject's.
void Add(TObject *obj) override
Add object to the hash table.
TObject * FindObject(const char *name) const override
Find object using its name.
Save canvas as an image (GIF, JPEG, PNG, XPM, TIFF etc.).
A class to define a conversion from pixel values to pixel color.
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b)
Returns an index of the closest color.
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
UInt_t fNumPoints
number of anchor points
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
virtual unsigned char * ReadFile(const char *filename, UInt_t &w, UInt_t &h)=0
An abstract interface to image processing library.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual UInt_t * GetArgbArray()
virtual UInt_t GetWidth() const
static TImage * Create()
Create an image.
TImage & operator=(const TImage &img)
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual void BeginPaint(Bool_t=kTRUE)
virtual UInt_t GetHeight() const
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual void SetName(const char *name)
Set the name of the TNamed.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
void ToLower()
Change string to lower-case.
Int_t Atoi() const
Return integer value of string.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Float_t GetScreenFactor() const
Float_t GetImageScaling() const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
TTF helper class containing glyphs description.
FT_Glyph fImage
glyph image
static Bool_t IsInitialized()
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
static void Init()
Initialise the TrueType fonts interface.
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
static void SetTextFont(Font_t fontnumber)
Set specified font.
static TTGlyph * GetGlyphs()
static Int_t GetNumGlyphs()
static const FT_BBox & GetBox()
static void SetTextSize(Float_t textsize)
Set current text size.
static FT_Matrix * GetRotMatrix()
Base class for several text objects.
Int_t GetNoElements() const
Element * GetMatrixArray()
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual void CellArrayEnd()=0
virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)=0
virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)=0
virtual void * GetStream() const
virtual void Open(const char *filename, Int_t type=-111)=0
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
small helper class to store/restore gPad context in TPad methods
TVirtualPad is an abstract base class for the Pad and Canvas classes.
const char * GetName() const override=0
Returns name of object.
virtual Int_t GetPixmapID() const =0
virtual Int_t VtoPixel(Double_t v) const =0
void Paint(Option_t *option="") override=0
This method must be overridden if a class wants to paint itself.
virtual Int_t UtoPixel(Double_t u) const =0
virtual Int_t GetCanvasID() const =0
virtual TCanvas * GetCanvas() const =0
virtual void SetBorderMode(Short_t bordermode)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Graphics context structure.
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fClipXOrigin
origin for clipping
Mask_t fMask
bit mask specifying which fields are valid
Used for drawing line segments (maps to the X11 XSegments structure)
struct _EdgeTableEntry * next
struct _ScanLineListBlock * next
EdgeTableEntry * edgelist
struct _ScanLineList * next
void flip(struct mesh *m, struct behavior *b, struct otri *flipedge)