64#include "RConfigure.h"
102# include "Windows4root.h"
106# define X_DISPLAY_MISSING 1
108# include <afterbase.h>
110# define X_DISPLAY_MISSING 1
111# include <afterbase.h>
113# 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;\
247 fImage = create_asimage(w ? w : 20,
h ?
h : 20, 0);
260 gSystem->ExpandPathName(fname);
273 SetImage(imageData, width, height, palette);
286 SetImage(imageData, width, palette);
299 SetImage(imageData, width, palette);
314 if (img.
fImage->alt.vector) {
335 if (
this != &img && img.
IsValid()) {
345 if (img.
fImage->alt.vector) {
378 TString icon_path =
gEnv->GetValue(
"Gui.IconPath",
"");
383 icon_path =
".:" + icon_path +
":" + TROOT::GetIconPath() +
":" + EXTRAICONPATH;
385 icon_path =
".;" + icon_path +
";" + TROOT::GetIconPath() +
";" + EXTRAICONPATH;
393 const char *delim =
":";
395 const char *delim =
";";
397 while (icon_path.
Tokenize(token, from, delim) && cnt < 6) {
398 char *path =
gSystem->ExpandPathName(token.
Data());
413 FILE *fp = fopen(file,
"rb");
414 const char *
ret =
"";
416 if (!fp)
return nullptr;
418 if (!fread(&magic, 1, 1, fp)) {
426 if (!fread(&magic, 1, 1, fp)) {
430 if (!fread(&magic, 1, 1, fp)) {
435 ret = (magic == 1) ?
"ico" :
"cur";
440 if (!fread(&magic, 1, 1, fp)) {
447 else if (magic == 0x50)
498 Warning(
"ReadImage",
"Visual not initiated");
502 Bool_t xpm = filename && (filename[0] ==
'/' &&
503 filename[1] ==
'*') && filename[2] ==
' ';
515 set_output_threshold(0);
517 static ASImageImportParams iparams;
521 iparams.filter = SCL_DO_ALL;
522 iparams.gamma = SCREEN_GAMMA;
523 iparams.gamma_table = NULL;
525 iparams.format = ASA_ASImage;
527 iparams.subimage = 0;
528 iparams.return_animation_delay = -1;
532 if (filename) dot = strrchr(filename,
'.');
534 ASImage *image =
nullptr;
545 iparams.subimage = ext.
Atoi();
547 ext = strrchr(fname.
Data(),
'.') + 1;
550 image = file2ASImage_extra(fname.
Data(), &iparams);
562 unsigned char *bitmap =
nullptr;
568 if (!handler || ((handler->
LoadPlugin() == -1))) {
587 image = bitmap2asimage(bitmap, w,
h, 0,
nullptr);
666 Error(
"WriteImage",
"no image in memory. Draw something first");
670 if (!file || !*file) {
671 Error(
"WriteImage",
"no file name specified");
676 if ((s = strrchr(file,
'.'))) {
680 Error(
"WriteImage",
"cannot determine a valid file type");
688 Error(
"WriteImage",
"not a valid file type was specified");
694 ASImageFileTypes atype = (ASImageFileTypes)mytype;
702 static ASImageExportParams parms;
707 parms.xpm.type = atype;
708 parms.xpm.flags = EXPORT_ALPHA;
709 parms.xpm.dither = 4;
710 parms.xpm.opaque_threshold = 127;
711 parms.xpm.max_colors = 512;
714 ASImage2bmp(im, fname.
Data(),
nullptr);
717 ASImage2xcf(im, fname.
Data(),
nullptr);
720 parms.png.type = atype;
721 parms.png.flags = EXPORT_ALPHA;
725 parms.jpeg.type = atype;
726 parms.jpeg.flags = 0;
727 parms.jpeg.quality = aquality;
730 parms.gif.type = atype;
731 parms.gif.flags = EXPORT_ALPHA;
732 parms.gif.dither = 0;
733 parms.gif.opaque_threshold = 0;
737 parms.gif.type = atype;
738 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
739 parms.gif.dither = 0;
740 parms.gif.opaque_threshold = 0;
741 parms.gif.animate_repeats = 0;
754 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
755 parms.gif.animate_repeats = 0;
756 }
else if(sufix==
"") {
773 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
774 parms.gif.animate_repeats = atoi(s);
783 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
784 parms.gif.animate_repeats = 0;
785 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
791 delay = atoi(sDelay);
792 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
793 parms.gif.animate_repeats = atoi(sRepeats);
795 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
799 parms.gif.animate_delay = delay;
801 int i1 = fname.
Index(
"gif+");
803 fname = fname(0, i1 + 3);
806 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
812 parms.tiff.type = atype;
813 parms.tiff.flags = EXPORT_ALPHA;
814 parms.tiff.rows_per_strip = 0;
815 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
816 TIFF_COMPRESSION_NONE;
817 parms.tiff.jpeg_quality = 100;
818 parms.tiff.opaque_threshold = 0;
821 Error(
"WriteImage",
"file type %s not yet supported", s);
825 if (!ASImage2file(im,
nullptr, fname.
Data(), atype, &parms)) {
826 Error(
"WriteImage",
"error writing file %s", file);
844 if (s ==
"jpg" || s ==
"jpeg")
883 astype = ASIT_Xpm;
break;
885 astype = ASIT_ZCompressedXpm;
break;
887 astype = ASIT_GZCompressedXpm;
break;
889 astype = ASIT_Png;
break;
891 astype = ASIT_Jpeg;
break;
893 astype = ASIT_Xcf;
break;
895 astype = ASIT_Ppm;
break;
897 astype = ASIT_Pnm;
break;
899 astype = ASIT_Bmp;
break;
901 astype = ASIT_Ico;
break;
903 astype = ASIT_Cur;
break;
905 astype = ASIT_Gif;
break;
907 astype = ASIT_Gif;
break;
909 astype = ASIT_Tiff;
break;
911 astype = ASIT_Xbm;
break;
913 astype = ASIT_Targa;
break;
915 astype = ASIT_XMLScript;
break;
917 astype = ASIT_Unknown;
923 case ASIT_ZCompressedXpm:
925 case ASIT_GZCompressedXpm:
968 asquality = 25;
break;
970 asquality = 75;
break;
972 asquality = 50;
break;
974 asquality = 100;
break;
980 if (asquality > 0 && asquality <= 25)
982 if (asquality > 26 && asquality <= 50)
984 if (asquality > 51 && asquality <= 75)
986 if (asquality > 76 && asquality <= 100)
1006 Warning(
"SetImage",
"Visual not initiated");
1015 for (
Int_t pixel = 1; pixel <
Int_t(width * height); pixel++) {
1023 ASVectorPalette asPalette;
1027 for (col = 0; col < 4; col++)
1028 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1035 asPalette.points =
new Double_t[asPalette.npoints];
1036 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1040 height, &asPalette, ASA_ASImage,
1043 delete [] asPalette.points;
1044 for (col = 0; col < 4; col++)
1045 delete [] asPalette.channels[col];
1089 Error(
"FromPad",
"pad cannot be 0");
1094 Warning(
"FromPad",
"Visual not initiated");
1103 if (
gROOT->IsBatch()) {
1111 if (itmp && itmp->
fImage) {
1120 if (itmp && itmp->
fImage && (itmp !=
this)) {
1122 if (itmp->
fImage->alt.argb32) {
1124 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1125 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1152 static int x11 = -1;
1153 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1158 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0, w,
h);
1163 fImage = bitmap2asimage(bits, w,
h, 0,
nullptr);
1184 Error(
"Draw",
"no image set");
1197 w =
Int_t(w*cx) + 4;
1212 gPad->Range(-left / (1.0 - left - right),
1213 -bottom / (1.0 - top - bottom),
1214 1 + right / (1.0 - left - right),
1215 1 + top / ( 1.0 - top - bottom));
1216 gPad->RangeAxis(0, 0, 1, 1);
1239 wsrc = wsrc ? wsrc : im->width;
1240 hsrc = hsrc ? hsrc : im->height;
1242 static int x11 = -1;
1243 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1250 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1257 char *bits =
new char[ww*hh];
1259 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1260 xsrc, ysrc, ww, 0,
nullptr);
1262 for (yy = 0; yy < hh; yy++) {
1263 imdec->decode_image_scanline(imdec);
1264 CARD32 *
a = imdec->buffer.alpha;
1266 for (xx = 0; xx < ww; xx++) {
1281 stop_image_decoding(&imdec);
1284 (
const char *)bits, ww, hh);
1302 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1303 asimage2drawable(
fgVisual, wid, im, (GC)gc, xsrc, ysrc,
x,
y, wsrc, hsrc, 1);
1305 ASImage *img =
nullptr;
1306 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1308 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1309 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1311 bits = (
unsigned char *)img->alt.argb32;
1318 if (
gPad &&
gPad->GetGLDevice() != -1) {
1320 painter->DrawPixels(bits, wsrc, hsrc,
x,
y, !option.
Contains(
"opaque"));
1328 gVirtualX->CopyArea(pic, wid, gc, 0, 0, wsrc, hsrc,
x,
y);
1335 destroy_asimage(&img);
1361 xsrc, ysrc, wsrc, hsrc, opt);
1380 Error(
"Paint",
"no image set");
1385 Warning(
"Paint",
"Visual not initiated");
1389 Int_t tile_x = 0, tile_y = 0;
1390 CARD32 tile_tint = 0;
1399 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1402 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1405 Error(
"Paint",
"tile option error");
1413 if (!
fImage->alt.vector) {
1426 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1427 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1430 if ((to_w < 25 || to_h < 25) && !expand) {
1431 Error(
"Paint",
"pad too small to display an image");
1443 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1444 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1446 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1447 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1452 ASImage *grad_im =
nullptr;
1460 grad.type = GRADIENT_Top2Bottom;
1461 grad.color =
new ARGB32[grad.npoints];
1462 grad.offset =
new double[grad.npoints];
1465 Int_t oldPt = grad.npoints -
pt -1;
1466 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1467 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1469 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1470 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1474 pal_h, SCL_DO_COLOR,
1477 delete [] grad.color;
1478 delete [] grad.offset;
1486 to_w, to_h, tile_tint, ASA_ASImage,
1521 destroy_asimage(&tmpImage);
1536 Error(
"Paint",
"image could not be rendered to display");
1540 int tox = expand ? 0 :
int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1541 int toy = expand ? 0 :
int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1543 auto ps =
gPad->GetPainter()->GetPS();
1560 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1561 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1562 min, max, ndiv,
"+LU");
1567 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1568 min, max, ndiv,
"+L");
1575 if (ps->InheritsFrom(
"TImageDump")) {
1579 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1584 dump->
Merge(&tgrad,
"alphablend", pal_Ax, pal_Ay);
1594 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1595 min, max, ndiv,
"+L");
1598 }
else if (ps->InheritsFrom(
"TPDF")) {
1599 Warning(
"Paint",
"PDF not implemented yet");
1601 }
else if (ps->InheritsFrom(
"TSVG")) {
1602 paint_as_png =
kTRUE;
1611 x2 = x1+dx/image->width;
1613 y2 = y1+dy/image->height;
1615 x1 =
gPad->GetX1()+dx*
gPad->GetLeftMargin();
1616 x2 = x1+(dx*(1-
gPad->GetRightMargin()-
gPad->GetLeftMargin()))/image->width;
1617 y1 =
gPad->GetY2()-dy*
gPad->GetTopMargin();
1618 y2 = y1+(dy*(1-
gPad->GetTopMargin()-
gPad->GetBottomMargin()))/image->height;
1623 ps->SetFillStyle(1001);
1625 ps->CellArrayBegin(image->width, image->height, x1, x2, y1, y2);
1628 char *buffer =
nullptr;
1630 ASImageExportParams params;
1631 params.png.type = ASIT_Png;
1632 params.png.flags = EXPORT_ALPHA;
1634 if (!params.png.compression)
1635 params.png.compression = -1;
1636 if (ASImage2PNGBuff(image, (CARD8 **)&buffer, &
size, ¶ms)) {
1637 ps->CellArrayPng(buffer,
size);
1641 auto imdec = start_image_decoding(
fgVisual, image, SCL_DO_ALL,
1642 0, 0, image->width, image->height,
nullptr);
1644 for (
Int_t yt = 0; yt < (
Int_t)image->height; yt++) {
1645 imdec->decode_image_scanline(imdec);
1646 for (
Int_t xt = 0; xt < (
Int_t)image->width; xt++)
1647 ps->CellArrayFill(imdec->buffer.red[xt],
1648 imdec->buffer.green[xt],
1649 imdec->buffer.blue[xt]);
1651 stop_image_decoding(&imdec);
1657 Double_t xconv = (
gPad->AbsPixeltoX(pal_Ax + pal_w) -
gPad->AbsPixeltoX(pal_Ax)) / grad_im->width;
1658 Double_t yconv = (
gPad->AbsPixeltoY(pal_Ay - pal_h) -
gPad->AbsPixeltoY(pal_Ay)) / grad_im->height;
1659 x1 =
gPad->AbsPixeltoX(pal_Ax);
1661 y2 =
gPad->AbsPixeltoY(pal_Ay);
1663 ps->CellArrayBegin(grad_im->width, grad_im->height,
1667 char *buffer =
nullptr;
1669 ASImageExportParams params;
1670 params.png.type = ASIT_Png;
1671 params.png.flags = EXPORT_ALPHA;
1673 if (!params.png.compression)
1674 params.png.compression = -1;
1676 if (ASImage2PNGBuff(grad_im, (CARD8 **)&buffer, &
size, ¶ms)) {
1677 ps->CellArrayPng(buffer,
size);
1681 auto imdec = start_image_decoding(
fgVisual, grad_im, SCL_DO_ALL,
1682 0, 0, grad_im->width, grad_im->height,
nullptr);
1684 for (
Int_t yt = 0; yt < (
Int_t)grad_im->height; yt++) {
1685 imdec->decode_image_scanline(imdec);
1686 for (
Int_t xt = 0; xt < (
Int_t)grad_im->width; xt++)
1687 ps->CellArrayFill(imdec->buffer.red[xt],
1688 imdec->buffer.green[xt],
1689 imdec->buffer.blue[xt]);
1691 stop_image_decoding(&imdec);
1704 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1705 min, max, ndiv,
"+L");
1711 destroy_asimage(&grad_im);
1720 Int_t pxl, pyl, pxt, pyt;
1727 if (px1 < px2) {pxl = px1; pxt = px2;}
1728 else {pxl = px2; pxt = px1;}
1729 if (py1 < py2) {pyl = py1; pyt = py2;}
1730 else {pyl = py2; pyt = py1;}
1732 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1743 static std::unique_ptr<TBox> ZoomBox;
1748 gPad->ExecuteEvent(event, px, py);
1754 static Int_t px1old, py1old, px2old, py2old;
1755 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
1766 if (imgX < 0) px = px - imgX;
1767 if (imgY < 0) py = py - imgY;
1772 if (imgX >= (
int)image->width) px = px - imgX + image->width - 1;
1773 if (imgY >= (
int)image->height) py = py - imgY + image->height - 1;
1778 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1779 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1780 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1781 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1782 px1old = px; py1old = py;
1798 ZoomBox->SetX1(
gPad->AbsPixeltoX(pxl));
1799 ZoomBox->SetY1(
gPad->AbsPixeltoY(pyl));
1800 ZoomBox->SetX2(
gPad->AbsPixeltoX(pxt));
1801 ZoomBox->SetY2(
gPad->AbsPixeltoY(pyt));
1803 ZoomBox = std::make_unique<TBox>(pxl, pyl, pxt, pyt);
1804 ZoomBox->SetFillStyle(0);
1805 ZoomBox->Draw(
"l*");
1824 Int_t imgX1 = px1old -
gPad->XtoAbsPixel(0);
1825 Int_t imgY1 = py1old -
gPad->YtoAbsPixel(1);
1826 Int_t imgX2 = px -
gPad->XtoAbsPixel(0);
1827 Int_t imgY2 = py -
gPad->YtoAbsPixel(1);
1829 imgY1 = image->height - 1 - imgY1;
1830 imgY2 = image->height - 1 - imgY2;
1836 Zoom((imgX1 < imgX2) ? imgX1 : imgX2, (imgY1 < imgY2) ? imgY1 : imgY2,
1854 static char info[64];
1860 px -=
gPad->XtoAbsPixel(0);
1861 py -=
gPad->YtoAbsPixel(1);
1864 if (px < 0 || py < 0)
return info;
1868 if (px >= (
int)image->width || py >= (
int)image->height)
1871 py = image->height - 1 - py;
1878 if (
fImage->alt.vector) {
1879 snprintf(info,64,
"x: %d y: %d %.5g",
1882 snprintf(info,64,
"x: %d y: %d", px, py);
1898 Warning(
"SetPalette",
"Visual not initiated");
1903 Warning(
"SetPalette",
"Image not valid");
1913 ASVectorPalette asPalette;
1915 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1916 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1917 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1918 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1924 asPalette.points =
new double[asPalette.npoints];
1925 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1931 delete [] asPalette.points;
1932 for (
Int_t col = 0; col < 4; col++)
1933 delete [] asPalette.channels[col];
1950 Warning(
"Scale",
"Image not initiated");
1955 Warning(
"Scale",
"Visual not initiated");
1963 if (toWidth > 30000)
1965 if (toHeight > 30000)
1968 ASImage *img = scale_asimage(
fgVisual,
fImage, toWidth, toHeight,
1985 Warning(
"Slice",
"Image not initiated");
1990 Warning(
"Slice",
"Visual not initiated");
1998 if (toWidth > 30000)
2000 if (toHeight > 30000)
2004 yStart, yEnd, toWidth, toHeight,
2020 Warning(
"Tile",
"Image not initiated");
2025 Warning(
"Tile",
"Visual not initiated");
2033 if (toWidth > 30000)
2035 if (toHeight > 30000)
2038 ASImage *img = tile_asimage(
fgVisual,
fImage, 0, 0, toWidth, toHeight, 0,
2060 Warning(
"Zoom",
"Image not valid");
2082 Warning(
"UnZoom",
"Image not valid");
2109 Warning(
"Flip",
"Image not valid");
2113 Warning(
"Flip",
"Visual not initiated");
2117 if (
fImage->alt.vector) {
2118 Warning(
"Flip",
"flip does not work for data images");
2122 Int_t rflip = flip/90;
2156 Warning(
"Mirror",
"Image not valid");
2161 Warning(
"Mirror",
"Visual not initiated");
2165 if (
fImage->alt.vector) {
2166 Warning(
"Mirror",
"mirror does not work for data images");
2242 Display *disp = (Display*)
gVirtualX->GetDisplay();
2248 static ASVisual *vis_x =
nullptr;
2250 if (vis && cmap && !noX) {
2252 vis_x = create_asvisual_for_id(disp, screen, depth,
2253 XVisualIDFromVisual(vis), cmap,
nullptr);
2259 static ASVisual *vis_batch =
nullptr;
2264 vis_batch = create_asvisual(
nullptr, 0, 0,
nullptr);
2265 vis_batch->dpy =
nullptr;
2280 Warning(caller,
"Visual not initiated");
2289 if (!
fImage->alt.argb32) {
2293 if (!
fImage->alt.argb32) {
2294 Warning(caller,
"Failed to get argb32 pixel array");
2306 Warning(
"StartPaletteEditor",
"Image not valid");
2309 if (!
fImage->alt.vector) {
2310 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2325 Warning(
"GetPixmap",
"Visual not initiated");
2333 static int x11 = -1;
2334 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2338 img,
nullptr,
kTRUE);
2340 if (!
fImage->alt.argb32) {
2359 Warning(
"GetMask",
"Visual not initiated");
2366 Warning(
"GetMask",
"No image");
2371 UInt_t ow = img->width%8;
2372 UInt_t ww = img->width - ow + (ow ? 8 : 0);
2374 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALPHA,
2375 0, 0, ww, 0,
nullptr);
2379 std::vector<char> bits(ww * hh / 8);
2383 imdec->decode_image_scanline(imdec);
2384 CARD32 *
a = imdec->buffer.alpha;
2399 stop_image_decoding(&imdec);
2400 pxmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), bits.data(), ww, hh);
2410 Warning(
"SetImage",
"Visual not initiated");
2423 static int x11 = -1;
2424 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2429 unsigned char *bits =
gVirtualX->GetColorBits(pxm, 0, 0, w,
h);
2436 fImage = bitmap2asimage(bits, w,
h, 0,
nullptr);
2440 unsigned char *mask_bits =
gVirtualX->GetColorBits(mask, 0, 0, w,
h);
2441 fImage = bitmap2asimage(bits, w,
h, 0, mask_bits);
2442 delete [] mask_bits;
2453 Warning(
"GetPixels",
"Wrong Image");
2458 ASImageDecoder *imdec;
2460 width = !width ? img->width : width;
2461 height = !height ? img->height : height;
2472 if ((
x >= (
int)img->width) || (
y >= (
int)img->height)) {
2476 if ((
int)(
x + width) > (
int)img->width) {
2477 width = img->width -
x;
2480 if ((
int)(
y + height) > (
int)img->height) {
2481 height = img->height -
y;
2484 if ((imdec = start_image_decoding(
nullptr,
fImage, SCL_DO_ALL, 0,
y,
2485 img->width, height,
nullptr)) ==
nullptr) {
2486 Warning(
"GetPixels",
"Failed to create image decoder");
2494 for (
UInt_t k = 0; k < height; k++) {
2495 imdec->decode_image_scanline(imdec);
2497 for (
UInt_t i = 0; i < width; ++i) {
2498 if ((
r == (
Int_t)imdec->buffer.red[i]) &&
2499 (
g == (
Int_t)imdec->buffer.green[i]) &&
2500 (
b == (
Int_t)imdec->buffer.blue[i])) {
2502 r = (
Int_t)imdec->buffer.red[i];
2503 g = (
Int_t)imdec->buffer.green[i];
2504 b = (
Int_t)imdec->buffer.blue[i];
2507 ret->AddAt(p, k*width + i);
2511 stop_image_decoding(&imdec);
2523 Warning(
"GetVecArray",
"Bad Image");
2526 if (
fImage->alt.vector) {
2527 return fImage->alt.vector;
2545 Warning(
"GetArray",
"Bad Image");
2551 if (
fImage->alt.vector) {
2556 ASImageDecoder *imdec;
2558 w = w ? w :
fImage->width;
2567 if ((imdec = start_image_decoding(
nullptr, img, SCL_DO_ALL, 0, 0,
2568 img->width, 0,
nullptr)) ==
nullptr) {
2569 Warning(
"GetArray",
"Failed to create image decoder");
2574 CARD32
r = 0,
g = 0,
b = 0;
2578 for (
UInt_t k = 0; k <
h; k++) {
2579 imdec->decode_image_scanline(imdec);
2581 for (
UInt_t i = 0; i < w; ++i) {
2582 if ((
r == imdec->buffer.red[i]) &&
2583 (
g == imdec->buffer.green[i]) &&
2584 (
b == imdec->buffer.blue[i])) {
2586 r = imdec->buffer.red[i];
2587 g = imdec->buffer.green[i];
2588 b = imdec->buffer.blue[i];
2592 ret->AddAt(
v, (
h-k-1)*w + i);
2596 stop_image_decoding(&imdec);
2619 const char *color,
const char *font_name,
2622 UInt_t width = 0, height = 0;
2623 ARGB32 text_color = ARGB32_Black;
2624 ASImage *fore_im =
nullptr;
2625 ASImage *text_im =
nullptr;
2636 if (fn.
Last(
'/') == 0)
2637 fn = fn(1, fn.
Length() - 1);
2639 const char *ttpath =
gEnv->GetValue(
"Root.TTFontPath",
2640 TROOT::GetTTFFontDir());
2649 parse_argb_color(color, &text_color);
2662 Warning(
"DrawText",
"cannot create Font Manager");
2671 Warning(
"DrawText",
"cannot find a font %s", font_name);
2676 get_text_size(
text, font, (ASText3DType)type, &width, &height);
2679 fImage = create_asimage(width, height, 0);
2683 text_im = draw_text(
text, font, (ASText3DType)type, 0);
2688 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2690 if ((tmp->width != width) || (tmp->height != height)) {
2691 fore_im = tile_asimage(
fgVisual, tmp, 0, 0, width, height, 0,
2694 destroy_asimage(&tmp);
2701 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2702 destroy_asimage(&text_im);
2710 ASImage *rendered_im;
2711 ASImageLayer layers[2];
2713 init_image_layers(&(layers[0]), 2);
2714 fore_im->back_color = text_color;
2715 layers[0].im = rimg;
2716 layers[0].dst_x = 0;
2717 layers[0].dst_y = 0;
2718 layers[0].clip_width = rimg->width;
2719 layers[0].clip_height = rimg->height;
2720 layers[0].bevel =
nullptr;
2721 layers[1].im = fore_im;
2722 layers[1].dst_x =
x;
2723 layers[1].dst_y =
y;
2724 layers[1].clip_width = fore_im->width;
2725 layers[1].clip_height = fore_im->height;
2727 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2730 destroy_asimage(&fore_im);
2763 Warning(
"Merge",
"Visual not initiated");
2767 ASImage *rendered_im;
2768 ASImageLayer layers[2];
2770 init_image_layers(&(layers[0]), 2);
2772 layers[0].dst_x = 0;
2773 layers[0].dst_y = 0;
2774 layers[0].clip_width =
fImage->width;
2775 layers[0].clip_height =
fImage->height;
2776 layers[0].bevel =
nullptr;
2777 layers[1].im = ((
TASImage*)im)->fImage;
2778 layers[1].dst_x =
x;
2779 layers[1].dst_y =
y;
2780 layers[1].clip_width = im->
GetWidth();
2781 layers[1].clip_height = im->
GetHeight();
2782 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2800 Warning(
"Blur",
"Visual not initiated");
2805 fImage = create_asimage(100, 100, 0);
2808 Warning(
"Blur",
"Failed to create image");
2815 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2816 vr > 0 ? vr : 3, SCL_DO_ALL,
2829 Warning(
"Clone",
"Image not initiated");
2836 Warning(
"Clone",
"Failed to create image");
2852 if (
fImage->alt.argb32) {
2854 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2855 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2875 Warning(
"Vectorize",
"Visual not initiated");
2880 fImage = create_asimage(100, 100, 0);
2883 Warning(
"Vectorize",
"Failed to create image");
2894 dither = dither > 7 ? 7 : dither;
2896 res = colormap_asimage(
fImage, &cmap, max_colors, dither, opaque_threshold);
2908 g = INDEX_SHIFT_GREEN(cmap.entries[res[i]].green);
2909 b = INDEX_SHIFT_BLUE(cmap.entries[res[i]].blue);
2910 r = INDEX_SHIFT_RED(cmap.entries[res[i]].red);
2912 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2922 for (
UInt_t j = 0; j < cmap.count; j++) {
2923 g = INDEX_SHIFT_GREEN(cmap.entries[j].green);
2924 b = INDEX_SHIFT_BLUE(cmap.entries[j].blue);
2925 r = INDEX_SHIFT_RED(cmap.entries[j].red);
2926 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2928 v = (
v>>12) & 0x0FFF;
2931 pal->
fColorRed[j] = cmap.entries[j].red << 8;
2933 pal->
fColorBlue[j] = cmap.entries[j].blue << 8;
2937 destroy_colormap(&cmap,
kTRUE);
2943 if (res) safefree(res);
2989 Warning(
"HSV",
"Visual not initiated");
2994 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
2997 Warning(
"HSV",
"Failed to create image");
3006 width = !width ?
fImage->width : width;
3007 height = !height ?
fImage->height : height;
3009 ASImage *rendered_im =
nullptr;
3013 hue, radius,
H, S, V, ASA_ASImage, 100,
3014 ASIMAGE_QUALITY_TOP);
3017 Warning(
"HSV",
"Failed to create rendered image");
3055 Warning(
"Gradient",
"Visual not initiated");
3059 ASImage *rendered_im =
nullptr;
3060 ASGradient gradient;
3062 int reverse = 0, npoints1 = 0, npoints2 = 0;
3069 if ((angle > 2 * 180 * 15 / 16) || (angle < 2 * 180 * 1 / 16)) {
3070 gradient.type = GRADIENT_Left2Right;
3071 }
else if (angle < 2 * 180 * 3 / 16) {
3072 gradient.type = GRADIENT_TopLeft2BottomRight;
3073 }
else if (angle < 2 * 180 * 5 / 16) {
3074 gradient.type = GRADIENT_Top2Bottom;
3075 }
else if (angle < 2 * 180 * 7 / 16) {
3076 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
3077 }
else if (angle < 2 * 180 * 9 / 16) {
3078 gradient.type = GRADIENT_Left2Right; reverse = 1;
3079 }
else if (angle < 2 * 180 * 11 / 16) {
3080 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3081 }
else if (angle < 2 * 180 * 13 / 16) {
3082 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3084 gradient.type = GRADIENT_BottomLeft2TopRight;
3087 for (p = (
char*)
colors; isspace((
int)*p); p++) { }
3089 for (npoints1 = 0; *p; npoints1++) {
3091 for ( ; *p && !isspace((
int)*p); p++) { }
3093 for ( ; isspace((
int)*p); p++) { }
3096 for (p = (
char*)offsets; isspace((
int)*p); p++) { }
3098 for (npoints2 = 0; *p; npoints2++) {
3100 for ( ; *p && !isspace((
int)*p); p++) { }
3102 for ( ; isspace((
int)*p); p++) { }
3107 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3116 gradient.color =
new ARGB32[npoints1];
3117 gradient.offset =
new double[npoints1];
3119 for (p = (
char*)
colors; isspace((
int)*p); p++) { }
3121 for (npoints1 = 0; *p; ) {
3125 for ( ; *p && !isspace((
int)*p); p++) { }
3127 for ( ; isspace((
int)*p); p++) { }
3129 col = str(pb -
colors, p - pb);
3131 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3134 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3139 for (p = (
char*)offsets; isspace((
int)*p); p++) { }
3141 for (npoints2 = 0; *p; ) {
3145 for ( ; *p && !isspace((
int)*p); p++) { }
3148 gradient.offset[npoints2] = strtod(pb, &pb);
3150 if (pb == p) npoints2++;
3152 for ( ; isspace((
int)*p); p++) { }
3155 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3156 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3159 gradient.npoints = npoints1;
3161 if (npoints2 && (gradient.npoints > npoints2)) {
3162 gradient.npoints = npoints2;
3165 for (i = 0; i < gradient.npoints/2; i++) {
3166 int i2 = gradient.npoints - 1 - i;
3167 ARGB32
c = gradient.color[i];
3168 double o = gradient.offset[i];
3169 gradient.color[i] = gradient.color[i2];
3170 gradient.color[i2] =
c;
3171 gradient.offset[i] = gradient.offset[i2];
3172 gradient.offset[i2] = o;
3174 for (i = 0; i < gradient.npoints; i++) {
3175 gradient.offset[i] = 1.0 - gradient.offset[i];
3178 rendered_im = make_gradient(
fgVisual, &gradient, width, height, SCL_DO_ALL,
3181 delete [] gradient.color;
3182 delete [] gradient.offset;
3186 Warning(
"Gradient",
"Failed to create gradient image");
3195 ASImageLayer layers[2];
3197 init_image_layers(&(layers[0]), 2);
3199 layers[0].dst_x = 0;
3200 layers[0].dst_y = 0;
3201 layers[0].clip_width =
fImage->width;
3202 layers[0].clip_height =
fImage->height;
3203 layers[0].bevel =
nullptr;
3204 layers[1].im = rendered_im;
3205 layers[1].dst_x =
x;
3206 layers[1].dst_y =
y;
3207 layers[1].clip_width = width;
3208 layers[1].clip_height = height;
3209 layers[1].merge_scanlines = alphablend_scanlines;
3214 Warning(
"Gradient",
"Failed to create merged image");
3218 destroy_asimage(&rendered_im);
3233 cmp = (cmp * 12) / 10;
3235 return (cmp > 255) ? 255 : cmp;
3256 return (background >> 1) & 0x7F7F7F7F;
3267 a = ARGB32_ALPHA8(foreground) + ARGB32_ALPHA8(background);
3269 r = ARGB32_RED8(foreground) + ARGB32_RED8(background);
3271 g = ARGB32_GREEN8(foreground) + ARGB32_GREEN8(background);
3273 b = ARGB32_BLUE8(foreground) + ARGB32_BLUE8(background);
3276 return MAKE_ARGB32(
a,
r,
g,
b);
3292 const char *hi_color,
const char *lo_color,
UShort_t thick,
3296 Warning(
"Bevel",
"Visual not initiated");
3303 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3304 parse_argb_color(hi_color, &
hi);
3305 parse_argb_color(lo_color, &lo);
3308 bevel.lo_color =
hi;
3310 bevel.hi_color = lo;
3313 bevel.hi_color =
hi;
3315 bevel.lo_color = lo;
3320 int extra_hilite = 2;
3321 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3322 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3324 if (bevel.top_outline > 1) {
3325 bevel.top_inline += bevel.top_outline - 1;
3328 if (bevel.left_outline > 1) {
3329 bevel.left_inline += bevel.left_outline - 1;
3332 if (bevel.right_outline > 1) {
3333 bevel.right_inline += bevel.right_outline - 1;
3336 if (bevel.bottom_outline > 1) {
3337 bevel.bottom_inline += bevel.bottom_outline - 1;
3341 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3344 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
3347 Warning(
"Bevel",
"Failed to create image");
3356 width = !width ?
fImage->width : width;
3357 height = !height ?
fImage->height : height;
3359 ASImageLayer layers[2];
3360 init_image_layers(&(layers[0]), 2);
3363 layers[0].dst_x = 0;
3364 layers[0].dst_y = 0;
3365 layers[0].clip_width =
fImage->width;
3366 layers[0].clip_height =
fImage->height;
3367 layers[0].bevel =
nullptr;
3369 UInt_t w = width - (bevel.left_outline + bevel.right_outline);
3370 UInt_t h = height - (bevel.top_outline + bevel.bottom_outline);
3371 ASImage *bevel_im = create_asimage(w,
h, 0);
3374 Warning(
"Bevel",
"Failed to create bevel image");
3378 layers[1].im = bevel_im;
3379 fill_asimage(
fgVisual, bevel_im, 0, 0, w,
h, fill);
3381 layers[1].dst_x =
x;
3382 layers[1].dst_y =
y;
3383 layers[1].clip_width = width;
3384 layers[1].clip_height = height;
3385 layers[1].bevel = &bevel;
3386 layers[1].merge_scanlines = alphablend_scanlines;
3390 destroy_asimage(&bevel_im);
3393 Warning(
"Bevel",
"Failed to image");
3413 Warning(
"Pad",
"Visual not initiated");
3418 fImage = create_asimage(100, 100, 0);
3421 Warning(
"Pad",
"Failed to create image");
3428 ARGB32 color = ARGB32_White;
3429 parse_argb_color(col, &color);
3440 Warning(
"Pad",
"Failed to create output image");
3457 Warning(
"Crop",
"Visual not initiated");
3470 height =
y + height >
fImage->height ?
fImage->height -
y : height;
3472 if ((width ==
fImage->width) && (height ==
fImage->height)) {
3473 Warning(
"Crop",
"input size larger than image");
3476 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3477 x,
y, width, height,
nullptr);
3480 Warning(
"Crop",
"Failed to start image decoding");
3484 ASImage *img = create_asimage(width, height, 0);
3488 Warning(
"Crop",
"Failed to create image");
3492 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3496 Warning(
"Crop",
"Failed to start image output");
3497 destroy_asimage(&img);
3498 if (imdec)
delete [] imdec;
3506 for (
UInt_t i = 0; i < height; i++) {
3507 imdec->decode_image_scanline(imdec);
3508 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3511 stop_image_decoding(&imdec);
3512 stop_image_output(&imout);
3536 Warning(
"Append",
"Visual not initiated");
3553 Merge(im,
"alphablend", width, 0);
3554 }
else if (opt ==
"/") {
3556 Merge(im,
"alphablend", 0, height);
3575 Warning(
"BeginPaint",
"Visual not initiated");
3590 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3593 Warning(
"BeginPaint",
"Failed to create image");
3607 Warning(
"EndPaint",
"no image");
3611 if (!
fImage->alt.argb32)
return;
3614 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3617 Warning(
"EndPaint",
"Failed to create image");
3634 Warning(
"GetArgbArray",
"no image");
3639 if (!img)
return nullptr;
3641 if (!img->alt.argb32) {
3651 return (
UInt_t *)img->alt.argb32;
3662 Warning(
"GetRgbaArray",
"no image");
3667 if (!img)
return nullptr;
3669 if (!img->alt.argb32) {
3686 for (i = 0; i < img->height; i++) {
3687 for (j = 0; j < img->width; j++) {
3689 argb = img->alt.argb32[idx];
3691 rgb = argb & 0x00ffffff;
3692 rgba = (rgb << 8) +
a;
3707 Warning(
"GetScanline",
"no image");
3712 CARD32 *
ret =
new CARD32[img->width];
3714 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3715 0,
y, img->width, 1,
nullptr);
3719 Warning(
"GetScanline",
"Failed to start image decoding");
3727 imdec->decode_image_scanline(imdec);
3728 memcpy(imdec->buffer.buffer,
ret, img->width*
sizeof(CARD32));
3729 stop_image_decoding(&imdec);
3744#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3745#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3746 "movl %1,%%edi \n" \
3747 "movl %2,%%ecx \n" \
3752 :"g" (val), "g" (dst), "g" (lng) \
3753 :"eax","edi","ecx" \
3757 #define _MEMSET_(dst, lng, val) do {\
3758 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3762#define FillSpansInternal(npt, ppt, widths, color) do {\
3763 UInt_t yy = ppt[0].fY*fImage->width;\
3764 for (UInt_t i = 0; i < npt; i++) {\
3765 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3766 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3777 if (!
InitImage(
"FillRectangleInternal")) {
3781 ARGB32 color = (ARGB32)col;
3783 if (width == 0) width = 1;
3784 if (height == 0) height = 1;
3795 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3801 height =
y + height >
fImage->height ?
fImage->height -
y : height;
3803 if (!
fImage->alt.argb32) {
3808 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3810 for (
UInt_t i = 0; i < height; i++) {
3815 for (
UInt_t i =
y; i <
y + height; i++) {
3840 Warning(
"FillRectangle",
"Visual not initiated");
3844 ARGB32 color = ARGB32_White;
3847 parse_argb_color(col, &color);
3851 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
3869 ARGB32 color = (ARGB32)col;
3872 if (!thick) thick = 1;
3880 thick += (
x - half);
3888 int yy = y1*
fImage->width;
3890 for (
UInt_t w = 0; w < thick; w++) {
3891 if (
x + w < fImage->width) {
3908 ARGB32 color = (ARGB32)col;
3911 if (!thick) thick = 1;
3919 thick += (
y - half);
3928 for (
UInt_t w = 0; w < thick; w++) {
3930 if (
y + w < fImage->height) {
3942 const char *col,
UInt_t thick)
3944 ARGB32 color = ARGB32_White;
3945 parse_argb_color(col, &color);
3957 int x,
y, xend, yend;
3967 ARGB32 color = (ARGB32)col;
3972 if (!dx && !dy)
return;
3976 y2 > y1 ? y2 : y1, color, thick);
3982 x2 > x1 ? x2 : x1, color, thick);
3994 i2 = i1 - (dx << 1);
4011 q = (y2 - y1) * ydir;
4044 i2 = i1 - (dy << 1);
4061 q = (x2 - x1) * xdir;
4099 const char *col,
UInt_t thick)
4102 Warning(
"DrawRectangle",
"Visual not initiated");
4109 fImage = create_asimage(w,
h, 0);
4114 if (!
fImage->alt.argb32) {
4118 if (!
fImage->alt.argb32) {
4119 Warning(
"DrawRectangle",
"Failed to get argb32 pixel array");
4123 ARGB32 color = ARGB32_White;
4124 parse_argb_color(col, &color);
4144 ARGB32 color = ARGB32_White;
4149 fImage = create_asimage(w,
h, 0);
4155 parse_argb_color(col, &color);
4161 parse_argb_color(col, &color);
4195 ARGB32 color = (ARGB32)col;
4205 thick += (
y - half);
4208 thick = thick <= 0 ? 1 : thick;
4216 x1 = x2 < x1 ? x2 : x1;
4217 x2 = x2 < tmp ? tmp : x2;
4220 for (
UInt_t w = 0; w < thick; w++) {
4221 if (
y + w < fImage->height) {
4229 if (i >= pDash[iDash]) {
4233 if (iDash >= nDash) {
4252 ARGB32 color = (ARGB32)col;
4262 thick += (
x - half);
4265 thick = thick <= 0 ? 1 : thick;
4272 y1 = y2 < y1 ? y2 : y1;
4273 y2 = y2 < tmp ? tmp : y2;
4277 int yy = y1*
fImage->width;
4279 for (
UInt_t w = 0; w < thick; w++) {
4280 if (
x + w < fImage->width) {
4288 if (i >= pDash[iDash]) {
4292 if (iDash >= nDash) {
4311 int x,
y, xend, yend;
4321 char *pDash =
new char[nDash];
4326 for (i = 0; i < (
int)nDash; i++) {
4332 i2 = i1 - (dx << 1);
4350 q = (y2 - y1) * ydir;
4355 if ((iDash%2) == 0) {
4367 if (i >= pDash[iDash]) {
4371 if (iDash >= nDash) {
4379 if ((iDash%2) == 0) {
4391 if (i >= pDash[iDash]) {
4395 if (iDash >= nDash) {
4404 for (i = 0; i < (
int)nDash; i++) {
4410 i2 = i1 - (dy << 1);
4428 q = (x2 - x1) * xdir;
4433 if ((iDash%2) == 0) {
4447 if (i >= pDash[iDash]) {
4451 if (iDash >= nDash) {
4459 if ((iDash%2) == 0) {
4473 if (i >= pDash[iDash]) {
4477 if (iDash >= nDash) {
4498 double x,
y, xend=0, yend=0, x0, y0;
4506 double *xDash =
new double[nDash];
4507 double *yDash =
new double[nDash];
4512 for (i = 0; i < (
int)nDash; i++) {
4513 xDash[i] = tDash[i] * ac;
4514 yDash[i] = tDash[i] * as;
4518 xDash[i] = xDash[i]/2;
4519 yDash[i] = yDash[i]/2;
4521 xDash[i] = xDash[i]*2;
4522 yDash[i] = yDash[i]*2;
4539 q = (y2 - y1) * ydir;
4546 while ((
x < xend) && (
y < yend)) {
4550 if ((iDash%2) == 0) {
4560 if (iDash >= nDash) {
4565 while ((
x < xend) && (
y > yend)) {
4569 if ((iDash%2) == 0) {
4579 if (iDash >= nDash) {
4598 q = (x2 - x1) * xdir;
4605 while ((
x < xend) && (
y < yend)) {
4609 if ((iDash%2) == 0) {
4619 if (iDash >= nDash) {
4624 while ((
x > xend) && (
y < yend)) {
4628 if ((iDash%2) == 0) {
4638 if (iDash >= nDash) {
4652 const char *pDash,
const char *col,
UInt_t thick)
4659 if ((nDash < 2) || !pDash || (nDash%2)) {
4660 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4664 ARGB32 color = ARGB32_White;
4665 parse_argb_color(col, &color);
4669 }
else if (y1 == y2) {
4683 ARGB32 color = ARGB32_White;
4684 parse_argb_color(col, &color);
4691 for (
UInt_t i = 1; i < nn; i++) {
4712 parse_argb_color(col, &color);
4714 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4715 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4732 Warning(
"PolyPoint",
"No points specified");
4739 parse_argb_color(col, &color);
4745 for (i = 0; i < npt; i++) {
4746 ipt[i].
fX += ppt[i].
fX;
4747 ipt[i].
fY += ppt[i].
fY;
4752 for (i = 0; i < npt; i++) {
4753 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4754 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4756 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4772 if (!nseg || !seg) {
4773 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4779 for (
UInt_t i = 0; i < nseg; i++) {
4780 pt[0].fX = seg->
fX1;
4781 pt[1].fX = seg->
fX2;
4782 pt[0].fY = seg->
fY1;
4783 pt[1].fY = seg->
fY2;
4800 if (!npt || !ppt || !widths || (stipple && (!w || !
h))) {
4801 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4802 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple, w,
h);
4807 parse_argb_color(col, &color);
4812 for (
UInt_t i = 0; i < npt; i++) {
4814 for (
UInt_t j = 0; j < widths[i]; j++) {
4815 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4826 if (stipple[ii >> 3] & (1 << (ii%8))) {
4843 if (!npt || !ppt || !widths || !tile) {
4844 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4845 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4857 for (
UInt_t i = 0; i < npt; i++) {
4860 for (
UInt_t j = 0; j < widths[i]; j++) {
4861 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4882 if (!npt || !ppt || !widths) {
4883 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4888 int y1 = ppt[npt-1].
fY;
4896 for (
y = 0; (
int)
y < y0;
y++) {
4899 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4904 for (i = 0; i < npt; i++) {
4905 for (
x = 0; (
int)
x < ppt[i].
fX;
x++) {
4907 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4909 for (
x = ppt[i].fX + widths[i] + 1;
x <
fImage->width;
x++) {
4911 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4919 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4953 Warning(
"CopyArea",
"Visual not initiated");
4958 Warning(
"CopyArea",
"no image");
4963 ASImage *out = ((
TASImage*)dst)->GetImage();
4969 xsrc = xsrc < 0 ? 0 : xsrc;
4970 ysrc = ysrc < 0 ? 0 : ysrc;
4972 if ((xsrc >= (
int)
fImage->width) || (ysrc >= (
int)
fImage->height))
return;
4974 w = xsrc + w >
fImage->width ?
fImage->width - xsrc : w;
4978 if (!
fImage->alt.argb32) {
4981 if (!out->alt.argb32) {
4983 out = ((
TASImage*)dst)->GetImage();
4986 if (
fImage->alt.argb32 && out->alt.argb32) {
4987 for (
y = 0;
y < (
int)
h;
y++) {
4988 for (
x = 0;
x < (
int)w;
x++) {
4989 idx =
Idx(yy +
x + xsrc);
4990 if ((
x + xdst < 0) || (ydst +
y < 0) ||
4991 (
x + xdst >= (
int)out->width) || (
y + ydst >= (
int)out->height) )
continue;
4993 idx2 =
Idx((ydst +
y)*out->width +
x + xdst);
4997 out->alt.argb32[idx2] = 0;
5000 out->alt.argb32[idx2] &=
fImage->alt.argb32[idx];
5003 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] & (~out->alt.argb32[idx2]);
5006 out->alt.argb32[idx2] &=
~fImage->alt.argb32[idx];
5011 out->alt.argb32[idx2] ^=
fImage->alt.argb32[idx];
5014 out->alt.argb32[idx2] |=
fImage->alt.argb32[idx];
5017 out->alt.argb32[idx2] = (
~fImage->alt.argb32[idx]) & (~out->alt.argb32[idx2]);
5020 out->alt.argb32[idx2] ^=
~fImage->alt.argb32[idx];
5023 out->alt.argb32[idx2] = ~out->alt.argb32[idx2];
5026 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] | (~out->alt.argb32[idx2]);
5029 out->alt.argb32[idx2] =
~fImage->alt.argb32[idx];
5032 out->alt.argb32[idx2] |=
~fImage->alt.argb32[idx];
5035 out->alt.argb32[idx2] = (
~fImage->alt.argb32[idx]) | (~out->alt.argb32[idx2]);
5038 out->alt.argb32[idx2] = 0xFFFFFFFF;
5042 out->alt.argb32[idx2] =
fImage->alt.argb32[idx];
5066 int i, j, ix, iy, w,
h;
5068 ARGB32 color = 0xFFFFFFFF;
5075 for (i = 0; i < nx; i++) {
5077 for (j = 0; j < ny; j++) {
5078 icol = (ARGB32)ic[i + (nx*j)];
5079 if (icol != color) {
5133 return (ptMin - ptsStart);
5149 int mr = 0, m1r = 0;
5150 int incr1l = 0, incr2l = 0;
5151 int incr1r = 0, incr2r = 0;
5156 int nextleft, nextright;
5159 TPoint *firstPoint =
nullptr;
5160 UInt_t *firstWidth =
nullptr;
5172 if ((npt < 3) || !ppt) {
5173 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%zx", npt, (
size_t)ppt);
5182 if ((npt < 3) || (dy < 0))
return kFALSE;
5184 ptsOut = firstPoint =
new TPoint[dy];
5185 width = firstWidth =
new UInt_t[dy];
5188 nextleft = nextright = imin;
5189 y = ppt[nextleft].
fY;
5194 if (ppt[nextleft].fY ==
y) {
5200 if (nextleft >= (
int)npt) {
5207 ppt[left].fX, ppt[nextleft].fX,
5208 xl, dl, ml, m1l, incr1l, incr2l);
5212 if (ppt[nextright].fY ==
y) {
5218 if (nextright < 0) {
5225 ppt[right].fX, ppt[nextright].fX,
5226 xr, dr, mr, m1r, incr1r, incr2r);
5231 i =
TMath::Min(ppt[nextleft].fY, ppt[nextright].fY) -
y;
5235 delete [] firstWidth;
5236 delete [] firstPoint;
5245 *(width++) = xr - xl;
5246 (ptsOut++)->fX = xl;
5248 *(width++) = xl - xr;
5249 (ptsOut++)->fX = xr;
5257 }
while (
y !=
ymax);
5259 *nspans =
UInt_t(ptsOut - firstPoint);
5260 *outPoint = firstPoint;
5261 *outWidth = firstWidth;
5274 TPoint *firstPoint =
nullptr;
5275 UInt_t *firstWidth =
nullptr;
5278 ARGB32 color = ARGB32_White;
5279 parse_argb_color(col, &color);
5282 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5285 FillSpans(nspans, firstPoint, firstWidth, col, stipple, w,
h);
5289 delete [] firstWidth;
5290 delete [] firstPoint;
5293 if (firstWidth)
delete [] firstWidth;
5294 if (firstPoint)
delete [] firstPoint;
5305 TPoint *firstPoint =
nullptr;
5306 UInt_t *firstWidth =
nullptr;
5311 FillSpans(nspans, firstPoint, firstWidth, tile);
5314 delete [] firstWidth;
5315 delete [] firstPoint;
5318 if (firstWidth)
delete [] firstWidth;
5319 if (firstPoint)
delete [] firstPoint;
5329 TPoint *firstPoint =
nullptr;
5330 UInt_t *firstWidth =
nullptr;
5335 CropSpans(nspans, firstPoint, firstWidth);
5338 delete [] firstWidth;
5339 delete [] firstPoint;
5342 if (firstWidth)
delete [] firstWidth;
5343 if (firstPoint)
delete [] firstPoint;
5359 if ((count < 3) || !ptsIn) {
5360 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5369 ARGB32 color = ARGB32_White;
5370 parse_argb_color(col, &color);
5388 static const UInt_t gEdgeTableEntryCacheSize = 200;
5389 static EdgeTableEntry gEdgeTableEntryCache[gEdgeTableEntryCacheSize];
5391 if (count < gEdgeTableEntryCacheSize) {
5402 ptsOut = firstPoint;
5424 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5427 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w,
h);
5429 ptsOut = firstPoint;
5440 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5443 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w,
h);
5447 if (del)
delete [] pETEs;
5460 if ((count < 3) || !ptsIn) {
5461 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5490 ptsOut = firstPoint;
5512 FillSpans(nPts, firstPoint, firstWidth, tile);
5513 ptsOut = firstPoint;
5522 FillSpans(nPts, firstPoint, firstWidth, tile);
5533 ASDrawContext *ctx =
new ASDrawContext;
5535 ctx->canvas_width = im->width;
5536 ctx->canvas_height = im->height;
5537 ctx->canvas = im->alt.argb32;
5538 ctx->scratch_canvas =
nullptr;
5540 ctx->flags = ASDrawCTX_CanvasIsARGB;
5541 asim_set_custom_brush_colored( ctx, brush);
5551 if (ctx->scratch_canvas)
free(ctx->scratch_canvas);
5568 Int_t sz = thick*thick;
5575 matrix =
new CARD32[sz];
5578 for (
int i = 0; i < sz; i++) {
5579 matrix[i] = (CARD32)color;
5583 brush.matrix = matrix;
5584 brush.width = thick;
5585 brush.height = thick;
5586 brush.center_y = brush.center_x = thick/2;
5595 if (xx1 ==
fImage->width) --xx1;
5596 if (yy1 ==
fImage->height) --yy1;
5597 if (xx2 ==
fImage->width) --xx2;
5598 if (yy2 ==
fImage->height) --yy2;
5600 asim_move_to(ctx, xx1, yy1);
5601 asim_line_to(ctx, xx2, yy2);
5615 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
5617 FT_Bitmap *source = (FT_Bitmap *) bitmap;
5619 auto ndots = source->width * source->rows;
5624 for (
UInt_t y = 0;
y < source->rows;
y++) {
5626 if ((byy >= (
Int_t)
fImage->height) || (byy < 0))
continue;
5628 for (
UInt_t x = 0;
x < source->width;
x++) {
5630 if ((bxx >= (
Int_t)
fImage->width) || (bxx < 0))
continue;
5632 auto idx =
Idx(bxx + yy);
5633 r += ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
5634 g += ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
5635 b += (
fImage->alt.argb32[idx] & 0x0000ff);
5645 col[0] = (
r << 16) + (
g << 8) +
b;
5647 Int_t col4r = (col[4] & 0xff0000) >> 16;
5648 Int_t col4g = (col[4] & 0x00ff00) >> 8;
5649 Int_t col4b = (col[4] & 0x0000ff);
5654 Int_t colxr = (col4r*
x +
r*xx) >> 2;
5655 Int_t colxg = (col4g*
x +
g*xx) >> 2;
5656 Int_t colxb = (col4b*
x +
b*xx) >> 2;
5657 col[
x] = (colxr << 16) + (colxg << 8) + colxb;
5660 Int_t clipx1 = 0, clipx2 = 0, clipy1 = 0, clipy2 = 0;
5675 for (
UInt_t y = 0;
y < source->rows;
y++) {
5678 for (
UInt_t x = 0;
x < source->width;
x++) {
5682 d = ((
d + 10) * 5) >> 8;
5686 if (noClip || ((bxx < clipx2) && (bxx >= clipx1) &&
5687 (byy >= clipy2) && (byy < clipy1))) {
5688 auto idx =
Idx(bxx + yy);
5689 auto acolor = (ARGB32) col[
d];
5693 fImage->alt.argb32[idx] = acolor;
5736 const wchar_t *wcsTitle =
reinterpret_cast<const wchar_t *
>(
text->GetWcsTitle());
5747 col =
gROOT->GetColor(1);
5750 ARGB32 color = ARGB32_White;
5804 if (align == 1 || align == 2 || align == 3) {
5806 }
else if (align == 4 || align == 5 || align == 6) {
5813 if (align == 3 || align == 6 || align == 9) {
5815 }
else if (align == 2 || align == 5 || align == 8) {
5822 ftal.x = (ftal.x >> 6);
5823 ftal.y = (ftal.y >> 6);
5827 Int_t bx =
x - ftal.x + bitmap->left;
5828 Int_t by =
y + ftal.y - bitmap->top;
5830 DrawFTGlyph(&bitmap->bitmap, color, bx, by, pad, offx, offy);
5859 Int_t bx =
x + bitmap->left;
5860 Int_t by =
y +
h - bitmap->top;
5873 static ASImageExportParams params;
5881 ret = ASImage2xpmRawBuff(img, (CARD8 **)buffer,
size,
nullptr);
5884 ret = ASImage2PNGBuff(img, (CARD8 **)buffer,
size, ¶ms);
5928 static ASImageImportParams params;
5932 params.filter = SCL_DO_ALL;
5933 params.gamma = SCREEN_GAMMA;
5934 params.gamma_table =
nullptr;
5935 params.compression = 0;
5936 params.format = ASA_ASImage;
5937 params.search_path =
nullptr;
5938 params.subimage = 0;
5943 char *ptr = buffer[0];
5944 while (isspace((
int)*ptr)) ++ptr;
5946 fImage = xpm_data2ASImage((
const char**)buffer, ¶ms);
5948 fImage = xpmRawBuff2ASImage((
const char*)*buffer, ¶ms);
5953 fImage = PNGBuff2ASimage((CARD8 *)*buffer, ¶ms);
5963 if (
fName.IsNull()) {
5979 Warning(
"CreateThumbnail",
"No image");
5984 Warning(
"CreateThumbnail",
"Visual not initiated");
5988 static char *buf =
nullptr;
5990 ASImage *img =
nullptr;
6010 ASImage *rendered_im;
6011 ASImageLayer layers[2];
6012 init_image_layers(&(layers[0]), 2);
6014 layers[0].dst_x = 0;
6015 layers[0].dst_y = 0;
6016 layers[0].clip_width = img->width;
6017 layers[0].clip_height = img->height;
6018 layers[0].bevel =
nullptr;
6020 layers[1].dst_x = 0;
6021 layers[1].dst_y = 0;
6022 layers[1].clip_width = img->width;
6023 layers[1].clip_height = img->height;
6024 layers[1].merge_scanlines = blend_scanlines_name2func(
"tint");
6025 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, img->width, img->height,
6027 destroy_asimage(&img);
6031 ASImage *padimg =
nullptr;
6036 padimg = pad_asimage(
fgVisual, img, 0,
d, sz, sz, 0x00ffffff,
6040 padimg = pad_asimage(
fgVisual, img,
d, 0, sz, sz, 0x00ffffff,
6045 destroy_asimage(&img);
6050 ASImage2xpmRawBuff(padimg, (CARD8 **)ptr, &
size,
nullptr);
6053 destroy_asimage(&padimg);
6066 if (
b.IsReading()) {
6067 Version_t version =
b.ReadVersion(&R__s, &R__c);
6072 if ( version == 1 ) {
6073 Int_t fileVersion =
b.GetVersionOwner();
6074 if (fileVersion > 0 && fileVersion < 50000 ) {
6082 if ( fileVersion < 40200 ) {
6101 if (image_type != 0) {
6103 char *buffer =
new char[
size];
6104 b.ReadFastArray(buffer,
size);
6124 if (
fName.IsNull()) {
6129 image_type =
fImage->alt.vector ? 0 : 1;
6132 if (image_type != 0) {
6133 char *buffer =
nullptr;
6136 b.WriteFastArray(buffer,
size);
6144 b.SetByteCount(R__c,
kTRUE);
6153 if (
fImage->alt.vector) {
6192 int stop =
fTitle.Index(
"*/") - 1;
6208 Int_t sz = thick*thick;
6212 ARGB32 color = ARGB32_White;
6213 parse_argb_color(col, &color);
6218 matrix =
new CARD32[sz];
6221 for (
int i = 0; i < sz; i++) {
6222 matrix[i] = (CARD32)color;
6226 brush.matrix = matrix;
6227 brush.width = thick;
6228 brush.height = thick;
6229 brush.center_y = brush.center_x = thick/2;
6232 asim_cube_bezier(ctx, x1, y1, x2, y2, x3, y3);
6245 const char *col,
Int_t thick)
6250 thick = !thick ? 1 : thick;
6251 Int_t sz = thick*thick;
6255 ARGB32 color = ARGB32_White;
6256 parse_argb_color(col, &color);
6261 matrix =
new CARD32[sz];
6264 for (
int i = 0; i < sz; i++) {
6265 matrix[i] = (CARD32)color;
6269 brush.matrix = matrix;
6270 brush.width = thick > 0 ? thick : 1;
6271 brush.height = thick > 0 ? thick : 1;
6272 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6275 asim_straight_ellips(ctx,
x,
y, rx, ry, thick < 0);
6293 thick = !thick ? 1 : thick;
6294 Int_t sz = thick*thick;
6298 ARGB32 color = ARGB32_White;
6299 parse_argb_color(col, &color);
6305 matrix =
new CARD32[sz];
6308 for (
int i = 0; i < sz; i++) {
6309 matrix[i] = (CARD32)color;
6313 brush.matrix = matrix;
6314 brush.height = brush.width = thick > 0 ? thick : 1;
6315 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6318 asim_circle(ctx,
x,
y,
r, thick < 0);
6332 const char *col,
Int_t thick)
6337 thick = !thick ? 1 : thick;
6338 Int_t sz = thick*thick;
6342 ARGB32 color = ARGB32_White;
6343 parse_argb_color(col, &color);
6348 matrix =
new CARD32[sz];
6351 for (
int i = 0; i < sz; i++) {
6352 matrix[i] = (CARD32)color;
6356 brush.matrix = matrix;
6357 brush.width = thick > 0 ? thick : 1;
6358 brush.height = thick > 0 ? thick : 1;
6359 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6362 asim_ellips(ctx,
x,
y, rx, ry, angle, thick < 0);
6375 const char *col,
Int_t thick)
6380 thick = !thick ? 1 : thick;
6381 Int_t sz = thick*thick;
6385 ARGB32 color = ARGB32_White;
6386 parse_argb_color(col, &color);
6391 matrix =
new CARD32[sz];
6394 for (
int i = 0; i < sz; i++) {
6395 matrix[i] = (CARD32)color;
6399 brush.matrix = matrix;
6400 brush.width = thick > 0 ? thick : 1;
6401 brush.height = thick > 0 ? thick : 1;
6402 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6405 asim_ellips2(ctx,
x,
y, rx, ry, angle, thick < 0);
6417 const char * ,
const char * )
6431 Warning(
"Gray",
"Image not initiated");
6436 Warning(
"Gray",
"Visual not initiated");
6443 ASImage *sav =
nullptr;
6460 if (
fImage->alt.argb32) {
6462 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
6464 for (i = 0; i <
fImage->height; i++) {
6465 for (j = 0; j <
fImage->width; j++) {
6468 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6469 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6470 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6471 l = (57*
r + 181*
g + 18*
b)/256;
6479 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
6491 Warning(
"ToGray",
"Failed to start image output");
6497 CARD32 *aa = imdec->buffer.alpha;
6498 CARD32 *rr = imdec->buffer.red;
6499 CARD32 *gg = imdec->buffer.green;
6500 CARD32 *bb = imdec->buffer.blue;
6505 for (i = 0; i <
fImage->height; i++) {
6506 imdec->decode_image_scanline(imdec);
6507 result.flags = imdec->buffer.flags;
6508 result.back_color = imdec->buffer.back_color;
6510 for (j = 0; j <
fImage->width; j++) {
6511 l = (57*rr[j] + 181*gg[j]+ 18*bb[j])/256;
6512 result.alpha[j] = aa[j];
6514 result.green[j] =
l;
6517 imout->output_image_scanline(imout, &result, 1);
6520 stop_image_decoding(&imdec);
6521 stop_image_output(&imout);
6561 Warning(
"FromWindow",
"Visual not initiated");
6568 static int x11 = -1;
6569 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
6574 unsigned char *bits =
gVirtualX->GetColorBits(wid, 0, 0, w,
h);
6579 fImage = bitmap2asimage(bits, w,
h, 0,
nullptr);
6593 for (
UInt_t i = 0; i <
h/2; ++i) {
6594 memcpy(xx, buf + 4*w*i, 4*w);
6595 memcpy(buf + 4*w*i, buf + 4*w*(
h-i-1), 4*w);
6596 memcpy(buf + 4*w*(
h-i-1), xx, 4*w);
6600 fImage = bitmap2asimage(buf, w,
h, 0,
nullptr);
6613 if (!
fImage->alt.vector && on) {
6624 gPad->Range(-left / (1.0 - left - right),
6625 -bottom / (1.0 - top - bottom),
6626 1 + right / (1.0 - left - right),
6627 1 + top / ( 1.0 - top - bottom));
6628 gPad->RangeAxis(0, 0, 1, 1);
6638 char *buf =
nullptr;
6644 str.ReplaceAll(
"static",
"const");
6648 str.ReplaceAll(
"asxpm", xpm.
Data());
6649 out <<
"\n" << str <<
"\n\n";
6654 out <<
"asimage = TImage::Create();\n";
6655 out <<
" asimage->SetImageBuffer( (char **)" << xpm <<
", TImage::kXpm);\n";
6657 out <<
" asimage->Draw();\n";
6670 static char buf[32];
6671 FILE *fp = fopen(
name,
"rb+");
6674 printf(
"file %s : failed to open\n",
name);
6678 if (!fread(buf, 1, 20, fp)) {
6683 char dpi1 = (
set & 0xffff) >> 8;
6684 char dpi2 =
set & 0xff;
6689 for (i = 0; i < 20; i++) {
6690 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6691 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6697 if (i == 20 || dpi+4 >= 20) {
6699 printf(
"file %s : wrong JPEG format\n",
name);
6706 buf[dpi + 1] = dpi1;
6707 buf[dpi + 2] = dpi2;
6710 buf[dpi + 3] = dpi1;
6711 buf[dpi + 4] = dpi2;
6714 fwrite(buf, 1, 20, fp);
const Mask_t kGCClipXOrigin
@ 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 Pixmap_t
Pixmap handle.
Handle_t Drawable_t
Drawable handle.
Handle_t GContext_t
Graphics context handle.
const Mask_t kGCClipYOrigin
Handle_t Window_t
Window handle.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
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.
struct _EdgeTableEntry EdgeTableEntry
struct _ScanLineListBlock ScanLineListBlock
struct _ScanLineList ScanLineList
#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)
externconst char * gProgName
TVectorT< Double_t > TVectorD
externTVirtualPS * gVirtualPS
externInt_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
static Bool_t fgBatch
global flag to signal if batch mode is active ie fgVisual->dpy was set to nullptr
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.
Bool_t InitImage(const char *caller)
Static function to initialize the image.
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
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.
TObject * Clone(const char *newname="") const override
Clone image.
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...
~TASImage() override
Image destructor, clean up image and visual.
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
void DrawFTGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y, TVirtualPad *clippad=nullptr, Int_t offx=0, Int_t offy=0)
Draw glyph bitmap.
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 DrawTextOnPad(TText *text, Int_t x=0, Int_t y=0, TVirtualPad *pad=nullptr, Int_t offx=0, Int_t offy=0) override
Draw text at the pixel position (x,y) checking clip on pad.
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.
void DestroyScaledImage()
Destroy scaled image.
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
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).
const Double_t * GetArray() const
Array of longs (32 or 64 bits per element).
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
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 SaveImageAttributes(std::ostream &out, const char *name, EImageQuality qualdef=kImgPoor, UInt_t comprdef=0, Bool_t constRatiodef=kTRUE)
Save image attributes as C++ statement(s) on output stream, but not the palette.
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.
static Int_t GetColor(const char *hexcolor)
const char * AsHexString() const
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
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)
THashTable implements a hash table to store TObject's.
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
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.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
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.
TObject()
TObject constructor.
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
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.
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.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Dynamic handle to work with freetype 2 library.
Bool_t SetTextSize(Float_t textsize)
Set current text size.
void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
const FT_BBox & GetBox() const
void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
FT_BitmapGlyph GetGlyphBitmap(UInt_t n, Bool_t smooth=kFALSE)
Return bitmap for specified glyph.
UInt_t GetNumGlyphs() const
void SetTextFont(Font_t fontnumber)
Set specified font.
void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
FT_Matrix * GetRotMatrix() const
Int_t GetNoElements() const
Element * GetMatrixArray()
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
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.
virtual Int_t YtoAbsPixel(Double_t y) const =0
virtual Double_t GetX2() const =0
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual Double_t GetY1() const =0
const char * GetName() const override=0
Returns name of object.
virtual UInt_t GetPadWidth() const =0
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 UInt_t GetPadHeight() const =0
virtual Double_t GetY2() const =0
virtual Int_t UtoPixel(Double_t u) const =0
virtual Int_t GetCanvasID() const =0
virtual TCanvas * GetCanvas() const =0
virtual Double_t GetX1() 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