64#include "RConfigure.h"
102# include "Windows4root.h"
106# define X_DISPLAY_MISSING 1
108# include <afterbase.h>
110# include <win32/config.h>
111# include <win32/afterbase.h>
112# define X_DISPLAY_MISSING 1
114# include <afterimage.h>
132static char *
gIconPaths[7] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
139#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER
140#pragma GCC diagnostic ignored "-Wstrict-aliasing"
161#define _alphaBlend(bot, top) {\
162 __argb32__ *T = (__argb32__*)(top);\
163 __argb32__ *B = (__argb32__*)(bot);\
168 B->a = ((B->a*aa)>>8) + T->a;\
169 B->r = (B->r*aa + T->r*T->a)>>8;\
170 B->g = (B->g*aa + T->g*T->a)>>8;\
171 B->b = (B->b*aa + T->b*T->a)>>8;\
303 if (
img.fImage->alt.vector) {
324 if (
this != &
img &&
img.IsValid()) {
333 if (
img.fImage->alt.vector) {
383 const char *
delim =
":";
385 const char *
delim =
";";
404 const char *
ret =
"";
406 if (!fp)
return nullptr;
437 else if (
magic == 0x50)
488 Warning(
"Scale",
"Visual not initiated");
518 iparams.return_animation_delay = -1;
534 if (!
ext.IsNull() &&
ext.IsDigit()) {
552 unsigned char *
bitmap =
nullptr;
558 if (!handler || ((handler->
LoadPlugin() == -1))) {
657 Error(
"WriteImage",
"no image in memory. Draw something first");
661 if (!file || !*file) {
662 Error(
"WriteImage",
"no file name specified");
667 if ((s =
strrchr(file,
'.'))) {
671 Error(
"WriteImage",
"cannot determine a valid file type");
679 Error(
"WriteImage",
"not a valid file type was specified");
700 parms.xpm.dither = 4;
701 parms.xpm.opaque_threshold = 127;
702 parms.xpm.max_colors = 512;
717 parms.jpeg.flags = 0;
723 parms.gif.dither = 0;
724 parms.gif.opaque_threshold = 0;
730 parms.gif.dither = 0;
731 parms.gif.opaque_threshold = 0;
732 parms.gif.animate_repeats = 0;
746 parms.gif.animate_repeats = 0;
747 }
else if(
sufix==
"") {
753 }
else if(!
sufix.Contains(
"+")) {
765 parms.gif.animate_repeats = atoi(s);
775 parms.gif.animate_repeats = 0;
786 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
797 Error(
"WriteImage",
"unexpected gif extension structure %s",
fname.Data());
805 parms.tiff.rows_per_strip = 0;
808 parms.tiff.jpeg_quality = 100;
809 parms.tiff.opaque_threshold = 0;
812 Error(
"WriteImage",
"file type %s not yet supported", s);
817 Error(
"WriteImage",
"error writing file %s", file);
835 if (s ==
"jpg" || s ==
"jpeg")
997 Warning(
"SetImage",
"Visual not initiated");
1019 for (col = 0; col < 4; col++)
1036 for (col = 0; col < 4; col++)
1081 Error(
"FromPad",
"pad cannot be 0");
1086 Warning(
"FromPad",
"Visual not initiated");
1096 if (
gROOT->IsBatch()) {
1115 if (
itmp->fImage->alt.argb32) {
1143 if (
h == 0)
h =
pad->VtoPixel(0.);
1145 static int x11 = -1;
1146 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1151 unsigned char *bits =
gVirtualX->GetColorBits(
wd, 0, 0,
w,
h);
1177 Error(
"Draw",
"no image set");
1193 rname.ReplaceAll(
".",
"");
1205 gPad->Range(-left / (1.0 - left - right),
1206 -bottom / (1.0 - top - bottom),
1207 1 + right / (1.0 - left - right),
1208 1 + top / ( 1.0 - top - bottom));
1209 gPad->RangeAxis(0, 0, 1, 1);
1235 static int x11 = -1;
1236 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1250 char *bits =
new char[ww*
hh];
1259 for (
xx = 0;
xx < ww;
xx++) {
1277 (
const char *)bits, ww,
hh);
1286 gv.fClipXOrigin =
x;
1287 gv.fClipYOrigin =
y;
1295 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1296 asimage2drawable(
fgVisual,
wid,
im, (GC)
gc,
xsrc,
ysrc,
x,
y,
wsrc,
hsrc, 1);
1299 unsigned char *bits = (
unsigned char *)
im->alt.argb32;
1304 bits = (
unsigned char *)
img->alt.argb32;
1311 if (
gPad &&
gPad->GetGLDevice() != -1) {
1317 if (!
option.Contains(
"opaque")) {
1373 Error(
"Paint",
"no image set");
1378 Warning(
"Paint",
"Visual not initiated");
1398 Error(
"Paint",
"tile option error");
1406 if (!
fImage->alt.vector) {
1424 Error(
"Paint",
"pad too small to display an image");
1437 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1440 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1452 grad.npoints =
pal.fNumPoints;
1454 grad.color =
new ARGB32[grad.npoints];
1455 grad.offset =
new double[grad.npoints];
1470 delete [] grad.color;
1471 delete [] grad.offset;
1530 Error(
"Paint",
"image could not be rendered to display");
1537 if (!
gROOT->IsBatch()) {
1554 min, max, ndiv,
"+LU");
1560 min, max, ndiv,
"+L");
1573 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1589 min, max, ndiv,
"+L");
1593 Warning(
"Paint",
"PDF not implemented yet");
1622 char *buffer =
nullptr;
1628 if (!params.png.compression)
1629 params.png.compression = -1;
1661 char *buffer =
nullptr;
1667 if (!params.png.compression)
1668 params.png.compression = -1;
1698 min, max, ndiv,
"+L");
1720 if (px1 < px2) {
pxl = px1;
pxt = px2;}
1721 else {
pxl = px2;
pxt = px1;}
1722 if (py1 < py2) {
pyl = py1;
pyt = py2;}
1723 else {
pyl = py2;
pyt = py1;}
1736 static std::unique_ptr<TBox>
ZoomBox;
1741 gPad->ExecuteEvent(event, px, py);
1771 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1772 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1773 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1774 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1847 static char info[64];
1853 px -=
gPad->XtoAbsPixel(0);
1854 py -=
gPad->YtoAbsPixel(1);
1857 if (px < 0 || py < 0)
return info;
1861 if (px >= (
int)
image->width || py >= (
int)
image->height)
1864 py =
image->height - 1 - py;
1871 if (
fImage->alt.vector) {
1891 Warning(
"SetPalette",
"Visual not initiated");
1896 Warning(
"SetPalette",
"Image not valid");
1925 for (
Int_t col = 0; col < 4; col++)
1945 Warning(
"Scale",
"Image not initiated");
1950 Warning(
"Scale",
"Visual not initiated");
1980 Warning(
"Scale",
"Image not initiated");
1985 Warning(
"Scale",
"Visual not initiated");
2015 Warning(
"Tile",
"Image not initiated");
2020 Warning(
"Tile",
"Visual not initiated");
2055 Warning(
"Zoom",
"Image not valid");
2077 Warning(
"UnZoom",
"Image not valid");
2105 Warning(
"Flip",
"Image not valid");
2109 Warning(
"Flip",
"Visual not initiated");
2113 if (
fImage->alt.vector) {
2114 Warning(
"Flip",
"flip does not work for data images");
2152 Warning(
"Mirror",
"Image not valid");
2157 Warning(
"Mirror",
"Visual not initiated");
2161 if (
fImage->alt.vector) {
2162 Warning(
"Mirror",
"mirror does not work for data images");
2259 if (!vis ||
cmap == 0) {
2280 Warning(
"StartPaletteEditor",
"Image not valid");
2283 if (!
fImage->alt.vector) {
2284 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2299 Warning(
"GetPixmap",
"Visual not initiated");
2307 static int x11 = -1;
2308 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2314 if (!
fImage->alt.argb32) {
2333 Warning(
"GetMask",
"Visual not initiated");
2340 Warning(
"GetMask",
"No image");
2353 char *bits =
new char[ww*
hh];
2356 0, 0, ww, 0,
nullptr);
2362 for (
y = 0;
y <
hh;
y++) {
2366 for (
x = 0;
x < ww;
x++) {
2393 Warning(
"SetImage",
"Visual not initiated");
2407 static int x11 = -1;
2408 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2437 Warning(
"GetPixels",
"Wrong Image");
2456 if ((
x >= (
int)
img->width) || (
y >= (
int)
img->height)) {
2460 if ((
int)(
x +
width) > (
int)
img->width) {
2469 img->width,
height,
nullptr)) ==
nullptr) {
2470 Warning(
"GetPixels",
"Failed to create image decoder");
2507 Warning(
"GetVecArray",
"Bad Image");
2510 if (
fImage->alt.vector) {
2511 return fImage->alt.vector;
2529 Warning(
"GetArray",
"Bad Image");
2535 if (
fImage->alt.vector) {
2552 img->width, 0,
nullptr)) ==
nullptr) {
2553 Warning(
"GetArray",
"Failed to create image decoder");
2562 for (
UInt_t k = 0; k <
h; k++) {
2565 for (
UInt_t i = 0; i <
w; ++i) {
2566 if ((
r ==
imdec->buffer.red[i]) &&
2567 (
g ==
imdec->buffer.green[i]) &&
2568 (
b ==
imdec->buffer.blue[i])) {
2570 r =
imdec->buffer.red[i];
2571 g =
imdec->buffer.green[i];
2572 b =
imdec->buffer.blue[i];
2576 ret->AddAt(
v, (
h-k-1)*
w + i);
2603 const char *color,
const char *font_name,
2613 Warning(
"DrawText",
"Visual not initiated");
2621 if (
fn.Last(
'/') == 0)
fn =
fn(1,
fn.Length() - 1);
2629 if (
fn.EndsWith(
".pfa") ||
fn.EndsWith(
".PFA") ||
fn.EndsWith(
".pfb") ||
fn.EndsWith(
".PFB") ||
fn.EndsWith(
".ttf") ||
fn.EndsWith(
".TTF") ||
fn.EndsWith(
".otf") ||
fn.EndsWith(
".OTF")) {
2647 Warning(
"DrawText",
"cannot create Font Manager");
2656 Warning(
"DrawText",
"cannot find a font %s", font_name);
2675 if ((tmp->width !=
width) || (tmp->height !=
height)) {
2700 layers[0].im =
rimg;
2701 layers[0].dst_x = 0;
2702 layers[0].dst_y = 0;
2703 layers[0].clip_width =
rimg->width;
2704 layers[0].clip_height =
rimg->height;
2705 layers[0].bevel =
nullptr;
2707 layers[1].dst_x =
x;
2708 layers[1].dst_y =
y;
2709 layers[1].clip_width =
fore_im->width;
2710 layers[1].clip_height =
fore_im->height;
2748 Warning(
"Merge",
"Visual not initiated");
2757 layers[0].dst_x = 0;
2758 layers[0].dst_y = 0;
2759 layers[0].clip_width =
fImage->width;
2760 layers[0].clip_height =
fImage->height;
2761 layers[0].bevel =
nullptr;
2763 layers[1].dst_x =
x;
2764 layers[1].dst_y =
y;
2765 layers[1].clip_width =
im->GetWidth();
2766 layers[1].clip_height =
im->GetHeight();
2785 Warning(
"Blur",
"Visual not initiated");
2793 Warning(
"Blur",
"Failed to create image");
2814 Warning(
"Clone",
"Image not initiated");
2821 Warning(
"Clone",
"Failed to create image");
2837 if (
fImage->alt.argb32) {
2860 Warning(
"Vectorize",
"Visual not initiated");
2868 Warning(
"Vectorize",
"Failed to create image");
2879 dither = dither > 7 ? 7 : dither;
2913 v = (
v>>12) & 0x0FFF;
2916 pal->fColorRed[
j] =
cmap.entries[
j].red << 8;
2917 pal->fColorGreen[
j] =
cmap.entries[
j].green << 8;
2918 pal->fColorBlue[
j] =
cmap.entries[
j].blue << 8;
2919 pal->fColorAlpha[
j] = 0xFF00;
2974 Warning(
"HSV",
"Visual not initiated");
2982 Warning(
"HSV",
"Failed to create image");
3002 Warning(
"HSV",
"Failed to create rendered image");
3040 Warning(
"Gradient",
"Visual not initiated");
3054 if ((
angle > 2 * 180 * 15 / 16) || (
angle < 2 * 180 * 1 / 16)) {
3056 }
else if (
angle < 2 * 180 * 3 / 16) {
3058 }
else if (
angle < 2 * 180 * 5 / 16) {
3060 }
else if (
angle < 2 * 180 * 7 / 16) {
3062 }
else if (
angle < 2 * 180 * 9 / 16) {
3064 }
else if (
angle < 2 * 180 * 11 / 16) {
3066 }
else if (
angle < 2 * 180 * 13 / 16) {
3081 for (
p = (
char*)offsets;
isspace((
int)*
p);
p++) { }
3102 gradient.offset =
new double[
npoints1];
3119 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black",
pb);
3124 for (
p = (
char*)offsets;
isspace((
int)*
p);
p++) { }
3150 for (i = 0; i < gradient.npoints/2; i++) {
3151 int i2 = gradient.npoints - 1 - i;
3153 double o = gradient.offset[i];
3154 gradient.color[i] = gradient.color[
i2];
3155 gradient.color[
i2] =
c;
3156 gradient.offset[i] = gradient.offset[
i2];
3157 gradient.offset[
i2] = o;
3159 for (i = 0; i < gradient.npoints; i++) {
3160 gradient.offset[i] = 1.0 - gradient.offset[i];
3166 delete [] gradient.color;
3167 delete [] gradient.offset;
3171 Warning(
"Gradient",
"Failed to create gradient image");
3184 layers[0].dst_x = 0;
3185 layers[0].dst_y = 0;
3186 layers[0].clip_width =
fImage->width;
3187 layers[0].clip_height =
fImage->height;
3188 layers[0].bevel =
nullptr;
3190 layers[1].dst_x =
x;
3191 layers[1].dst_y =
y;
3192 layers[1].clip_width =
width;
3193 layers[1].clip_height =
height;
3199 Warning(
"Gradient",
"Failed to create merged image");
3218 cmp = (cmp * 12) / 10;
3220 return (cmp > 255) ? 255 : cmp;
3281 Warning(
"Bevel",
"Visual not initiated");
3295 bevel.hi_color = lo;
3300 bevel.lo_color = lo;
3309 if (
bevel.top_outline > 1) {
3313 if (
bevel.left_outline > 1) {
3317 if (
bevel.right_outline > 1) {
3318 bevel.right_inline +=
bevel.right_outline - 1;
3321 if (
bevel.bottom_outline > 1) {
3322 bevel.bottom_inline +=
bevel.bottom_outline - 1;
3326 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ?
bevel.hilo_color : (
bevel.hilo_color | 0xff000000);
3332 Warning(
"Bevel",
"Failed to create image");
3348 layers[0].dst_x = 0;
3349 layers[0].dst_y = 0;
3350 layers[0].clip_width =
fImage->width;
3351 layers[0].clip_height =
fImage->height;
3352 layers[0].bevel =
nullptr;
3359 Warning(
"Bevel",
"Failed to create bevel image");
3366 layers[1].dst_x =
x;
3367 layers[1].dst_y =
y;
3368 layers[1].clip_width =
width;
3369 layers[1].clip_height =
height;
3370 layers[1].bevel = &
bevel;
3378 Warning(
"Bevel",
"Failed to image");
3398 Warning(
"Pad",
"Visual not initiated");
3406 Warning(
"Pad",
"Failed to create image");
3425 Warning(
"Pad",
"Failed to create output image");
3442 Warning(
"Crop",
"Visual not initiated");
3458 Warning(
"Crop",
"input size larger than image");
3465 Warning(
"Crop",
"Failed to start image decoding");
3473 Warning(
"Crop",
"Failed to create image");
3481 Warning(
"Crop",
"Failed to start image output");
3521 Warning(
"Append",
"Visual not initiated");
3537 Pad(color, 0,
im->GetWidth(), 0, 0);
3539 }
else if (opt ==
"/") {
3540 Pad(color, 0, 0, 0,
im->GetHeight());
3560 Warning(
"BeginPaint",
"Visual not initiated");
3578 Warning(
"BeginPaint",
"Failed to create image");
3592 Warning(
"EndPaint",
"no image");
3596 if (!
fImage->alt.argb32)
return;
3602 Warning(
"EndPaint",
"Failed to create image");
3619 Warning(
"GetArgbArray",
"no image");
3624 if (!
img)
return nullptr;
3626 if (!
img->alt.argb32) {
3647 Warning(
"GetRgbaArray",
"no image");
3652 if (!
img)
return nullptr;
3654 if (!
img->alt.argb32) {
3671 for (i = 0; i <
img->height; i++) {
3672 for (
j = 0;
j <
img->width;
j++) {
3692 Warning(
"GetScanline",
"no image");
3700 0,
y,
img->width, 1,
nullptr);
3704 Warning(
"GetScanline",
"Failed to start image decoding");
3729#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3730#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3731 "movl %1,%%edi \n" \
3732 "movl %2,%%ecx \n" \
3737 :"g" (val), "g" (dst), "g" (lng) \
3738 :"eax","edi","ecx" \
3742 #define _MEMSET_(dst, lng, val) do {\
3743 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3747#define FillSpansInternal(npt, ppt, widths, color) do {\
3748 UInt_t yy = ppt[0].fY*fImage->width;\
3749 for (UInt_t i = 0; i < npt; i++) {\
3750 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3751 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3763 Warning(
"FillRectangle",
"Visual not initiated");
3768 Warning(
"FillRectangle",
"no image");
3772 if (!
fImage->alt.argb32) {
3776 if (!
fImage->alt.argb32) {
3777 Warning(
"FillRectangle",
"Failed to get pixel array");
3803 if (!
fImage->alt.argb32) {
3840 Warning(
"Fill",
"Visual not initiated");
3956 Warning(
"DrawLine",
"Visual not initiated");
3961 Warning(
"DrawLine",
"no image");
3965 if (!
fImage->alt.argb32) {
3969 if (!
fImage->alt.argb32) {
3970 Warning(
"DrawLine",
"Failed to get pixel array");
3979 if (!
dx && !
dy)
return;
4109 Warning(
"DrawRectangle",
"Visual not initiated");
4121 if (!
fImage->alt.argb32) {
4125 if (!
fImage->alt.argb32) {
4126 Warning(
"DrawRectangle",
"Failed to get pixel array");
4220 x2 =
x2 < tmp ? tmp :
x2;
4273 y2 =
y2 < tmp ? tmp :
y2;
4352 if ((
iDash%2) == 0) {
4376 if ((
iDash%2) == 0) {
4430 if ((
iDash%2) == 0) {
4456 if ((
iDash%2) == 0) {
4544 if ((
iDash%2) == 0) {
4563 if ((
iDash%2) == 0) {
4603 if ((
iDash%2) == 0) {
4622 if ((
iDash%2) == 0) {
4650 Warning(
"DrawDashLine",
"Visual not initiated");
4655 Warning(
"DrawDashLine",
"no image");
4659 if (!
fImage->alt.argb32) {
4663 if (!
fImage->alt.argb32) {
4664 Warning(
"DrawDashLine",
"Failed to get pixel array");
4678 }
else if (
y1 ==
y2) {
4717 Warning(
"PutPixel",
"Visual not initiated");
4722 Warning(
"PutPixel",
"no image");
4726 if (!
fImage->alt.argb32) {
4730 if (!
fImage->alt.argb32) {
4731 Warning(
"PutPixel",
"Failed to get pixel array");
4738 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4739 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4752 Warning(
"PolyPoint",
"Visual not initiated");
4757 Warning(
"PolyPoint",
"no image");
4761 if (!
fImage->alt.argb32) {
4765 if (!
fImage->alt.argb32) {
4766 Warning(
"PolyPoint",
"Failed to get pixel array");
4771 Warning(
"PolyPoint",
"No points specified");
4784 for (i = 0; i <
npt; i++) {
4791 for (i = 0; i <
npt; i++) {
4795 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4812 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx",
nseg, (
size_t)
seg);
4819 pt[0].fX =
seg->fX1;
4820 pt[1].fX =
seg->fX2;
4821 pt[0].fY =
seg->fY1;
4822 pt[1].fY =
seg->fY2;
4836 Warning(
"FillSpans",
"Visual not initiated");
4841 Warning(
"FillSpans",
"no image");
4845 if (!
fImage->alt.argb32) {
4849 if (!
fImage->alt.argb32) {
4850 Warning(
"FillSpans",
"Failed to get pixel array");
4855 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4894 Warning(
"FillSpans",
"Visual not initiated");
4899 Warning(
"FillSpans",
"no image");
4903 if (!
fImage->alt.argb32) {
4907 if (!
fImage->alt.argb32) {
4908 Warning(
"FillSpans",
"Failed to get pixel array");
4913 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4948 Warning(
"CropSpans",
"Visual not initiated");
4953 Warning(
"CropSpans",
"no image");
4957 if (!
fImage->alt.argb32) {
4961 if (!
fImage->alt.argb32) {
4962 Warning(
"CropSpans",
"Failed to get pixel array");
4967 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx",
npt, (
size_t)
ppt, (
size_t)
widths);
4983 if (idx <
sz)
fImage->alt.argb32[idx] = 0;
4988 for (i = 0; i <
npt; i++) {
4991 if (idx <
sz)
fImage->alt.argb32[idx] = 0;
4995 if (idx <
sz)
fImage->alt.argb32[idx] = 0;
5003 if (idx <
sz)
fImage->alt.argb32[idx] = 0;
5037 Warning(
"CopyArea",
"Visual not initiated");
5042 Warning(
"CopyArea",
"no image");
5062 if (!
fImage->alt.argb32) {
5065 if (!out->alt.argb32) {
5070 if (
fImage->alt.argb32 && out->alt.argb32) {
5071 for (
y = 0;
y < (
int)
h;
y++) {
5072 for (
x = 0;
x < (
int)
w;
x++) {
5075 (
x +
xdst >= (
int)out->width) || (
y +
ydst >= (
int)out->height) )
continue;
5081 out->alt.argb32[
idx2] = 0;
5084 out->alt.argb32[
idx2] &=
fImage->alt.argb32[idx];
5090 out->alt.argb32[
idx2] &=
~fImage->alt.argb32[idx];
5095 out->alt.argb32[
idx2] ^=
fImage->alt.argb32[idx];
5098 out->alt.argb32[
idx2] |=
fImage->alt.argb32[idx];
5101 out->alt.argb32[
idx2] = (
~fImage->alt.argb32[idx]) & (~out->alt.argb32[
idx2]);
5104 out->alt.argb32[
idx2] ^=
~fImage->alt.argb32[idx];
5116 out->alt.argb32[
idx2] |=
~fImage->alt.argb32[idx];
5119 out->alt.argb32[
idx2] = (
~fImage->alt.argb32[idx]) | (~out->alt.argb32[
idx2]);
5122 out->alt.argb32[
idx2] = 0xFFFFFFFF;
5126 out->alt.argb32[
idx2] =
fImage->alt.argb32[idx];
5150 int i,
j, ix, iy,
w,
h;
5152 ARGB32 color = 0xFFFFFFFF;
5159 for (i = 0; i <
nx; i++) {
5161 for (
j = 0;
j <
ny;
j++) {
5163 if (
icol != color) {
5233 int mr = 0,
m1r = 0;
5253 Warning(
"GetPolygonSpans",
"Visual not initiated");
5258 Warning(
"GetPolygonSpans",
"no image");
5262 if (!
fImage->alt.argb32) {
5266 if (!
fImage->alt.argb32) {
5267 Warning(
"GetPolygonSpans",
"Failed to get pixel array");
5272 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%zx",
npt, (
size_t)
ppt);
5356 }
while (
y !=
ymax);
5381 if (!
stipple && ((color & 0xff000000)==0xff000000)) {
5455 Warning(
"DrawFillArea",
"Visual not initiated");
5460 Warning(
"DrawFillArea",
"no image");
5464 if (!
fImage->alt.argb32) {
5468 if (!
fImage->alt.argb32) {
5469 Warning(
"DrawFillArea",
"Failed to get pixel array");
5473 if ((count < 3) || !
ptsIn) {
5474 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)
ptsIn);
5513 ET.scanlines.next =
nullptr;
5514 ET.ymin =
ET.ymax = 0;
5519 pSLL =
ET.scanlines.next;
5521 for (
y =
ET.ymin;
y <
ET.ymax;
y++) {
5535 *
width++ =
pAET->next->bres.minor_axis -
pAET->bres.minor_axis;
5538 if (!
stipple && ((color & 0xff000000)==0xff000000)) {
5554 if (!
stipple && ((color & 0xff000000)==0xff000000)) {
5571 Warning(
"DrawFillArea",
"Visual not initiated");
5576 Warning(
"DrawFillArea",
"no image");
5580 if (!
fImage->alt.argb32) {
5584 if (!
fImage->alt.argb32) {
5585 Warning(
"DrawFillArea",
"Failed to get pixel array");
5589 if ((count < 3) || !
ptsIn) {
5590 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)
ptsIn);
5616 ET.scanlines.next =
nullptr;
5617 ET.ymin =
ET.ymax = 0;
5622 pSLL =
ET.scanlines.next;
5624 for (
y =
ET.ymin;
y <
ET.ymax;
y++) {
5638 *
width++ =
pAET->next->bres.minor_axis -
pAET->bres.minor_axis;
5664 ctx->canvas_width =
im->width;
5665 ctx->canvas_height =
im->height;
5666 ctx->canvas =
im->alt.argb32;
5667 ctx->scratch_canvas =
nullptr;
5680 if (ctx->scratch_canvas)
free(ctx->scratch_canvas);
5704 for (
int i = 0; i <
sz; i++) {
5756 if ((
byy >= (
int)
fImage->height) || (
byy <0))
continue;
5760 if ((
bxx >= (
int)
fImage->width) || (
bxx < 0))
continue;
5763 r += ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
5764 g += ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
5765 b += (
fImage->alt.argb32[idx] & 0x0000ff);
5775 col[0] = (
r << 16) + (
g << 8) +
b;
5782 for (
x = 3;
x > 0;
x--) {
5812 d = ((
d + 10) * 5) >> 8;
5843 Warning(
"DrawText",
"Visual not initiated");
5847 if (!
fImage->alt.argb32) {
5872 const wchar_t *
wcsTitle =
reinterpret_cast<const wchar_t *
>(
text->GetWcsTitle());
5940 if (align == 1 || align == 2 || align == 3) {
5942 }
else if (align == 4 || align == 5 || align == 6) {
5949 if (align == 3 || align == 6 || align == 9) {
5951 }
else if (align == 2 || align == 5 || align == 8) {
6077 params.gamma_table =
nullptr;
6078 params.compression = 0;
6080 params.search_path =
nullptr;
6081 params.subimage = 0;
6086 char *ptr = buffer[0];
6087 while (
isspace((
int)*ptr)) ++ptr;
6129 static char *buf =
nullptr;
6155 layers[0].dst_x = 0;
6156 layers[0].dst_y = 0;
6157 layers[0].clip_width =
img->width;
6158 layers[0].clip_height =
img->height;
6159 layers[0].bevel =
nullptr;
6161 layers[1].dst_x = 0;
6162 layers[1].dst_y = 0;
6163 layers[1].clip_width =
img->width;
6164 layers[1].clip_height =
img->height;
6207 if (
b.IsReading()) {
6244 char *buffer =
new char[
size];
6245 b.ReadFastArray(buffer,
size);
6274 char *buffer =
nullptr;
6277 b.WriteFastArray(buffer,
size);
6294 if (
fImage->alt.vector) {
6335 if ((start > 0) && (stop - start > 0)) {
6359 for (
int i = 0; i <
sz; i++) {
6399 for (
int i = 0; i <
sz; i++) {
6439 for (
int i = 0; i <
sz; i++) {
6479 for (
int i = 0; i <
sz; i++) {
6519 for (
int i = 0; i <
sz; i++) {
6542 const char * ,
const char * )
6556 Warning(
"Gray",
"Image not initiated");
6561 Warning(
"Gray",
"Visual not initiated");
6586 if (
fImage->alt.argb32) {
6590 for (i = 0; i <
fImage->height; i++) {
6594 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6595 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6596 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6597 l = (57*
r + 181*
g + 18*
b)/256;
6617 Warning(
"ToGray",
"Failed to start image output");
6632 for (i = 0; i <
fImage->height; i++) {
6688 Warning(
"FromWindow",
"Visual not initiated");
6696 static int x11 = -1;
6697 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
6722 for (
UInt_t i = 0; i <
h/2; ++i) {
6753 gPad->Range(-left / (1.0 - left - right),
6754 -bottom / (1.0 - top - bottom),
6755 1 + right / (1.0 - left - right),
6756 1 + top / ( 1.0 - top - bottom));
6757 gPad->RangeAxis(0, 0, 1, 1);
6767 char *buf =
nullptr;
6773 str.ReplaceAll(
"static",
"const");
6777 str.ReplaceAll(
"asxpm",
xpm.Data());
6778 out <<
"\n" << str <<
"\n\n";
6783 out <<
"asimage = TImage::Create();\n";
6784 out <<
" asimage->SetImageBuffer( (char **)" <<
xpm <<
", TImage::kXpm);\n";
6786 out <<
" asimage->Draw();\n";
6799 static char buf[32];
6807 if (!
fread(buf, 1, 20, fp)) {
6812 char dpi1 = (set & 0xffff) >> 8;
6813 char dpi2 = set & 0xff;
6818 for (i = 0; i < 20; i++) {
6819 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6820 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6826 if (i == 20 ||
dpi+4 >= 20) {
6828 printf(
"file %s : wrong JPEG format\n",
name);
6843 fwrite(buf, 1, 20, fp);
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t Window_t
Window handle.
@ kGXorReverse
src OR NOT dst
@ kGXnand
NOT src OR NOT dst.
@ kGXandReverse
src AND NOT dst
@ kGXorInverted
NOT src OR dst.
@ kGXandInverted
NOT src AND dst.
@ kGXequiv
NOT src XOR dst.
@ kGXnor
NOT src AND NOT dst.
@ kGXcopyInverted
NOT src.
Handle_t GContext_t
Graphics context handle.
Handle_t Drawable_t
Drawable handle.
const Mask_t kGCClipYOrigin
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
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 ASFontManager * gFontManager
static void init_icon_paths()
Set icons paths.
#define _MEMSET_(dst, lng, val)
#define FillSpansInternal(npt, ppt, widths, color)
static ASDrawContext * create_draw_context_argb32(ASImage *im, ASDrawTool *brush)
Create draw context.
#define _alphaBlend(bot, top)
static void destroy_asdraw_context32(ASDrawContext *ctx)
Destroy asdraw context32.
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
static int InsertionSort(EdgeTableEntry *AET)
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2)
static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
static void FreeStorage(ScanLineListBlock *pSLLBlock)
static void CreateETandAET(int count, TPoint *pts, EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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)
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths) override
Crop spans.
void Gradient(UInt_t angle=0, const char *colors="#FFFFFF #000000", const char *offsets=nullptr, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Render multipoint gradient inside rectangle of size (width, height) at position (x,...
void Blur(Double_t hr=3, Double_t vr=3) override
Perform Gaussian blur of the image (useful for drop shadows).
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
void StartPaletteEditor() override
Start palette editor.
void Bevel(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0, const char *hi="#ffdddddd", const char *lo="#ff555555", UShort_t thick=1, Bool_t pressed=kFALSE) override
Bevel is used to create 3D effect while drawing buttons, or any other image that needs to be framed.
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
UInt_t GetWidth() const override
Return width of original image not of the displayed image.
Double_t fMinValue
! min value in image
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col="#000000", Int_t thick=1) override
Draw an ellipse.
void Paint(Option_t *option="") override
Paint image.
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
void SetPaletteEnabled(Bool_t on=kTRUE) override
Switch on/off the image palette.
static Bool_t fgInit
global flag to init afterimage only once
const char * GetTitle() const override
Title is used to keep 32x32 xpm image's thumbnail.
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h) override
Creates an image (screenshot) from a RGBA buffer.
void HSV(UInt_t hue=0, UInt_t radius=360, Int_t H=0, Int_t S=0, Int_t V=0, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
This function will tile original image to specified size with offsets requested, and then it will go ...
void Tile(UInt_t width, UInt_t height) override
Tile the original image.
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Write image to specified file.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Is the mouse in the image ?
char * GetObjectInfo(Int_t px, Int_t py) const override
Get image pixel coordinates and the pixel value at the mouse pointer.
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col="#000000", UInt_t thick=1) override
Draw a line.
Double_t fMaxValue
! max value in image
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height) override
The area of an image displayed in a pad is defined by this function.
UInt_t fZoomWidth
! width of zoomed image in image pixels
Bool_t fEditable
! kTRUE image can be resized, moved by resizing/moving gPad
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 DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=nullptr) override
Flood fill.
TASImage * fScaledImage
! temporary scaled and zoomed image produced from original image
Bool_t IsEditable() const override
UInt_t fZoomOffX
! X - offset for zooming in image pixels
void ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Read specified image file.
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng) override
Return in-memory buffer compressed according image type.
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd, UInt_t toWidth, UInt_t toHeight) override
Another method of enlarging images where corners remain unchanged, but middle part gets tiled.
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette=nullptr) override
Deletes the old image and creates a new image depending on the values of imageData.
void DrawTextTTF(Int_t x, Int_t y, const char *text, Int_t size, UInt_t color, const char *font_name, Float_t angle)
Draw text using TrueType fonts.
void PutPixel(Int_t x, Int_t y, const char *col="#000000") override
Draw a point at the specified position.
void Browse(TBrowser *) override
Browse image.
void DrawDashZTLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed line with thick pixel width.
void DestroyImage()
Destroy image.
static Bool_t InitVisual()
Static function to initialize the ASVisual.
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
void UnZoom() override
Un-zoom the image to original size.
void Streamer(TBuffer &) override
Streamer for ROOT I/O.
TArrayL * GetPixels(Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Return 2D array of machine dependent pixel values.
void PaintImage(Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="") override
Draw image on the drawable wid (pixmap, window) at x,y position.
ASImage * fGrayImage
! gray image
void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed vertical line.
void SetTitle(const char *title="") override
Set a title for an image.
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col="#000000", UInt_t thick=1) override
Draw a rectangle.
void Append(const TImage *im, const char *option="+", const char *color="#00000000") override
Append image.
void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed horizontal line.
void DrawDashLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, const char *col="#000000", UInt_t thick=1) override
Draw a dashed line.
void SetPalette(const TImagePalette *palette) override
Set a new palette to an image.
void Scale(UInt_t width, UInt_t height) override
Scale the original image.
TASImage()
Default image constructor.
TASImage & operator=(const TASImage &img)
Image assignment operator.
void Mirror(Bool_t vert=kTRUE) override
Mirror image in place.
void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col)
Draw a dashed line with one pixel width.
void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1) override
Draw segments.
Pixmap_t GetPixmap() override
Returns image pixmap.
void FromWindow(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Create an image (screenshot) from specified window.
TArrayD * GetArray(UInt_t w=0, UInt_t h=0, TImagePalette *pal=gWebImagePalette) override
In case of vectorized image return an associated array of doubles otherwise this method creates and r...
void Flip(Int_t flip=180) override
Flip image in place.
Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth)
The code is based on Xserver/mi/mipolycon.c "Copyright 1987, 1998 The Open Group".
void Crop(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Crop an image.
void EndPaint() override
EndPaint does internal RLE compression of image data.
void BeginPaint(Bool_t fast=kTRUE) override
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
static ASVisual * fgVisual
pointer to visual structure
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).
Array of longs (32 or 64 bits per element).
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Bool_t fConstRatio
keep aspect ratio of image on the screen
EImageQuality GetImageQuality() const
Bool_t GetConstRatio() const
virtual const TImagePalette & GetPalette() const
TImagePalette fPalette
color palette for value -> color conversion
virtual void Streamer(TBuffer &)
UInt_t GetImageCompression() const
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
virtual void 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.
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.
Save canvas as an image (GIF, JPEG, PNG, XPM, TIFF etc.).
A class to define a conversion from pixel values to pixel color.
An abstract interface to image processing library.
void Streamer(TBuffer &) override
Stream an object of class TObject.
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)
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.
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)
const char * Data() const
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 * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
TTF helper class containing glyphs description.
static Bool_t IsInitialized()
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
static void Init()
Initialise the TrueType fonts interface.
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
static void SetTextFont(Font_t fontnumber)
Set specified font.
static TTGlyph * GetGlyphs()
static Int_t GetNumGlyphs()
static const FT_BBox & GetBox()
static void SetTextSize(Float_t textsize)
Set current text size.
static FT_Matrix * GetRotMatrix()
Base class for several text objects.
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual void CellArrayEnd()=0
virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)=0
virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)=0
virtual void * GetStream() const
virtual void Open(const char *filename, Int_t type=-111)=0
virtual void CellArrayPng(char *, int)
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 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.
Used for drawing line segments (maps to the X11 XSegments structure)