60#include "RConfigure.h"
98# include "Windows4root.h"
102# define X_DISPLAY_MISSING 1
104# include <afterbase.h>
106# define X_DISPLAY_MISSING 1
107# include <afterbase.h>
109# include <afterimage.h>
123static char *
gIconPaths[7] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
130#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER
131#pragma GCC diagnostic ignored "-Wstrict-aliasing"
152#define _alphaBlend(bot, top) {\
153 __argb32__ *T = (__argb32__*)(top);\
154 __argb32__ *B = (__argb32__*)(bot);\
159 B->a = ((B->a*aa)>>8) + T->a;\
160 B->r = (B->r*aa + T->r*T->a)>>8;\
161 B->g = (B->g*aa + T->g*T->a)>>8;\
162 B->b = (B->b*aa + T->b*T->a)>>8;\
178 fVisual = create_asvisual(
nullptr, 0, 0,
nullptr);
187 fFontManager = create_font_manager(
nullptr,
nullptr,
nullptr);
262 static bool fgInit =
false;
284 fImage = create_asimage(
w ?
w : 20,
h ?
h : 20, 0);
355 if (
this != &img && img.
IsValid()) {
395 fImage->alt.argb32 = (ARGB32*)safemalloc(
size);
432 const char *delim =
":";
434 const char *delim =
";";
436 while (icon_path.
Tokenize(token, from, delim) && cnt < 6) {
452 FILE *fp = fopen(file,
"rb");
453 const char *ret =
"";
455 if (!fp)
return nullptr;
457 if (!fread(&magic, 1, 1, fp)) {
465 if (!fread(&magic, 1, 1, fp)) {
469 if (!fread(&magic, 1, 1, fp)) {
474 ret = (magic == 1) ?
"ico" :
"cur";
479 if (!fread(&magic, 1, 1, fp)) {
486 else if (magic == 0x50)
549 set_output_threshold(0);
551 static ASImageImportParams iparams;
555 iparams.filter = SCL_DO_ALL;
556 iparams.gamma = SCREEN_GAMMA;
557 iparams.gamma_table = NULL;
559 iparams.format = ASA_ASImage;
561 iparams.subimage = 0;
562 iparams.return_animation_delay = -1;
568 ASImage *image =
nullptr;
579 iparams.subimage = ext.
Atoi();
581 ext = strrchr(fname.
Data(),
'.') + 1;
584 image = file2ASImage_extra(fname.
Data(), &iparams);
596 unsigned char *
bitmap =
nullptr;
602 if (!handler || ((handler->
LoadPlugin() == -1))) {
621 image = bitmap2asimage(
bitmap,
w,
h, 0,
nullptr);
700 Error(
"WriteImage",
"no image in memory. Draw something first");
704 if (!file || !*file) {
705 Error(
"WriteImage",
"no file name specified");
710 if ((s = strrchr(file,
'.'))) {
714 Error(
"WriteImage",
"cannot determine a valid file type");
722 Error(
"WriteImage",
"not a valid file type was specified");
728 ASImageFileTypes atype = (ASImageFileTypes)mytype;
736 static ASImageExportParams parms;
741 parms.xpm.type = atype;
742 parms.xpm.flags = EXPORT_ALPHA;
743 parms.xpm.dither = 4;
744 parms.xpm.opaque_threshold = 127;
745 parms.xpm.max_colors = 512;
748 ASImage2bmp(im, fname.
Data(),
nullptr);
751 ASImage2xcf(im, fname.
Data(),
nullptr);
754 parms.png.type = atype;
755 parms.png.flags = EXPORT_ALPHA;
759 parms.jpeg.type = atype;
760 parms.jpeg.flags = 0;
761 parms.jpeg.quality = aquality;
764 parms.gif.type = atype;
765 parms.gif.flags = EXPORT_ALPHA;
766 parms.gif.dither = 0;
767 parms.gif.opaque_threshold = 0;
771 parms.gif.type = atype;
772 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
773 parms.gif.dither = 0;
774 parms.gif.opaque_threshold = 0;
775 parms.gif.animate_repeats = 0;
788 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
789 parms.gif.animate_repeats = 0;
790 }
else if(sufix==
"") {
807 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
808 parms.gif.animate_repeats = atoi(s);
817 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
818 parms.gif.animate_repeats = 0;
819 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
825 delay = atoi(sDelay);
826 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
827 parms.gif.animate_repeats = atoi(sRepeats);
829 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
833 parms.gif.animate_delay = delay;
835 int i1 = fname.
Index(
"gif+");
837 fname = fname(0, i1 + 3);
840 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
846 parms.tiff.type = atype;
847 parms.tiff.flags = EXPORT_ALPHA;
848 parms.tiff.rows_per_strip = 0;
849 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
850 TIFF_COMPRESSION_NONE;
851 parms.tiff.jpeg_quality = 100;
852 parms.tiff.opaque_threshold = 0;
855 Error(
"WriteImage",
"file type %s not yet supported", s);
859 if (!ASImage2file(im,
nullptr, fname.
Data(), atype, &parms)) {
860 Error(
"WriteImage",
"error writing file %s", file);
878 if (s ==
"jpg" || s ==
"jpeg")
917 astype = ASIT_Xpm;
break;
919 astype = ASIT_ZCompressedXpm;
break;
921 astype = ASIT_GZCompressedXpm;
break;
923 astype = ASIT_Png;
break;
925 astype = ASIT_Jpeg;
break;
927 astype = ASIT_Xcf;
break;
929 astype = ASIT_Ppm;
break;
931 astype = ASIT_Pnm;
break;
933 astype = ASIT_Bmp;
break;
935 astype = ASIT_Ico;
break;
937 astype = ASIT_Cur;
break;
939 astype = ASIT_Gif;
break;
941 astype = ASIT_Gif;
break;
943 astype = ASIT_Tiff;
break;
945 astype = ASIT_Xbm;
break;
947 astype = ASIT_Targa;
break;
949 astype = ASIT_XMLScript;
break;
951 astype = ASIT_Unknown;
957 case ASIT_ZCompressedXpm:
959 case ASIT_GZCompressedXpm:
1002 asquality = 25;
break;
1004 asquality = 75;
break;
1006 asquality = 50;
break;
1008 asquality = 100;
break;
1014 if (asquality > 0 && asquality <= 25)
1016 if (asquality > 26 && asquality <= 50)
1018 if (asquality > 51 && asquality <= 75)
1020 if (asquality > 76 && asquality <= 100)
1039 auto vis = gVisualHolder();
1041 Warning(
"SetImage",
"Visual not initiated");
1058 ASVectorPalette asPalette;
1061 for (
Int_t col = 0; col < 4; col++)
1062 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1069 asPalette.points =
new Double_t[asPalette.npoints];
1070 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1074 height, &asPalette, ASA_ASImage,
1077 delete [] asPalette.points;
1078 for (
Int_t col = 0; col < 4; col++)
1079 delete [] asPalette.channels[col];
1123 Error(
"FromPad",
"pad cannot be 0");
1140 if (itmp && itmp->
fImage) {
1149 if (itmp && itmp->
fImage && (itmp !=
this)) {
1151 if (itmp->
fImage->alt.argb32) {
1153 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1154 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1183 Error(
"Draw",
"no image set");
1211 gPad->Range(-left / (1.0 - left - right),
1212 -bottom / (1.0 - top - bottom),
1213 1 + right / (1.0 - left - right),
1214 1 + top / ( 1.0 - top - bottom));
1215 gPad->RangeAxis(0, 0, 1, 1);
1242 wsrc = wsrc ? wsrc : im->width;
1243 hsrc = hsrc ? hsrc : im->height;
1245 static int x11 =
gVirtualX->InheritsFrom(
"TGX11");
1254 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1258 std::vector<char> bits(ww*hh);
1260 ASImageDecoder *imdec = start_image_decoding(vis, im, SCL_DO_ALPHA,
1261 xsrc, ysrc, ww, 0,
nullptr);
1263 for (
UInt_t yy = 0; yy < hh; yy++) {
1264 imdec->decode_image_scanline(imdec);
1265 CARD32 *
a = imdec->buffer.alpha;
1267 for (
UInt_t xx = 0; xx < ww; xx++) {
1282 stop_image_decoding(&imdec);
1285 bits.data(), ww, hh);
1305 ASImage *img =
nullptr;
1306 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1308 img = tile_asimage(vis, im, xsrc, ysrc, wsrc, hsrc,
1309 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1311 bits = (
unsigned char *)img->alt.argb32;
1320 if (!
option.Contains(
"opaque")) {
1330 destroy_asimage(&img);
1357 xsrc, ysrc, wsrc, hsrc, opt);
1376 Error(
"Paint",
"no image set");
1380 auto vis = gVisualHolder();
1383 Warning(
"Paint",
"Visual not initiated");
1387 Int_t tile_x = 0, tile_y = 0;
1388 CARD32 tile_tint = 0;
1397 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1400 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1403 Error(
"Paint",
"tile option error");
1411 if (!
fImage->alt.vector) {
1427 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1428 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1431 if ((to_w < 25 || to_h < 25) && !expand) {
1432 Error(
"Paint",
"pad too small to display an image");
1444 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1445 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1447 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1448 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1453 ASImage *grad_im =
nullptr;
1461 grad.type = GRADIENT_Top2Bottom;
1462 grad.color =
new ARGB32[grad.npoints];
1463 grad.offset =
new double[grad.npoints];
1466 Int_t oldPt = grad.npoints -
pt -1;
1467 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1468 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1470 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1471 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1474 grad_im = make_gradient(vis, &grad ,
UInt_t(pal_w),
1475 pal_h, SCL_DO_COLOR,
1478 delete [] grad.color;
1479 delete [] grad.offset;
1487 to_w, to_h, tile_tint, ASA_ASImage,
1522 destroy_asimage(&tmpImage);
1537 Error(
"Paint",
"image could not be rendered to display");
1541 int tox = expand ? 0 :
int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1542 int toy = expand ? 0 :
int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1544 auto pp =
gPad->GetPainter();
1554 pp->DrawImage(&pimg, pal_x, pal_y, flags);
1565 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1566 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1567 min, max, ndiv,
"+LU");
1574 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1575 min, max, ndiv,
"+L");
1579 destroy_asimage(&grad_im);
1587 Int_t pxl, pyl, pxt, pyt;
1594 if (px1 < px2) {pxl = px1; pxt = px2;}
1595 else {pxl = px2; pxt = px1;}
1596 if (py1 < py2) {pyl = py1; pyt = py2;}
1597 else {pyl = py2; pyt = py1;}
1599 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1650 auto &parent = *
gPad;
1653 parent.ExecuteEvent(
event, px, py);
1657 parent.SetCursor(
kCross);
1674 inter->PaintBox(parent);
1680 Int_t imgX1 = 0, imgY1 = 0, imgW = 0, imgH = 0;
1685 inter->PerformMove(px, py);
1687 imgX1 = inter->zx1 - parent.XtoAbsPixel(0);
1688 imgY1 = image->height - 1 - inter->
zy1 + parent.YtoAbsPixel(1);
1689 imgW = inter->
zx2 - inter->zx1;
1690 imgH = inter->zy1 - inter->zy2;
1692 parent.FreeInteractive(
this);
1695 if ((imgW >= 5) && (imgH >= 5)) {
1702 imgW = (
Int_t)(imgW / xfact);
1703 imgH = (
Int_t)(imgH / yfact);
1705 Zoom(imgX1, imgY1, imgW + 1, imgH + 1);
1721 static char info[64];
1727 px -=
gPad->XtoAbsPixel(0);
1728 py -=
gPad->YtoAbsPixel(1);
1731 if (px < 0 || py < 0)
return info;
1735 if (px >= (
int)image->width || py >= (
int)image->height)
1738 py = image->height - 1 - py;
1745 if (
fImage->alt.vector) {
1746 snprintf(info,64,
"x: %d y: %d %.5g",
1749 snprintf(info,64,
"x: %d y: %d", px, py);
1764 auto vis = gVisualHolder();
1766 Warning(
"SetPalette",
"Visual not initiated");
1771 Warning(
"SetPalette",
"Image not valid");
1781 ASVectorPalette asPalette;
1783 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1784 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1785 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1786 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1792 asPalette.points =
new double[asPalette.npoints];
1793 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1799 delete [] asPalette.points;
1800 for (
Int_t col = 0; col < 4; col++)
1801 delete [] asPalette.channels[col];
1818 Warning(
"Scale",
"Image not initiated");
1822 auto vis = gVisualHolder();
1824 Warning(
"Scale",
"Visual not initiated");
1832 if (toWidth > 30000)
1834 if (toHeight > 30000)
1837 ASImage *img = scale_asimage(vis,
fImage, toWidth, toHeight,
1854 Warning(
"Slice",
"Image not initiated");
1858 auto vis = gVisualHolder();
1860 Warning(
"Slice",
"Visual not initiated");
1868 if (toWidth > 30000)
1870 if (toHeight > 30000)
1873 ASImage *img = slice_asimage(vis,
fImage, xStart, xEnd,
1874 yStart, yEnd, toWidth, toHeight,
1890 Warning(
"Tile",
"Image not initiated");
1894 auto vis = gVisualHolder();
1896 Warning(
"Tile",
"Visual not initiated");
1904 if (toWidth > 30000)
1906 if (toHeight > 30000)
1909 ASImage *img = tile_asimage(vis,
fImage, 0, 0, toWidth, toHeight, 0,
1931 Warning(
"Zoom",
"Image not valid");
1953 Warning(
"UnZoom",
"Image not valid");
1980 Warning(
"Flip",
"Image not valid");
1983 auto vis = gVisualHolder();
1985 Warning(
"Flip",
"Visual not initiated");
1989 if (
fImage->alt.vector) {
1990 Warning(
"Flip",
"flip does not work for data images");
1994 Int_t rflip = flip/90;
2004 ASImage *img = flip_asimage(vis,
fImage, 0, 0,
w,
h, rflip,
2028 Warning(
"Mirror",
"Image not valid");
2032 auto vis = gVisualHolder();
2034 Warning(
"Mirror",
"Visual not initiated");
2038 if (
fImage->alt.vector) {
2039 Warning(
"Mirror",
"mirror does not work for data images");
2043 ASImage *img = mirror_asimage(vis,
fImage, 0, 0,
2106#ifndef X_DISPLAY_MISSING
2108 return create_asvisual_for_id((Display *)display, screen, depth, XVisualIDFromVisual((
Visual *) visual), (
Colormap)
cmap,
nullptr);
2126 destroy_asvisual(visual, 0);
2135 return (
Pixmap_t)asimage2pixmap(visual, root_window, image,
nullptr,
kTRUE);
2162 asimage2drawable(visual,
wid, image, (GC)
gc, xsrc, ysrc,
x,
y,
width,
height, 1);
2176 return gVisualHolder();
2178 static ASVisual *gVis =
nullptr;
2190 return gVis ? gVis : gVisualHolder();
2197 if (!gVisualHolder()) {
2198 Warning(caller,
"Visual not initiated");
2207 if (!
fImage->alt.argb32) {
2211 if (!
fImage->alt.argb32) {
2212 Warning(caller,
"Failed to get argb32 pixel array");
2224 Warning(
"StartPaletteEditor",
"Image not valid");
2227 if (!
fImage->alt.vector) {
2228 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2249 Warning(
"GetPixmap",
"Visual not initiated");
2263 Error(
"GetPixmap",
"ARGB array is not exists");
2277 auto vis = gVisualHolder();
2279 Warning(
"GetMaskBits",
"Visual not initiated");
2286 Warning(
"GetMaskBits",
"No image");
2291 UInt_t ow = img->width % 8;
2292 width = img->width - ow + (ow ? 8 : 0);
2294 ASImageDecoder *imdec = start_image_decoding(vis, img, SCL_DO_ALPHA,
2295 0, 0,
width, 0,
nullptr);
2303 imdec->decode_image_scanline(imdec);
2304 CARD32 *
a = imdec->buffer.alpha;
2319 stop_image_decoding(&imdec);
2336 std::vector<char> bits;
2338 pixmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), bits.data(), ww, hh);
2353 Warning(
"SetImage",
"Visual not initiated");
2379 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
2384 fImage = bitmap2asimage(bits,
w,
h, 0, mask_bits);
2385 delete [] mask_bits;
2396 Warning(
"GetPixels",
"Wrong Image");
2401 ASImageDecoder *imdec;
2415 if ((
x >= (
int)img->width) || (
y >= (
int)img->height)) {
2419 if ((
int)(
x +
width) > (
int)img->width) {
2423 if ((
int)(
y +
height) > (
int)img->height) {
2427 if ((imdec = start_image_decoding(
nullptr,
fImage, SCL_DO_ALL, 0,
y,
2428 img->width,
height,
nullptr)) ==
nullptr) {
2429 Warning(
"GetPixels",
"Failed to create image decoder");
2438 imdec->decode_image_scanline(imdec);
2441 if ((
r == (
Int_t)imdec->buffer.red[i]) &&
2442 (
g == (
Int_t)imdec->buffer.green[i]) &&
2443 (
b == (
Int_t)imdec->buffer.blue[i])) {
2445 r = (
Int_t)imdec->buffer.red[i];
2446 g = (
Int_t)imdec->buffer.green[i];
2447 b = (
Int_t)imdec->buffer.blue[i];
2454 stop_image_decoding(&imdec);
2466 Warning(
"GetVecArray",
"Bad Image");
2469 if (
fImage->alt.vector) {
2470 return fImage->alt.vector;
2488 Warning(
"GetArray",
"Bad Image");
2494 if (
fImage->alt.vector) {
2499 ASImageDecoder *imdec;
2510 if ((imdec = start_image_decoding(
nullptr, img, SCL_DO_ALL, 0, 0,
2511 img->width, 0,
nullptr)) ==
nullptr) {
2512 Warning(
"GetArray",
"Failed to create image decoder");
2517 CARD32
r = 0,
g = 0,
b = 0;
2521 for (
UInt_t k = 0; k <
h; k++) {
2522 imdec->decode_image_scanline(imdec);
2524 for (
UInt_t i = 0; i <
w; ++i) {
2525 if ((
r == imdec->buffer.red[i]) &&
2526 (
g == imdec->buffer.green[i]) &&
2527 (
b == imdec->buffer.blue[i])) {
2529 r = imdec->buffer.red[i];
2530 g = imdec->buffer.green[i];
2531 b = imdec->buffer.blue[i];
2539 stop_image_decoding(&imdec);
2562 const char *color,
const char *font_name,
2566 ARGB32 text_color = ARGB32_Black;
2567 ASImage *fore_im =
nullptr;
2568 ASImage *text_im =
nullptr;
2578 if (fn.
Last(
'/') == 0)
2579 fn = fn(1, fn.
Length() - 1);
2591 parse_argb_color(color, &text_color);
2599 auto font_manager = gVisualHolder.FontManager();
2600 if (!font_manager) {
2601 Warning(
"DrawText",
"Fail to create font manager");
2605 ASFont *font = fn.
IsNull() ? nullptr : get_asfont(font_manager, fn.
Data(), 0,
size, ASF_GuessWho);
2608 font = get_asfont(font_manager,
"fixed", 0,
size, ASF_GuessWho);
2610 Warning(
"DrawText",
"cannot find a font %s", font_name);
2622 text_im = draw_text(
text, font, (ASText3DType)
type, 0);
2627 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2629 if ((tmp->width !=
width) || (tmp->height !=
height)) {
2630 fore_im = tile_asimage(gVisualHolder(), tmp, 0, 0,
width,
height, 0,
2633 destroy_asimage(&tmp);
2640 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2641 destroy_asimage(&text_im);
2649 ASImage *rendered_im;
2650 ASImageLayer layers[2];
2652 init_image_layers(&(layers[0]), 2);
2653 fore_im->back_color = text_color;
2654 layers[0].im = rimg;
2655 layers[0].dst_x = 0;
2656 layers[0].dst_y = 0;
2657 layers[0].clip_width = rimg->width;
2658 layers[0].clip_height = rimg->height;
2659 layers[0].bevel =
nullptr;
2660 layers[1].im = fore_im;
2661 layers[1].dst_x =
x;
2662 layers[1].dst_y =
y;
2663 layers[1].clip_width = fore_im->width;
2664 layers[1].clip_height = fore_im->height;
2666 rendered_im = merge_layers(gVisualHolder(), &(layers[0]), 2, rimg->width, rimg->height,
2669 destroy_asimage(&fore_im);
2699 auto asimg =
dynamic_cast<const TASImage *
>(im);
2703 auto vis = gVisualHolder();
2705 Warning(
"Merge",
"Visual not initiated");
2709 ASImageLayer layers[2];
2711 init_image_layers(&(layers[0]), 2);
2713 layers[0].dst_x = 0;
2714 layers[0].dst_y = 0;
2715 layers[0].clip_width =
fImage->width;
2716 layers[0].clip_height =
fImage->height;
2717 layers[0].bevel =
nullptr;
2718 layers[1].im = asimg->fImage;
2719 layers[1].dst_x =
x;
2720 layers[1].dst_y =
y;
2721 layers[1].clip_width = asimg->GetWidth();
2722 layers[1].clip_height = asimg->GetHeight();
2723 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2725 ASImage *rendered_im = merge_layers(vis, &(layers[0]), 2,
fImage->width,
fImage->height,
2740 auto vis = gVisualHolder();
2742 Warning(
"Blur",
"Visual not initiated");
2747 fImage = create_asimage(100, 100, 0);
2750 Warning(
"Blur",
"Failed to create image");
2757 ASImage *rendered_im = blur_asimage_gauss(vis,
fImage, hr > 0 ? hr : 3,
2758 vr > 0 ? vr : 3, SCL_DO_ALL,
2772 newimg->SetName(newname);
2773 newimg->CloneImageData(*
this);
2774 newimg->fEditable =
kFALSE;
2791 auto vis = gVisualHolder();
2793 Warning(
"Vectorize",
"Visual not initiated");
2798 fImage = create_asimage(100, 100, 0);
2801 Warning(
"Vectorize",
"Failed to create image");
2811 dither = dither > 7 ? 7 : dither;
2813 int *res = colormap_asimage(
fImage, &
cmap, max_colors, dither, opaque_threshold);
2825 g = INDEX_SHIFT_GREEN(
cmap.entries[res[i]].green);
2826 b = INDEX_SHIFT_BLUE(
cmap.entries[res[i]].blue);
2827 r = INDEX_SHIFT_RED(
cmap.entries[res[i]].red);
2829 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2840 g = INDEX_SHIFT_GREEN(
cmap.entries[j].green);
2841 b = INDEX_SHIFT_BLUE(
cmap.entries[j].blue);
2842 r = INDEX_SHIFT_RED(
cmap.entries[j].red);
2843 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2845 v = (
v>>12) & 0x0FFF;
2857 fImage->alt.vector = vec;
2906 auto vis = gVisualHolder();
2908 Warning(
"HSV",
"Visual not initiated");
2916 Warning(
"HSV",
"Failed to create image");
2928 ASImage *rendered_im =
nullptr;
2932 hue, radius, H, S, V, ASA_ASImage, 100,
2933 ASIMAGE_QUALITY_TOP);
2936 Warning(
"HSV",
"Failed to create rendered image");
2974 auto vis = gVisualHolder();
2976 Warning(
"Gradient",
"Visual not initiated");
2980 ASImage *rendered_im =
nullptr;
2981 ASGradient gradient;
2983 int reverse = 0, npoints1 = 0, npoints2 = 0;
2990 if ((
angle > 2 * 180 * 15 / 16) || (
angle < 2 * 180 * 1 / 16)) {
2991 gradient.type = GRADIENT_Left2Right;
2992 }
else if (
angle < 2 * 180 * 3 / 16) {
2993 gradient.type = GRADIENT_TopLeft2BottomRight;
2994 }
else if (
angle < 2 * 180 * 5 / 16) {
2995 gradient.type = GRADIENT_Top2Bottom;
2996 }
else if (
angle < 2 * 180 * 7 / 16) {
2997 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
2998 }
else if (
angle < 2 * 180 * 9 / 16) {
2999 gradient.type = GRADIENT_Left2Right; reverse = 1;
3000 }
else if (
angle < 2 * 180 * 11 / 16) {
3001 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3002 }
else if (
angle < 2 * 180 * 13 / 16) {
3003 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3005 gradient.type = GRADIENT_BottomLeft2TopRight;
3008 for (
p = (
char*)colors; isspace((
int)*
p);
p++) { }
3010 for (npoints1 = 0; *
p; npoints1++) {
3012 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3014 for ( ; isspace((
int)*
p);
p++) { }
3017 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3019 for (npoints2 = 0; *
p; npoints2++) {
3021 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3023 for ( ; isspace((
int)*
p);
p++) { }
3028 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3037 gradient.color =
new ARGB32[npoints1];
3038 gradient.offset =
new double[npoints1];
3040 for (
p = (
char*)colors; isspace((
int)*
p);
p++) { }
3042 for (npoints1 = 0; *
p; ) {
3046 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3048 for ( ; isspace((
int)*
p);
p++) { }
3050 col = str(pb - colors,
p - pb);
3052 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3055 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3060 for (
p = (
char*)offsets; isspace((
int)*
p);
p++) { }
3062 for (npoints2 = 0; *
p; ) {
3066 for ( ; *
p && !isspace((
int)*
p);
p++) { }
3069 gradient.offset[npoints2] = strtod(pb, &pb);
3071 if (pb ==
p) npoints2++;
3073 for ( ; isspace((
int)*
p);
p++) { }
3076 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3077 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3080 gradient.npoints = npoints1;
3082 if (npoints2 && (gradient.npoints > npoints2)) {
3083 gradient.npoints = npoints2;
3086 for (i = 0; i < gradient.npoints/2; i++) {
3087 int i2 = gradient.npoints - 1 - i;
3088 ARGB32
c = gradient.color[i];
3089 double o = gradient.offset[i];
3090 gradient.color[i] = gradient.color[i2];
3091 gradient.color[i2] =
c;
3092 gradient.offset[i] = gradient.offset[i2];
3093 gradient.offset[i2] = o;
3095 for (i = 0; i < gradient.npoints; i++) {
3096 gradient.offset[i] = 1.0 - gradient.offset[i];
3099 rendered_im = make_gradient(vis, &gradient,
width,
height, SCL_DO_ALL,
3102 delete [] gradient.color;
3103 delete [] gradient.offset;
3107 Warning(
"Gradient",
"Failed to create gradient image");
3116 ASImageLayer layers[2];
3118 init_image_layers(&(layers[0]), 2);
3120 layers[0].dst_x = 0;
3121 layers[0].dst_y = 0;
3122 layers[0].clip_width =
fImage->width;
3123 layers[0].clip_height =
fImage->height;
3124 layers[0].bevel =
nullptr;
3125 layers[1].im = rendered_im;
3126 layers[1].dst_x =
x;
3127 layers[1].dst_y =
y;
3128 layers[1].clip_width =
width;
3129 layers[1].clip_height =
height;
3130 layers[1].merge_scanlines = alphablend_scanlines;
3132 ASImage *merge_im = merge_layers(vis, &(layers[0]), 2,
fImage->width,
fImage->height,
3135 Warning(
"Gradient",
"Failed to create merged image");
3139 destroy_asimage(&rendered_im);
3154 cmp = (cmp * 12) / 10;
3156 return (cmp > 255) ? 255 : cmp;
3177 return (background >> 1) & 0x7F7F7F7F;
3188 a = ARGB32_ALPHA8(
foreground) + ARGB32_ALPHA8(background);
3190 r = ARGB32_RED8(
foreground) + ARGB32_RED8(background);
3192 g = ARGB32_GREEN8(
foreground) + ARGB32_GREEN8(background);
3194 b = ARGB32_BLUE8(
foreground) + ARGB32_BLUE8(background);
3197 return MAKE_ARGB32(
a,
r,
g,
b);
3213 const char *hi_color,
const char *lo_color,
UShort_t thick,
3216 auto vis = gVisualHolder();
3218 Warning(
"Bevel",
"Visual not initiated");
3225 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3226 parse_argb_color(hi_color, &
hi);
3227 parse_argb_color(lo_color, &lo);
3230 bevel.lo_color =
hi;
3232 bevel.hi_color = lo;
3235 bevel.hi_color =
hi;
3237 bevel.lo_color = lo;
3242 int extra_hilite = 2;
3243 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3244 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3246 if (bevel.top_outline > 1) {
3247 bevel.top_inline += bevel.top_outline - 1;
3250 if (bevel.left_outline > 1) {
3251 bevel.left_inline += bevel.left_outline - 1;
3254 if (bevel.right_outline > 1) {
3255 bevel.right_inline += bevel.right_outline - 1;
3258 if (bevel.bottom_outline > 1) {
3259 bevel.bottom_inline += bevel.bottom_outline - 1;
3263 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3269 Warning(
"Bevel",
"Failed to create image");
3281 ASImageLayer layers[2];
3282 init_image_layers(&(layers[0]), 2);
3285 layers[0].dst_x = 0;
3286 layers[0].dst_y = 0;
3287 layers[0].clip_width =
fImage->width;
3288 layers[0].clip_height =
fImage->height;
3289 layers[0].bevel =
nullptr;
3291 UInt_t w =
width - (bevel.left_outline + bevel.right_outline);
3292 UInt_t h =
height - (bevel.top_outline + bevel.bottom_outline);
3293 ASImage *bevel_im = create_asimage(
w,
h, 0);
3296 Warning(
"Bevel",
"Failed to create bevel image");
3300 layers[1].im = bevel_im;
3301 fill_asimage(vis, bevel_im, 0, 0,
w,
h, fill);
3303 layers[1].dst_x =
x;
3304 layers[1].dst_y =
y;
3305 layers[1].clip_width =
width;
3306 layers[1].clip_height =
height;
3307 layers[1].bevel = &bevel;
3308 layers[1].merge_scanlines = alphablend_scanlines;
3310 merge_im = merge_layers(vis, &(layers[0]), 2,
fImage->width,
fImage->height,
3312 destroy_asimage(&bevel_im);
3315 Warning(
"Bevel",
"Failed to image");
3334 auto vis = gVisualHolder();
3336 Warning(
"Pad",
"Visual not initiated");
3341 fImage = create_asimage(100, 100, 0);
3344 Warning(
"Pad",
"Failed to create image");
3351 ARGB32 color = ARGB32_White;
3352 parse_argb_color(col, &color);
3359 ASImage *img = pad_asimage(vis,
fImage,
x,
y,
w,
h, color,
3363 Warning(
"Pad",
"Failed to create output image");
3379 auto vis = gVisualHolder();
3381 Warning(
"Crop",
"Visual not initiated");
3394 Warning(
"Crop",
"specified x/y position larger than image");
3402 Warning(
"Crop",
"specified size larger than image");
3406 ASImageDecoder *imdec = start_image_decoding(vis,
fImage, SCL_DO_ALL,
3410 Warning(
"Crop",
"Failed to start image decoding");
3417 stop_image_decoding(&imdec);
3418 Warning(
"Crop",
"Failed to create image");
3422 ASImageOutput *imout = start_image_output(vis, img, ASA_ASImage,
3426 Warning(
"Crop",
"Failed to start image output");
3427 destroy_asimage(&img);
3428 stop_image_decoding(&imdec);
3437 imdec->decode_image_scanline(imdec);
3438 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3441 stop_image_decoding(&imdec);
3442 stop_image_output(&imout);
3468 if (
auto asimg =
dynamic_cast<const TASImage *
>(im))
3482 }
else if (opt ==
"/") {
3510 auto vis = gVisualHolder();
3512 Warning(
"BeginPaint",
"Visual not initiated");
3517 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3520 Warning(
"BeginPaint",
"Failed to create image");
3534 Warning(
"EndPaint",
"no image");
3541 ASImage *img = tile_asimage(gVisualHolder(),
fImage, 0, 0,
fImage->width,
fImage->height,
3542 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3545 Warning(
"EndPaint",
"Failed to create image");
3562 Warning(
"GetArgbArray",
"no image");
3567 if (!img)
return nullptr;
3569 if (!img->alt.argb32) {
3579 return (
UInt_t *)img->alt.argb32;
3590 Warning(
"GetRgbaArray",
"no image");
3595 if (!img)
return nullptr;
3597 if (!img->alt.argb32) {
3614 for (i = 0; i < img->height; i++) {
3615 for (j = 0; j < img->width; j++) {
3617 argb = img->alt.argb32[idx];
3619 rgb = argb & 0x00ffffff;
3620 rgba = (rgb << 8) +
a;
3637 Warning(
"GetScanline",
"no image");
3641 auto vis = gVisualHolder();
3643 Warning(
"GetScanline",
"no visual");
3647 ASImageDecoder *imdec = start_image_decoding(vis, img, SCL_DO_ALL,
3648 0,
y, img->width, 1,
nullptr);
3651 Warning(
"GetScanline",
"Failed to start image decoding");
3655 CARD32 *ret =
new CARD32[img->width];
3661 imdec->decode_image_scanline(imdec);
3662 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3663 stop_image_decoding(&imdec);
3678#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3679#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3680 "movl %1,%%edi \n" \
3681 "movl %2,%%ecx \n" \
3686 :"g" (val), "g" (dst), "g" (lng) \
3687 :"eax","edi","ecx" \
3691 #define _MEMSET_(dst, lng, val) do {\
3692 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3696#define FillSpansInternal(npt, ppt, widths, color) do {\
3697 UInt_t yy = ppt[0].fY*fImage->width;\
3698 for (UInt_t i = 0; i < npt; i++) {\
3699 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3700 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3711 if (!
InitImage(
"FillRectangleInternal")) {
3715 ARGB32 color = (ARGB32)col;
3729 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3737 if (!
fImage->alt.argb32) {
3742 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3773 ARGB32 color = ARGB32_White;
3776 parse_argb_color(col, &color);
3797 ARGB32 color = (ARGB32)col;
3800 if (!thick) thick = 1;
3808 thick += (
x - half);
3819 if (
x + w < fImage->
width) {
3836 ARGB32 color = (ARGB32)col;
3839 if (!thick) thick = 1;
3847 thick += (
y - half);
3870 const char *col,
UInt_t thick)
3872 ARGB32 color = ARGB32_White;
3873 parse_argb_color(col, &color);
3885 int x,
y, xend, yend;
3895 ARGB32 color = (ARGB32)col;
3900 if (!dx && !dy)
return;
3922 i2 = i1 - (dx << 1);
3939 q = (
y2 -
y1) * ydir;
3972 i2 = i1 - (dy << 1);
3989 q = (
x2 -
x1) * xdir;
4027 const char *col,
UInt_t thick)
4037 if (!
fImage->alt.argb32) {
4041 if (!
fImage->alt.argb32) {
4042 Warning(
"DrawRectangle",
"Failed to get argb32 pixel array");
4046 ARGB32 color = ARGB32_White;
4047 parse_argb_color(col, &color);
4067 ARGB32 color = ARGB32_White;
4078 parse_argb_color(col, &color);
4084 parse_argb_color(col, &color);
4118 ARGB32 color = (ARGB32)col;
4128 thick += (
y - half);
4131 thick = thick <= 0 ? 1 : thick;
4140 x2 =
x2 < tmp ? tmp :
x2;
4152 if (i >= pDash[iDash]) {
4156 if (iDash >= nDash) {
4175 ARGB32 color = (ARGB32)col;
4185 thick += (
x - half);
4188 thick = thick <= 0 ? 1 : thick;
4196 y2 =
y2 < tmp ? tmp :
y2;
4203 if (
x + w < fImage->
width) {
4211 if (i >= pDash[iDash]) {
4215 if (iDash >= nDash) {
4234 int x,
y, xend, yend;
4244 char *pDash =
new char[nDash];
4249 for (i = 0; i < (
int)nDash; i++) {
4255 i2 = i1 - (dx << 1);
4273 q = (
y2 -
y1) * ydir;
4278 if ((iDash%2) == 0) {
4290 if (i >= pDash[iDash]) {
4294 if (iDash >= nDash) {
4302 if ((iDash%2) == 0) {
4314 if (i >= pDash[iDash]) {
4318 if (iDash >= nDash) {
4327 for (i = 0; i < (
int)nDash; i++) {
4333 i2 = i1 - (dy << 1);
4351 q = (
x2 -
x1) * xdir;
4356 if ((iDash%2) == 0) {
4370 if (i >= pDash[iDash]) {
4374 if (iDash >= nDash) {
4382 if ((iDash%2) == 0) {
4396 if (i >= pDash[iDash]) {
4400 if (iDash >= nDash) {
4421 double x,
y, xend=0, yend=0, x0, y0;
4429 double *xDash =
new double[nDash];
4430 double *yDash =
new double[nDash];
4435 for (i = 0; i < (
int)nDash; i++) {
4436 xDash[i] = tDash[i] * ac;
4437 yDash[i] = tDash[i] * as;
4441 xDash[i] = xDash[i]/2;
4442 yDash[i] = yDash[i]/2;
4444 xDash[i] = xDash[i]*2;
4445 yDash[i] = yDash[i]*2;
4462 q = (
y2 -
y1) * ydir;
4469 while ((
x < xend) && (
y < yend)) {
4473 if ((iDash%2) == 0) {
4483 if (iDash >= nDash) {
4488 while ((
x < xend) && (
y > yend)) {
4492 if ((iDash%2) == 0) {
4502 if (iDash >= nDash) {
4521 q = (
x2 -
x1) * xdir;
4528 while ((
x < xend) && (
y < yend)) {
4532 if ((iDash%2) == 0) {
4542 if (iDash >= nDash) {
4547 while ((
x > xend) && (
y < yend)) {
4551 if ((iDash%2) == 0) {
4561 if (iDash >= nDash) {
4575 const char *pDash,
const char *col,
UInt_t thick)
4582 if ((nDash < 2) || !pDash || (nDash%2)) {
4583 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4587 ARGB32 color = ARGB32_White;
4588 parse_argb_color(col, &color);
4592 }
else if (
y1 ==
y2) {
4606 ARGB32 color = ARGB32_White;
4607 parse_argb_color(col, &color);
4614 for (
UInt_t i = 1; i < nn; i++) {
4635 parse_argb_color(col, &color);
4637 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4638 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4655 Warning(
"PolyPoint",
"No points specified");
4662 parse_argb_color(col, &color);
4668 for (i = 0; i < npt; i++) {
4669 ipt[i].
fX += ppt[i].
fX;
4670 ipt[i].
fY += ppt[i].
fY;
4675 for (i = 0; i < npt; i++) {
4676 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4677 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4679 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4695 if (!nseg || !seg) {
4696 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4702 for (
UInt_t i = 0; i < nseg; i++) {
4703 pt[0].fX = seg->
fX1;
4704 pt[1].fX = seg->
fX2;
4705 pt[0].fY = seg->
fY1;
4706 pt[1].fY = seg->
fY2;
4723 if (!npt || !ppt || !widths || (stipple && (!
w || !
h))) {
4724 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4725 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple,
w,
h);
4730 parse_argb_color(col, &color);
4735 for (
UInt_t i = 0; i < npt; i++) {
4737 for (
UInt_t j = 0; j < widths[i]; j++) {
4738 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4749 if (stipple[ii >> 3] & (1 << (ii%8))) {
4766 if (!npt || !ppt || !widths || !tile) {
4767 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4768 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4780 for (
UInt_t i = 0; i < npt; i++) {
4783 for (
UInt_t j = 0; j < widths[i]; j++) {
4784 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4805 if (!npt || !ppt || !widths) {
4806 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4811 int y1 = ppt[npt-1].
fY;
4819 for (
y = 0; (
int)
y < y0;
y++) {
4822 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4827 for (i = 0; i < npt; i++) {
4828 for (
x = 0; (
int)
x < ppt[i].fX;
x++) {
4830 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4832 for (
x = ppt[i].fX + widths[i] + 1;
x <
fImage->width;
x++) {
4834 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4842 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4876 Warning(
"CopyArea",
"no image");
4890 xsrc = xsrc < 0 ? 0 : xsrc;
4891 ysrc = ysrc < 0 ? 0 : ysrc;
4893 if ((xsrc >= (
int)
fImage->width) || (ysrc >= (
int)
fImage->height))
return;
4902 if (!out->alt.argb32) {
4903 dstimg->BeginPaint();
4904 out = dstimg->GetImage();
4907 if (
fImage->alt.argb32 && out->alt.argb32) {
4908 for (
y = 0;
y < (
int)
h;
y++) {
4909 for (
x = 0;
x < (
int)
w;
x++) {
4910 idx =
Idx(yy +
x + xsrc);
4911 if ((
x + xdst < 0) || (ydst +
y < 0) ||
4912 (
x + xdst >= (
int)out->width) || (
y + ydst >= (
int)out->height) )
continue;
4914 idx2 =
Idx((ydst +
y)*out->width +
x + xdst);
4918 out->alt.argb32[idx2] = 0;
4921 out->alt.argb32[idx2] &=
fImage->alt.argb32[idx];
4924 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] & (~out->alt.argb32[idx2]);
4927 out->alt.argb32[idx2] &= ~fImage->alt.argb32[idx];
4932 out->alt.argb32[idx2] ^=
fImage->alt.argb32[idx];
4935 out->alt.argb32[idx2] |=
fImage->alt.argb32[idx];
4938 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) & (~out->alt.argb32[idx2]);
4941 out->alt.argb32[idx2] ^= ~fImage->alt.argb32[idx];
4944 out->alt.argb32[idx2] = ~out->alt.argb32[idx2];
4947 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] | (~out->alt.argb32[idx2]);
4950 out->alt.argb32[idx2] = ~fImage->alt.argb32[idx];
4953 out->alt.argb32[idx2] |= ~fImage->alt.argb32[idx];
4956 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) | (~out->alt.argb32[idx2]);
4959 out->alt.argb32[idx2] = 0xFFFFFFFF;
4963 out->alt.argb32[idx2] =
fImage->alt.argb32[idx];
4987 int i, j, ix, iy,
w,
h;
4989 ARGB32 color = 0xFFFFFFFF;
4996 for (i = 0; i < nx; i++) {
4998 for (j = 0; j < ny; j++) {
4999 icol = (ARGB32)ic[i + (nx*j)];
5000 if (icol != color) {
5026const ASVisual *TASImage::GetVisual()
5056 return (ptMin - ptsStart);
5072 int mr = 0, m1r = 0;
5073 int incr1l = 0, incr2l = 0;
5074 int incr1r = 0, incr2r = 0;
5079 int nextleft, nextright;
5082 TPoint *firstPoint =
nullptr;
5083 UInt_t *firstWidth =
nullptr;
5095 if ((npt < 3) || !ppt) {
5096 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%zx", npt, (
size_t)ppt);
5105 if ((npt < 3) || (dy < 0))
return kFALSE;
5107 ptsOut = firstPoint =
new TPoint[dy];
5111 nextleft = nextright = imin;
5112 y = ppt[nextleft].
fY;
5117 if (ppt[nextleft].fY ==
y) {
5123 if (nextleft >= (
int)npt) {
5130 ppt[left].fX, ppt[nextleft].fX,
5131 xl, dl, ml, m1l, incr1l, incr2l);
5135 if (ppt[nextright].fY ==
y) {
5141 if (nextright < 0) {
5148 ppt[right].fX, ppt[nextright].fX,
5149 xr, dr, mr, m1r, incr1r, incr2r);
5154 i =
TMath::Min(ppt[nextleft].fY, ppt[nextright].fY) -
y;
5158 delete [] firstWidth;
5159 delete [] firstPoint;
5168 *(
width++) = xr - xl;
5169 (ptsOut++)->fX = xl;
5171 *(
width++) = xl - xr;
5172 (ptsOut++)->fX = xr;
5180 }
while (
y !=
ymax);
5182 *nspans =
UInt_t(ptsOut - firstPoint);
5183 *outPoint = firstPoint;
5184 *outWidth = firstWidth;
5197 TPoint *firstPoint =
nullptr;
5198 UInt_t *firstWidth =
nullptr;
5201 ARGB32 color = ARGB32_White;
5202 parse_argb_color(col, &color);
5205 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5208 FillSpans(nspans, firstPoint, firstWidth, col, stipple,
w,
h);
5212 delete [] firstWidth;
5213 delete [] firstPoint;
5216 if (firstWidth)
delete [] firstWidth;
5217 if (firstPoint)
delete [] firstPoint;
5228 TPoint *firstPoint =
nullptr;
5229 UInt_t *firstWidth =
nullptr;
5234 FillSpans(nspans, firstPoint, firstWidth, tile);
5237 delete [] firstWidth;
5238 delete [] firstPoint;
5241 if (firstWidth)
delete [] firstWidth;
5242 if (firstPoint)
delete [] firstPoint;
5252 TPoint *firstPoint =
nullptr;
5253 UInt_t *firstWidth =
nullptr;
5258 CropSpans(nspans, firstPoint, firstWidth);
5261 delete [] firstWidth;
5262 delete [] firstPoint;
5265 if (firstWidth)
delete [] firstWidth;
5266 if (firstPoint)
delete [] firstPoint;
5282 if ((count < 3) || !ptsIn) {
5283 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5292 ARGB32 color = ARGB32_White;
5293 parse_argb_color(col, &color);
5311 static const UInt_t gEdgeTableEntryCacheSize = 200;
5312 static EdgeTableEntry gEdgeTableEntryCache[gEdgeTableEntryCacheSize];
5314 if (count < gEdgeTableEntryCacheSize) {
5325 ptsOut = firstPoint;
5347 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5350 FillSpans(nPts, firstPoint, firstWidth, col, stipple,
w,
h);
5352 ptsOut = firstPoint;
5363 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5366 FillSpans(nPts, firstPoint, firstWidth, col, stipple,
w,
h);
5370 if (
del)
delete [] pETEs;
5383 if ((count < 3) || !ptsIn) {
5384 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5413 ptsOut = firstPoint;
5435 FillSpans(nPts, firstPoint, firstWidth, tile);
5436 ptsOut = firstPoint;
5445 FillSpans(nPts, firstPoint, firstWidth, tile);
5456 ASDrawContext *ctx =
new ASDrawContext;
5458 ctx->canvas_width = im->width;
5459 ctx->canvas_height = im->height;
5460 ctx->canvas = im->alt.argb32;
5461 ctx->scratch_canvas =
nullptr;
5463 ctx->flags = ASDrawCTX_CanvasIsARGB;
5464 asim_set_custom_brush_colored( ctx, brush);
5474 if (ctx->scratch_canvas)
free(ctx->scratch_canvas);
5491 Int_t sz = thick*thick;
5498 matrix =
new CARD32[sz];
5501 for (
int i = 0; i < sz; i++) {
5502 matrix[i] = (CARD32)color;
5506 brush.matrix = matrix;
5507 brush.width = thick;
5508 brush.height = thick;
5509 brush.center_y = brush.center_x = thick/2;
5518 if (xx1 ==
fImage->width) --xx1;
5519 if (yy1 ==
fImage->height) --yy1;
5520 if (xx2 ==
fImage->width) --xx2;
5521 if (yy2 ==
fImage->height) --yy2;
5523 asim_move_to(ctx, xx1, yy1);
5524 asim_line_to(ctx, xx2, yy2);
5537 Int_t clipx1 = 0, clipx2 = 0, clipy1 = 0, clipy2 = 0;
5550 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
5555 Int_t bx = 0, by = 0;
5564 auto ndots =
width * rows;
5571 if ((byy >= (
Int_t)
fImage->height) || (byy < 0))
continue;
5575 if ((bxx >= (
Int_t)
fImage->width) || (bxx < 0))
continue;
5577 auto idx =
Idx(bxx + yy);
5578 r += ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
5579 g += ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
5580 b += (
fImage->alt.argb32[idx] & 0x0000ff);
5590 col[0] = (
r << 16) + (
g << 8) +
b;
5592 Int_t col4r = (col[4] & 0xff0000) >> 16;
5593 Int_t col4g = (col[4] & 0x00ff00) >> 8;
5594 Int_t col4b = (col[4] & 0x0000ff);
5599 Int_t colxr = (col4r*
x +
r*xx) >> 2;
5600 Int_t colxg = (col4g*
x +
g*xx) >> 2;
5601 Int_t colxb = (col4b*
x +
b*xx) >> 2;
5602 col[
x] = (colxr << 16) + (colxg << 8) + colxb;
5616 d = ((
d + 10) * 5) >> 8;
5620 if (noClip || ((bxx < clipx2) && (bxx >= clipx1) &&
5621 (byy >= clipy2) && (byy < clipy1))) {
5622 auto idx =
Idx(bxx + yy);
5623 auto acolor = (ARGB32) col[
d];
5627 fImage->alt.argb32[idx] = acolor;
5668 const wchar_t *wcsTitle =
reinterpret_cast<const wchar_t *
>(
text->GetWcsTitle());
5682 ARGB32 color = ARGB32_White;
5717 static ASImageExportParams params;
5725 ret = ASImage2xpmRawBuff(img, (CARD8 **)buffer,
size,
nullptr);
5728 ret = ASImage2PNGBuff(img, (CARD8 **)buffer,
size, ¶ms);
5772 static ASImageImportParams params;
5776 params.filter = SCL_DO_ALL;
5777 params.gamma = SCREEN_GAMMA;
5778 params.gamma_table =
nullptr;
5779 params.compression = 0;
5780 params.format = ASA_ASImage;
5781 params.search_path =
nullptr;
5782 params.subimage = 0;
5787 char *ptr = buffer[0];
5788 while (isspace((
int)*ptr)) ++ptr;
5790 fImage = xpm_data2ASImage((
const char**)buffer, ¶ms);
5792 fImage = xpmRawBuff2ASImage((
const char*)*buffer, ¶ms);
5797 fImage = PNGBuff2ASimage((CARD8 *)*buffer, ¶ms);
5823 Warning(
"CreateThumbnail",
"No image");
5827 auto vis = gVisualHolder();
5829 Warning(
"CreateThumbnail",
"Visual not initiated");
5833 static char *buf =
nullptr;
5835 ASImage *img =
nullptr;
5848 img = scale_asimage(vis,
fImage,
w,
h, ASA_ASImage,
5855 ASImage *rendered_im;
5856 ASImageLayer layers[2];
5857 init_image_layers(&(layers[0]), 2);
5859 layers[0].dst_x = 0;
5860 layers[0].dst_y = 0;
5861 layers[0].clip_width = img->width;
5862 layers[0].clip_height = img->height;
5863 layers[0].bevel =
nullptr;
5865 layers[1].dst_x = 0;
5866 layers[1].dst_y = 0;
5867 layers[1].clip_width = img->width;
5868 layers[1].clip_height = img->height;
5869 layers[1].merge_scanlines = blend_scanlines_name2func(
"tint");
5870 rendered_im = merge_layers(vis, &(layers[0]), 2, img->width, img->height,
5872 destroy_asimage(&img);
5876 ASImage *padimg =
nullptr;
5881 padimg = pad_asimage(vis, img, 0,
d, sz, sz, 0x00ffffff,
5885 padimg = pad_asimage(vis, img,
d, 0, sz, sz, 0x00ffffff,
5890 destroy_asimage(&img);
5895 ASImage2xpmRawBuff(padimg, (CARD8 **)ptr, &
size,
nullptr);
5898 destroy_asimage(&padimg);
5911 if (
b.IsReading()) {
5912 Version_t version =
b.ReadVersion(&R__s, &R__c);
5917 if ( version == 1 ) {
5918 Int_t fileVersion =
b.GetVersionOwner();
5919 if (fileVersion > 0 && fileVersion < 50000 ) {
5927 if ( fileVersion < 40200 ) {
5946 if (image_type != 0) {
5948 char *buffer =
new char[
size];
5949 b.ReadFastArray(buffer,
size);
5958 b.ReadFastArray(vec,
size);
5974 image_type =
fImage->alt.vector ? 0 : 1;
5977 if (image_type != 0) {
5978 char *buffer =
nullptr;
5981 b.WriteFastArray(buffer,
size);
5989 b.SetByteCount(R__c,
kTRUE);
5998 if (
fImage->alt.vector) {
6039 if ((start > 0) && (stop - start > 0)) {
6053 Int_t sz = thick*thick;
6057 ARGB32 color = ARGB32_White;
6058 parse_argb_color(col, &color);
6063 matrix =
new CARD32[sz];
6066 for (
int i = 0; i < sz; i++) {
6067 matrix[i] = (CARD32)color;
6071 brush.matrix = matrix;
6072 brush.width = thick;
6073 brush.height = thick;
6074 brush.center_y = brush.center_x = thick/2;
6077 asim_cube_bezier(ctx,
x1,
y1,
x2,
y2, x3, y3);
6090 const char *col,
Int_t thick)
6095 thick = !thick ? 1 : thick;
6096 Int_t sz = thick*thick;
6100 ARGB32 color = ARGB32_White;
6101 parse_argb_color(col, &color);
6106 matrix =
new CARD32[sz];
6109 for (
int i = 0; i < sz; i++) {
6110 matrix[i] = (CARD32)color;
6114 brush.matrix = matrix;
6115 brush.width = thick > 0 ? thick : 1;
6116 brush.height = thick > 0 ? thick : 1;
6117 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6120 asim_straight_ellips(ctx,
x,
y, rx, ry, thick < 0);
6138 thick = !thick ? 1 : thick;
6139 Int_t sz = thick*thick;
6143 ARGB32 color = ARGB32_White;
6144 parse_argb_color(col, &color);
6150 matrix =
new CARD32[sz];
6153 for (
int i = 0; i < sz; i++) {
6154 matrix[i] = (CARD32)color;
6158 brush.matrix = matrix;
6159 brush.height = brush.width = thick > 0 ? thick : 1;
6160 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6163 asim_circle(ctx,
x,
y,
r, thick < 0);
6177 const char *col,
Int_t thick)
6182 thick = !thick ? 1 : thick;
6183 Int_t sz = thick*thick;
6187 ARGB32 color = ARGB32_White;
6188 parse_argb_color(col, &color);
6193 matrix =
new CARD32[sz];
6196 for (
int i = 0; i < sz; i++) {
6197 matrix[i] = (CARD32)color;
6201 brush.matrix = matrix;
6202 brush.width = thick > 0 ? thick : 1;
6203 brush.height = thick > 0 ? thick : 1;
6204 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6207 asim_ellips(ctx,
x,
y, rx, ry,
angle, thick < 0);
6220 const char *col,
Int_t thick)
6225 thick = !thick ? 1 : thick;
6226 Int_t sz = thick*thick;
6230 ARGB32 color = ARGB32_White;
6231 parse_argb_color(col, &color);
6236 matrix =
new CARD32[sz];
6239 for (
int i = 0; i < sz; i++) {
6240 matrix[i] = (CARD32)color;
6244 brush.matrix = matrix;
6245 brush.width = thick > 0 ? thick : 1;
6246 brush.height = thick > 0 ? thick : 1;
6247 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6250 asim_ellips2(ctx,
x,
y, rx, ry,
angle, thick < 0);
6262 const char * ,
const char * )
6276 Warning(
"Gray",
"Image not initiated");
6280 auto vis = gVisualHolder();
6282 Warning(
"Gray",
"Visual not initiated");
6289 ASImage *sav =
nullptr;
6306 if (
fImage->alt.argb32) {
6308 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
6310 for (i = 0; i <
fImage->height; i++) {
6311 for (j = 0; j <
fImage->width; j++) {
6314 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6315 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6316 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6317 l = (57*
r + 181*
g + 18*
b)/256;
6325 ASImageDecoder *imdec = start_image_decoding(vis,
fImage, SCL_DO_ALL,
6334 ASImageOutput *imout = start_image_output(vis,
fGrayImage, ASA_ASImage,
6337 Warning(
"ToGray",
"Failed to start image output");
6343 CARD32 *aa = imdec->buffer.alpha;
6344 CARD32 *rr = imdec->buffer.red;
6345 CARD32 *gg = imdec->buffer.green;
6346 CARD32 *bb = imdec->buffer.blue;
6349 prepare_scanline(
fImage->width, 0, &
result, vis->BGR_mode);
6351 for (i = 0; i <
fImage->height; i++) {
6352 imdec->decode_image_scanline(imdec);
6353 result.flags = imdec->buffer.flags;
6354 result.back_color = imdec->buffer.back_color;
6356 for (j = 0; j <
fImage->width; j++) {
6357 l = (57*rr[j] + 181*gg[j]+ 18*bb[j])/256;
6363 imout->output_image_scanline(imout, &
result, 1);
6366 stop_image_decoding(&imdec);
6367 stop_image_output(&imout);
6411 Warning(
"FromWindow",
"Visual not initiated");
6427 fImage = bitmap2asimage(bits,
w,
h, 0,
nullptr);
6440 std::vector<UChar_t> xx(4 *
w);
6441 for (
UInt_t i = 0; i <
h / 2; ++i) {
6442 memcpy(xx.data(), buf + 4*
w*i, 4*
w);
6443 memcpy(buf + 4*
w*i, buf + 4*
w*(
h-i-1), 4*
w);
6444 memcpy(buf + 4*
w*(
h-i-1), xx.data(), 4*
w);
6458 fImage = bitmap2asimage(
const_cast<unsigned char *
>(buf),
width,
height, 0,
const_cast<unsigned char *
>(
mask));
6470 auto vis = gVisualHolder();
6473 Warning(
"FromGradient",
"Visual not initiated");
6500 gPad->Range(-left / (1.0 - left - right),
6501 -bottom / (1.0 - top - bottom),
6502 1 + right / (1.0 - left - right),
6503 1 + top / ( 1.0 - top - bottom));
6504 gPad->RangeAxis(0, 0, 1, 1);
6514 char *buf =
nullptr;
6520 str.ReplaceAll(
"static",
"const");
6524 str.ReplaceAll(
"asxpm", xpm.
Data());
6525 out <<
"\n" << str <<
"\n\n";
6530 out <<
"asimage = TImage::Create();\n";
6531 out <<
" asimage->SetImageBuffer( (char **)" << xpm <<
", TImage::kXpm);\n";
6533 out <<
" asimage->Draw();\n";
6546 static char buf[32];
6547 FILE *fp = fopen(
name,
"rb+");
6550 printf(
"file %s : failed to open\n",
name);
6554 if (!fread(buf, 1, 20, fp)) {
6559 char dpi1 = (set & 0xffff) >> 8;
6560 char dpi2 = set & 0xff;
6565 for (i = 0; i < 20; i++) {
6566 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6567 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6573 if (i == 20 || dpi+4 >= 20) {
6575 printf(
"file %s : wrong JPEG format\n",
name);
6582 buf[dpi + 1] = dpi1;
6583 buf[dpi + 2] = dpi2;
6586 buf[dpi + 3] = dpi1;
6587 buf[dpi + 4] = dpi2;
6590 fwrite(buf, 1, 20, fp);
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t Visual_t
Visual handle.
Handle_t Window_t
Window handle.
Handle_t Display_t
Display 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
Handle_t Colormap_t
Colormap 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 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.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
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 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
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)
Holder of plain ASVisual instance (no any X11), destroyed when thread or application closed Only this...
ASFontManager * FontManager()
ASFontManager * fFontManager
void PaintBox(TVirtualPad &parent)
TASImageInteractive(TVirtualPad &parent, Int_t px, Int_t py)
void PerformMove(Int_t px, Int_t py)
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).
void DrawFTGlyphs(TTFhandle &ttf, UInt_t color, Int_t x, Int_t y, TVirtualPad *clippad=nullptr, Int_t offx=0, Int_t offy=0)
Draw TTF glyphs .
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
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 ASVisual * InitVisual()
Bool_t InitImage(const char *caller)
Static function to initialize the image.
const char * GetTitle() const override
Title is used to keep 32x32 xpm image's thumbnail.
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.
UInt_t GetScaledHeight() const override
Return height of the displayed image not of the original image.
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
static ASImage * Picture2ASImage(struct ASVisual *visual, Pixmap_t pxm, Pixmap_t mask, UInt_t width, UInt_t height)
Convert picture (X11 pixmap with mask) to ASImage For internal use in TASUtils class.
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
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 FromGLBuffer(UChar_t *buf, UInt_t width, UInt_t height) override
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.
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="")
void FromBitmap(const UChar_t *buf, UInt_t width, UInt_t height, const UChar_t *mask=nullptr) override
Creates an image from a RGBA buffer.
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.
Bool_t GetMaskBits(UInt_t &width, UInt_t &height, std::vector< char > &bits) override
Returns image mask bits - only alpha channel of the image.
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.
static void ASImage2Drawable(struct ASVisual *visual, ASImage *image, Drawable_t wid, GContext_t gc, Int_t xsrc, Int_t ysrc, Int_t x, Int_t y, UInt_t width, UInt_t height)
Output ASImage on X11 drawable For internal use in TASUtils class.
static ASImage * Pixmap2ASImage(struct ASVisual *visual, Window_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height)
Convert region of X11 window to ASImage For internal use in TASUtils class.
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
void FromGradient(struct ASGradient *as_gradient, UInt_t width, UInt_t height)
Creates an image from ASGradient.
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.
ASImage * GetImage() const
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.
static struct ASVisual * CreateX11Visual(Display_t display, Int_t screen, Int_t depth, Visual_t visual, Colormap_t cmap)
Create ASVisual for X11 display For internal use in TASUtils class.
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
void FromWindow(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
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 CloneImageData(const TASImage &src)
Clone image data Used for clones and assign operator.
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".
static Pixmap_t ASImage2Pixmap(struct ASVisual *visual, Window_t root_window, ASImage *image)
Convert ASImage to pixmap for X11 For internal use in TASUtils class.
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.
UInt_t GetScaledWidth() const override
Return width of the displayed image not of the original image.
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".
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.
static void DestroyVisual(struct ASVisual *visual)
Destroy ASVisual for X11 display For internal use in TASUtils class.
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 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 ModifyOn(TVirtualPad &pad)
Change current line attributes on specified pad.
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
virtual void Option_t *static TImage * Create()
Create an image.
TImage & operator=(const TImage &img)
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.
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.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
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 * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
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 const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
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.
void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
UInt_t GetNumGlyphs() const
return number of glyphs
void SetTextFont(Font_t fontnumber)
Set specified font.
void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
void SetSmoothing(Bool_t state)
Bool_t GetGlyphData(UInt_t n, Int_t &offx, Int_t &offy, UChar_t *&buffer, UInt_t &width, UInt_t &rows, UInt_t &pitch)
Returns data for glyph bitmap Instead direct access to FT_BitmapGlyph one can obtain all relevant fie...
Bool_t ApplyAlignRotate(Int_t &px, Int_t &py, Int_t align, Int_t pad_width, Int_t pad_height)
Apply align and configured rotation matrix to text position px and py will be shifted to the place wh...
Base class for several text objects.
Int_t GetNoElements() const
Element * GetMatrixArray()
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual void * GetStream() const
virtual void Open(const char *filename, Int_t type=-111)=0
virtual Bool_t FillImageFromPad(TImage *image, TVirtualPad *pad) const
Fill TImage object by data from the pad Returns kFALSE if not supported or in case of failures.
small helper class to store/restore gPad context in TPad methods
Helper class to store interactive parameters for individual objects Should be used via MakeInteractiv...
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 void UpdateAsync()=0
virtual Bool_t IsWeb() const
virtual Double_t AbsPixeltoX(Double_t px)=0
virtual Bool_t IsBatch() const =0
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual Double_t GetY1() const =0
virtual TVirtualPadPainter * GetPainter()=0
const char * GetName() const override=0
Returns name of object.
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")=0
void Paint(Option_t *option="") override=0
This method must be overridden if a class wants to paint itself.
virtual Double_t GetY2() const =0
virtual Double_t AbsPixeltoY(Double_t py)=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