61# include FT_FREETYPE_H
88#include "RConfigure.h"
97# include "Windows4root.h"
101# define X_DISPLAY_MISSING 1
103# include <afterbase.h>
105# include <win32/config.h>
106# include <win32/afterbase.h>
107# define X_DISPLAY_MISSING 1
109# include <afterimage.h>
134#if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER
135#pragma GCC diagnostic ignored "-Wstrict-aliasing"
156#define _alphaBlend(bot, top) {\
157 __argb32__ *T = (__argb32__*)(top);\
158 __argb32__ *B = (__argb32__*)(bot);\
163 B->a = ((B->a*aa)>>8) + T->a;\
164 B->r = (B->r*aa + T->r*T->a)>>8;\
165 B->g = (B->g*aa + T->g*T->a)>>8;\
166 B->b = (B->b*aa + T->b*T->a)>>8;\
233 fImage = create_asimage(w ? w : 20,
h ?
h : 20, 0);
300 if (img.
fImage->alt.vector) {
321 if (
this != &img && img.
IsValid()) {
330 if (img.
fImage->alt.vector) {
380 const char *delim =
":";
382 const char *delim =
";";
384 while (icon_path.
Tokenize(token, from, delim) && cnt < 6) {
400 FILE *fp = fopen(
file,
"rb");
401 const char *ret =
"";
405 if (!fread(&magic, 1, 1, fp)) {
413 if (!fread(&magic, 1, 1, fp)) {
417 if (!fread(&magic, 1, 1, fp)) {
422 ret = (magic == 1) ?
"ico" :
"cur";
427 if (!fread(&magic, 1, 1, fp)) {
432 if (magic == 0x21) ret =
"ps";
433 else if (magic == 0x50) ret =
"pdf";
483 Warning(
"Scale",
"Visual not initiated");
487 Bool_t xpm = filename && (filename[0] ==
'/' &&
488 filename[1] ==
'*') && filename[2] ==
' ';
500 set_output_threshold(0);
502 static ASImageImportParams iparams;
506 iparams.filter = SCL_DO_ALL;
507 iparams.gamma = SCREEN_GAMMA;
508 iparams.gamma_table = NULL;
510 iparams.format = ASA_ASImage;
512 iparams.subimage = 0;
513 iparams.return_animation_delay = -1;
517 if (filename) dot = strrchr(filename,
'.');
530 iparams.subimage = ext.
Atoi();
532 ext = strrchr(fname.
Data(),
'.') + 1;
535 image = file2ASImage_extra(fname.
Data(), &iparams);
547 unsigned char *bitmap = 0;
553 if (!handler || ((handler->
LoadPlugin() == -1))) {
572 image = bitmap2asimage(bitmap, w,
h, 0, 0);
652 Error(
"WriteImage",
"no image loaded");
657 Error(
"WriteImage",
"no file name specified");
662 if ((s = strrchr(
file,
'.'))) {
666 Error(
"WriteImage",
"cannot determine a valid file type");
674 Error(
"WriteImage",
"not a valid file type was specified");
680 ASImageFileTypes atype = (ASImageFileTypes)mytype;
688 static ASImageExportParams parms;
693 parms.xpm.type = atype;
694 parms.xpm.flags = EXPORT_ALPHA;
695 parms.xpm.dither = 4;
696 parms.xpm.opaque_threshold = 127;
697 parms.xpm.max_colors = 512;
700 ASImage2bmp(im, fname.
Data(), 0);
703 ASImage2xcf(im, fname.
Data(), 0);
706 parms.png.type = atype;
707 parms.png.flags = EXPORT_ALPHA;
711 parms.jpeg.type = atype;
712 parms.jpeg.flags = 0;
713 parms.jpeg.quality = aquality;
716 parms.gif.type = atype;
717 parms.gif.flags = EXPORT_ALPHA;
718 parms.gif.dither = 0;
719 parms.gif.opaque_threshold = 0;
723 parms.gif.type = atype;
724 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
725 parms.gif.dither = 0;
726 parms.gif.opaque_threshold = 0;
727 parms.gif.animate_repeats = 0;
740 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
741 parms.gif.animate_repeats = 0;
742 }
else if(sufix==
"") {
759 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
760 parms.gif.animate_repeats = atoi(s);
769 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
770 parms.gif.animate_repeats = 0;
771 }
else if(sLength>3 && sufix.
CountChar(
'+')==2 &&
TString(sufix(1,sLength-2)).Contains(
"++")) {
777 delay = atoi(sDelay);
778 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
779 parms.gif.animate_repeats = atoi(sRepeats);
781 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
785 parms.gif.animate_delay = delay;
787 int i1 = fname.
Index(
"gif+");
789 fname = fname(0, i1 + 3);
792 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
798 parms.tiff.type = atype;
799 parms.tiff.flags = EXPORT_ALPHA;
800 parms.tiff.rows_per_strip = 0;
801 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
802 TIFF_COMPRESSION_NONE;
803 parms.tiff.jpeg_quality = 100;
804 parms.tiff.opaque_threshold = 0;
807 Error(
"WriteImage",
"file type %s not yet supported", s);
811 if (!ASImage2file(im, 0, fname.
Data(), atype, &parms)) {
812 Error(
"WriteImage",
"error writing file %s",
file);
830 if (s ==
"jpg" || s ==
"jpeg")
869 astype = ASIT_Xpm;
break;
871 astype = ASIT_ZCompressedXpm;
break;
873 astype = ASIT_GZCompressedXpm;
break;
875 astype = ASIT_Png;
break;
877 astype = ASIT_Jpeg;
break;
879 astype = ASIT_Xcf;
break;
881 astype = ASIT_Ppm;
break;
883 astype = ASIT_Pnm;
break;
885 astype = ASIT_Bmp;
break;
887 astype = ASIT_Ico;
break;
889 astype = ASIT_Cur;
break;
891 astype = ASIT_Gif;
break;
893 astype = ASIT_Gif;
break;
895 astype = ASIT_Tiff;
break;
897 astype = ASIT_Xbm;
break;
899 astype = ASIT_Targa;
break;
901 astype = ASIT_XMLScript;
break;
903 astype = ASIT_Unknown;
909 case ASIT_ZCompressedXpm:
911 case ASIT_GZCompressedXpm:
954 asquality = 25;
break;
956 asquality = 75;
break;
958 asquality = 50;
break;
960 asquality = 100;
break;
966 if (asquality > 0 && asquality <= 25)
968 if (asquality > 26 && asquality <= 50)
970 if (asquality > 51 && asquality <= 75)
972 if (asquality > 76 && asquality <= 100)
992 Warning(
"SetImage",
"Visual not initiated");
1010 ASVectorPalette asPalette;
1014 for (col = 0; col < 4; col++)
1015 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1022 asPalette.points =
new Double_t[asPalette.npoints];
1023 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1027 height, &asPalette, ASA_ASImage,
1030 delete [] asPalette.points;
1031 for (col = 0; col < 4; col++)
1032 delete [] asPalette.channels[col];
1076 Error(
"FromPad",
"pad cannot be 0");
1081 Warning(
"FromPad",
"Visual not initiated");
1091 if (
gROOT->IsBatch()) {
1099 if (itmp && itmp->
fImage) {
1108 if (itmp && itmp->
fImage && (itmp !=
this)) {
1110 if (itmp->
fImage->alt.argb32) {
1112 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1113 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1140 static int x11 = -1;
1141 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1146 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0, w,
h);
1151 fImage = bitmap2asimage(bits, w,
h, 0, 0);
1172 Error(
"Draw",
"no image set");
1185 w =
Int_t(w*cx) + 4;
1190 rname =
"new TCanvas(\"" + rname +
Form(
"\", %d, %d);", w,
h);
1200 gPad->Range(-left / (1.0 - left - right),
1201 -bottom / (1.0 - top - bottom),
1202 1 + right / (1.0 - left - right),
1203 1 + top / ( 1.0 - top - bottom));
1204 gPad->RangeAxis(0, 0, 1, 1);
1227 wsrc = wsrc ? wsrc : im->width;
1228 hsrc = hsrc ? hsrc : im->height;
1230 static int x11 = -1;
1231 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1238 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1245 char *bits =
new char[ww*hh];
1247 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1248 xsrc, ysrc, ww, 0, 0);
1250 for (yy = 0; yy < hh; yy++) {
1251 imdec->decode_image_scanline(imdec);
1252 CARD32 *
a = imdec->buffer.alpha;
1254 for (xx = 0; xx < ww; xx++) {
1269 stop_image_decoding(&imdec);
1272 (
const char *)bits, ww, hh);
1290 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1291 asimage2drawable(
fgVisual, wid, im, (GC)gc, xsrc, ysrc,
x,
y, wsrc, hsrc, 1);
1294 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1296 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1297 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1299 bits = (
unsigned char *)img->alt.argb32;
1306 if (
gPad &&
gPad->GetGLDevice() != -1) {
1308 painter->DrawPixels(bits, wsrc, hsrc,
x,
y, !option.
Contains(
"opaque"));
1316 gVirtualX->CopyArea(pic, wid, gc, 0, 0, wsrc, hsrc,
x,
y);
1323 destroy_asimage(&img);
1347 xsrc, ysrc, wsrc, hsrc, opt);
1366 Error(
"Paint",
"no image set");
1371 Warning(
"Paint",
"Visual not initiated");
1375 Int_t tile_x = 0, tile_y = 0;
1376 CARD32 tile_tint = 0;
1385 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1388 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1391 Error(
"Paint",
"tile option error");
1399 if (!
fImage->alt.vector) {
1412 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1413 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1416 if ((to_w < 25 || to_h < 25) && !expand) {
1417 Error(
"Paint",
"pad too small to display an image");
1429 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1430 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1432 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1433 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1438 ASImage *grad_im = 0;
1446 grad.type = GRADIENT_Top2Bottom;
1447 grad.color =
new ARGB32[grad.npoints];
1448 grad.offset =
new double[grad.npoints];
1451 Int_t oldPt = grad.npoints -
pt -1;
1452 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1453 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1455 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1456 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1460 pal_h, SCL_DO_COLOR,
1463 delete [] grad.color;
1464 delete [] grad.offset;
1472 to_w, to_h, tile_tint, ASA_ASImage,
1499 ASImage *tmpImage = 0;
1510 destroy_asimage(&tmpImage);
1525 Error(
"Paint",
"image could not be rendered to display");
1529 int tox = expand ? 0 :
int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1530 int toy = expand ? 0 :
int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1532 if (!
gROOT->IsBatch()) {
1547 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1548 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1549 min, max, ndiv,
"+LU");
1554 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1555 min, max, ndiv,
"+L");
1565 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1570 dump->
Merge(&tgrad,
"alphablend", pal_Ax, pal_Ay);
1580 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1581 min, max, ndiv,
"+L");
1585 Warning(
"Paint",
"PDF not implemented yet");
1588 Warning(
"Paint",
"SVG not implemented yet");
1597 color =
new TColor(
colors->GetEntries(), 1., 1., 1.,
"Image_PS");
1608 x2 =
x1+dx/image->width;
1610 y2 = y1+dy/image->height;
1613 x2 =
x1+(dx*(1-
gPad->GetRightMargin()-
gPad->GetLeftMargin()))/image->width;
1614 y1 =
gPad->GetY2()-dy*
gPad->GetTopMargin();
1615 y2 = y1+(dy*(1-
gPad->GetTopMargin()-
gPad->GetBottomMargin()))/image->height;
1620 ASImageDecoder *imdec = start_image_decoding(
fgVisual, image, SCL_DO_ALL,
1621 0, 0, image->width, image->height, 0);
1623 for (
Int_t yt = 0; yt < (
Int_t)image->height; yt++) {
1624 imdec->decode_image_scanline(imdec);
1625 for (
Int_t xt = 0; xt < (
Int_t)image->width; xt++)
1627 imdec->buffer.green[xt],
1628 imdec->buffer.blue[xt]);
1630 stop_image_decoding(&imdec);
1635 Double_t xconv = (
gPad->AbsPixeltoX(pal_Ax + pal_w) -
gPad->AbsPixeltoX(pal_Ax)) / grad_im->width;
1636 Double_t yconv = (
gPad->AbsPixeltoY(pal_Ay - pal_h) -
gPad->AbsPixeltoY(pal_Ay)) / grad_im->height;
1637 x1 =
gPad->AbsPixeltoX(pal_Ax);
1639 y2 =
gPad->AbsPixeltoY(pal_Ay);
1644 imdec = start_image_decoding(
fgVisual, grad_im, SCL_DO_ALL,
1645 0, 0, grad_im->width, grad_im->height, 0);
1647 for (
Int_t yt = 0; yt < (
Int_t)grad_im->height; yt++) {
1648 imdec->decode_image_scanline(imdec);
1649 for (
Int_t xt = 0; xt < (
Int_t)grad_im->width; xt++)
1651 imdec->buffer.green[xt],
1652 imdec->buffer.blue[xt]);
1655 stop_image_decoding(&imdec);
1666 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1667 min, max, ndiv,
"+L");
1673 destroy_asimage(&grad_im);
1682 Int_t pxl, pyl, pxt, pyt;
1689 if (px1 < px2) {pxl = px1; pxt = px2;}
1690 else {pxl = px2; pxt = px1;}
1691 if (py1 < py2) {pyl = py1; pyt = py2;}
1692 else {pyl = py2; pyt = py1;}
1694 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1705 static TBox *ZoomBox;
1716 static Int_t px1old, py1old, px2old, py2old;
1717 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
1728 if (imgX < 0) px = px - imgX;
1729 if (imgY < 0) py = py - imgY;
1734 if (imgX >= (
int)image->width) px = px - imgX + image->width - 1;
1735 if (imgY >= (
int)image->height) py = py - imgY + image->height - 1;
1740 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1741 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1742 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1743 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1744 px1old = px; py1old = py;
1766 ZoomBox =
new TBox(pxl, pyl, pxt, pyt);
1768 ZoomBox->
Draw(
"l*");
1787 Int_t imgX1 = px1old -
gPad->XtoAbsPixel(0);
1788 Int_t imgY1 = py1old -
gPad->YtoAbsPixel(1);
1789 Int_t imgX2 = px -
gPad->XtoAbsPixel(0);
1790 Int_t imgY2 = py -
gPad->YtoAbsPixel(1);
1792 imgY1 = image->height - 1 - imgY1;
1793 imgY2 = image->height - 1 - imgY2;
1799 Zoom((imgX1 < imgX2) ? imgX1 : imgX2, (imgY1 < imgY2) ? imgY1 : imgY2,
1818 static char info[64];
1824 px -=
gPad->XtoAbsPixel(0);
1825 py -=
gPad->YtoAbsPixel(1);
1828 if (px < 0 || py < 0)
return info;
1832 if (px >= (
int)image->width || py >= (
int)image->height)
1835 py = image->height - 1 - py;
1842 if (
fImage->alt.vector) {
1843 snprintf(info,64,
"x: %d y: %d %.5g",
1846 snprintf(info,64,
"x: %d y: %d", px, py);
1862 Warning(
"SetPalette",
"Visual not initiated");
1867 Warning(
"SetPalette",
"Image not valid");
1871 if (
fImage->alt.vector == 0)
1877 ASVectorPalette asPalette;
1879 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1880 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1881 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1882 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1888 asPalette.points =
new double[asPalette.npoints];
1889 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1895 delete [] asPalette.points;
1896 for (
Int_t col = 0; col < 4; col++)
1897 delete [] asPalette.channels[col];
1916 Warning(
"Scale",
"Image not initiated");
1921 Warning(
"Scale",
"Visual not initiated");
1929 if (toWidth > 30000)
1931 if (toHeight > 30000)
1934 ASImage *img = scale_asimage(
fgVisual,
fImage, toWidth, toHeight,
1951 Warning(
"Scale",
"Image not initiated");
1956 Warning(
"Scale",
"Visual not initiated");
1964 if (toWidth > 30000)
1966 if (toHeight > 30000)
1970 yStart, yEnd, toWidth, toHeight,
1986 Warning(
"Tile",
"Image not initiated");
1991 Warning(
"Tile",
"Visual not initiated");
1999 if (toWidth > 30000)
2001 if (toHeight > 30000)
2004 ASImage *img = tile_asimage(
fgVisual,
fImage, 0, 0, toWidth, toHeight, 0,
2026 Warning(
"Zoom",
"Image not valid");
2048 Warning(
"UnZoom",
"Image not valid");
2076 Warning(
"Flip",
"Image not valid");
2080 Warning(
"Flip",
"Visual not initiated");
2084 if (
fImage->alt.vector) {
2085 Warning(
"Flip",
"flip does not work for data images");
2123 Warning(
"Mirror",
"Image not valid");
2128 Warning(
"Mirror",
"Visual not initiated");
2132 if (
fImage->alt.vector) {
2133 Warning(
"Mirror",
"mirror does not work for data images");
2203 if (inbatch && !noX) {
2214 fgVisual = create_asvisual(0, 0, 0, 0);
2221 fgVisual = create_asvisual(0, 0, 0, 0);
2224 Display *disp = (Display*)
gVirtualX->GetDisplay();
2230 if (vis == 0 || cmap == 0) {
2231 fgVisual = create_asvisual(0, 0, 0, 0);
2233 fgVisual = create_asvisual_for_id(disp, screen, depth,
2234 XVisualIDFromVisual(vis), cmap, 0);
2238 fgVisual = create_asvisual(0, 0, 0, 0);
2251 Warning(
"StartPaletteEditor",
"Image not valid");
2254 if (
fImage->alt.vector == 0) {
2255 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2270 Warning(
"GetPixmap",
"Visual not initiated");
2278 static int x11 = -1;
2279 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2285 if (!
fImage->alt.argb32) {
2288 ret =
gVirtualX->CreatePixmapFromData((
unsigned char*)
fImage->alt.argb32,
2304 Warning(
"GetMask",
"Visual not initiated");
2311 Warning(
"GetMask",
"No image");
2316 UInt_t ow = img->width%8;
2317 UInt_t ww = img->width - ow + (ow ? 8 : 0);
2324 char *bits =
new char[ww*hh];
2326 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALPHA,
2333 for (
y = 0;
y < hh;
y++) {
2334 imdec->decode_image_scanline(imdec);
2335 CARD32 *
a = imdec->buffer.alpha;
2337 for (
x = 0;
x < ww;
x++) {
2351 stop_image_decoding(&imdec);
2352 pxmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), (
const char *)bits,
2364 Warning(
"SetImage",
"Visual not initiated");
2378 static int x11 = -1;
2379 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2384 unsigned char *bits =
gVirtualX->GetColorBits(pxm, 0, 0, w,
h);
2391 fImage = bitmap2asimage(bits, w,
h, 0, 0);
2395 unsigned char *mask_bits =
gVirtualX->GetColorBits(mask, 0, 0, w,
h);
2396 fImage = bitmap2asimage(bits, w,
h, 0, mask_bits);
2397 delete [] mask_bits;
2408 Warning(
"GetPixels",
"Wrong Image");
2413 ASImageDecoder *imdec;
2416 height = !height ? img->height : height;
2427 if ((
x >= (
int)img->width) || (
y >= (
int)img->height)) {
2431 if ((
int)(
x +
width) > (
int)img->width) {
2435 if ((
int)(
y + height) > (
int)img->height) {
2436 height = img->height -
y;
2439 if ((imdec = start_image_decoding(0,
fImage, SCL_DO_ALL, 0,
y,
2440 img->width, height, 0)) == 0) {
2441 Warning(
"GetPixels",
"Failed to create image decoder");
2451 for (
UInt_t k = 0; k < height; k++) {
2452 imdec->decode_image_scanline(imdec);
2455 if ((
r == (
Int_t)imdec->buffer.red[i]) &&
2456 (
g == (
Int_t)imdec->buffer.green[i]) &&
2457 (
b == (
Int_t)imdec->buffer.blue[i])) {
2459 r = (
Int_t)imdec->buffer.red[i];
2460 g = (
Int_t)imdec->buffer.green[i];
2461 b = (
Int_t)imdec->buffer.blue[i];
2468 stop_image_decoding(&imdec);
2480 Warning(
"GetVecArray",
"Bad Image");
2483 if (
fImage->alt.vector) {
2484 return fImage->alt.vector;
2502 Warning(
"GetArray",
"Bad Image");
2508 if (
fImage->alt.vector) {
2513 ASImageDecoder *imdec;
2515 w = w ? w :
fImage->width;
2524 if ((imdec = start_image_decoding(0, img, SCL_DO_ALL, 0, 0,
2525 img->width, 0, 0)) == 0) {
2526 Warning(
"GetArray",
"Failed to create image decoder");
2537 for (
UInt_t k = 0; k <
h; k++) {
2538 imdec->decode_image_scanline(imdec);
2540 for (
UInt_t i = 0; i < w; ++i) {
2541 if ((
r == imdec->buffer.red[i]) &&
2542 (
g == imdec->buffer.green[i]) &&
2543 (
b == imdec->buffer.blue[i])) {
2545 r = imdec->buffer.red[i];
2546 g = imdec->buffer.green[i];
2547 b = imdec->buffer.blue[i];
2555 stop_image_decoding(&imdec);
2578 const char *color,
const char *font_name,
2582 ARGB32 text_color = ARGB32_Black;
2583 ASImage *fore_im = 0;
2584 ASImage *text_im = 0;
2588 Warning(
"DrawText",
"Visual not initiated");
2596 if (fn.
Last(
'/') == 0) fn = fn(1, fn.
Length() - 1);
2609 parse_argb_color(color, &text_color);
2622 Warning(
"DrawText",
"cannot create Font Manager");
2631 Warning(
"DrawText",
"cannot find a font %s", font_name);
2636 get_text_size(
text, font, (ASText3DType)
type, &
width, &height);
2643 text_im = draw_text(
text, font, (ASText3DType)
type, 0);
2648 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2650 if ((tmp->width !=
width) || (tmp->height != height)) {
2651 fore_im = tile_asimage(
fgVisual, tmp, 0, 0,
width, height, 0,
2654 destroy_asimage(&tmp);
2661 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2662 destroy_asimage(&text_im);
2670 ASImage *rendered_im;
2671 ASImageLayer layers[2];
2673 init_image_layers(&(layers[0]), 2);
2674 fore_im->back_color = text_color;
2675 layers[0].im = rimg;
2676 layers[0].dst_x = 0;
2677 layers[0].dst_y = 0;
2678 layers[0].clip_width = rimg->width;
2679 layers[0].clip_height = rimg->height;
2680 layers[0].bevel = 0;
2681 layers[1].im = fore_im;
2682 layers[1].dst_x =
x;
2683 layers[1].dst_y =
y;
2684 layers[1].clip_width = fore_im->width;
2685 layers[1].clip_height = fore_im->height;
2687 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2690 destroy_asimage(&fore_im);
2723 Warning(
"Merge",
"Visual not initiated");
2727 ASImage *rendered_im;
2728 ASImageLayer layers[2];
2730 init_image_layers(&(layers[0]), 2);
2732 layers[0].dst_x = 0;
2733 layers[0].dst_y = 0;
2734 layers[0].clip_width =
fImage->width;
2735 layers[0].clip_height =
fImage->height;
2736 layers[0].bevel = 0;
2737 layers[1].im = ((
TASImage*)im)->fImage;
2738 layers[1].dst_x =
x;
2739 layers[1].dst_y =
y;
2740 layers[1].clip_width = im->
GetWidth();
2741 layers[1].clip_height = im->
GetHeight();
2742 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2760 Warning(
"Blur",
"Visual not initiated");
2765 fImage = create_asimage(100, 100, 0);
2768 Warning(
"Blur",
"Failed to create image");
2775 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2776 vr > 0 ? vr : 3, SCL_DO_ALL,
2789 Warning(
"Clone",
"Image not initiated");
2796 Warning(
"Clone",
"Failed to create image");
2812 if (
fImage->alt.argb32) {
2814 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2815 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2835 Warning(
"Vectorize",
"Visual not initiated");
2840 fImage = create_asimage(100, 100, 0);
2843 Warning(
"Vectorize",
"Failed to create image");
2854 dither = dither > 7 ? 7 : dither;
2856 res = colormap_asimage(
fImage, &cmap, max_colors, dither, opaque_threshold);
2868 g = INDEX_SHIFT_GREEN(cmap.entries[res[i]].green);
2869 b = INDEX_SHIFT_BLUE(cmap.entries[res[i]].blue);
2870 r = INDEX_SHIFT_RED(cmap.entries[res[i]].red);
2872 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2882 for (
UInt_t j = 0; j < cmap.count; j++) {
2883 g = INDEX_SHIFT_GREEN(cmap.entries[j].green);
2884 b = INDEX_SHIFT_BLUE(cmap.entries[j].blue);
2885 r = INDEX_SHIFT_RED(cmap.entries[j].red);
2886 v = MAKE_INDEXED_COLOR24(
r,
g,
b);
2888 v = (
v>>12) & 0x0FFF;
2891 pal->
fColorRed[j] = cmap.entries[j].red << 8;
2893 pal->
fColorBlue[j] = cmap.entries[j].blue << 8;
2897 destroy_colormap(&cmap,
kTRUE);
2903 if (res) safefree(res);
2949 Warning(
"HSV",
"Visual not initiated");
2957 Warning(
"HSV",
"Failed to create image");
2967 height = !height ?
fImage->height : height;
2969 ASImage *rendered_im = 0;
2973 hue, radius,
H, S, V, ASA_ASImage, 100,
2974 ASIMAGE_QUALITY_TOP);
2977 Warning(
"HSV",
"Failed to create rendered image");
3012 Warning(
"Gradient",
"Visual not initiated");
3016 ASImage *rendered_im = 0;
3017 ASGradient gradient;
3019 int reverse = 0, npoints1 = 0, npoints2 = 0;
3026 if ((angle > 2 * 180 * 15 / 16) || (angle < 2 * 180 * 1 / 16)) {
3027 gradient.type = GRADIENT_Left2Right;
3028 }
else if (angle < 2 * 180 * 3 / 16) {
3029 gradient.type = GRADIENT_TopLeft2BottomRight;
3030 }
else if (angle < 2 * 180 * 5 / 16) {
3031 gradient.type = GRADIENT_Top2Bottom;
3032 }
else if (angle < 2 * 180 * 7 / 16) {
3033 gradient.type = GRADIENT_BottomLeft2TopRight; reverse = 1;
3034 }
else if (angle < 2 * 180 * 9 / 16) {
3035 gradient.type = GRADIENT_Left2Right; reverse = 1;
3036 }
else if (angle < 2 * 180 * 11 / 16) {
3037 gradient.type = GRADIENT_TopLeft2BottomRight; reverse = 1;
3038 }
else if (angle < 2 * 180 * 13 / 16) {
3039 gradient.type = GRADIENT_Top2Bottom; reverse = 1;
3041 gradient.type = GRADIENT_BottomLeft2TopRight;
3044 for (p = (
char*)
colors; isspace((
int)*p); p++) { }
3046 for (npoints1 = 0; *p; npoints1++) {
3048 for ( ; *p && !isspace((
int)*p); p++) { }
3050 for ( ; isspace((
int)*p); p++) { }
3053 for (p = (
char*)offsets; isspace((
int)*p); p++) { }
3055 for (npoints2 = 0; *p; npoints2++) {
3057 for ( ; *p && !isspace((
int)*p); p++) { }
3059 for ( ; isspace((
int)*p); p++) { }
3064 if (offsets && (npoints1 > npoints2)) npoints1 = npoints2;
3073 gradient.color =
new ARGB32[npoints1];
3074 gradient.offset =
new double[npoints1];
3076 for (p = (
char*)
colors; isspace((
int)*p); p++) { }
3078 for (npoints1 = 0; *p; ) {
3082 for ( ; *p && !isspace((
int)*p); p++) { }
3084 for ( ; isspace((
int)*p); p++) { }
3086 col = str(pb -
colors, p - pb);
3088 if (parse_argb_color(col.
Data(), gradient.color + npoints1) != col) {
3091 Warning(
"Gradient",
"Failed to parse color [%s] - defaulting to black", pb);
3096 for (p = (
char*)offsets; isspace((
int)*p); p++) { }
3098 for (npoints2 = 0; *p; ) {
3102 for ( ; *p && !isspace((
int)*p); p++) { }
3105 gradient.offset[npoints2] = strtod(pb, &pb);
3107 if (pb == p) npoints2++;
3109 for ( ; isspace((
int)*p); p++) { }
3112 for (npoints2 = 0; npoints2 < npoints1; npoints2++) {
3113 gradient.offset[npoints2] = (
double)npoints2 / (npoints1 - 1);
3116 gradient.npoints = npoints1;
3118 if (npoints2 && (gradient.npoints > npoints2)) {
3119 gradient.npoints = npoints2;
3122 for (i = 0; i < gradient.npoints/2; i++) {
3123 int i2 = gradient.npoints - 1 - i;
3124 ARGB32
c = gradient.color[i];
3125 double o = gradient.offset[i];
3126 gradient.color[i] = gradient.color[i2];
3127 gradient.color[i2] =
c;
3128 gradient.offset[i] = gradient.offset[i2];
3129 gradient.offset[i2] = o;
3131 for (i = 0; i < gradient.npoints; i++) {
3132 gradient.offset[i] = 1.0 - gradient.offset[i];
3135 rendered_im = make_gradient(
fgVisual, &gradient,
width, height, SCL_DO_ALL,
3138 delete [] gradient.color;
3139 delete [] gradient.offset;
3143 Warning(
"Gradient",
"Failed to create gradient image");
3152 ASImageLayer layers[2];
3154 init_image_layers(&(layers[0]), 2);
3156 layers[0].dst_x = 0;
3157 layers[0].dst_y = 0;
3158 layers[0].clip_width =
fImage->width;
3159 layers[0].clip_height =
fImage->height;
3160 layers[0].bevel = 0;
3161 layers[1].im = rendered_im;
3162 layers[1].dst_x =
x;
3163 layers[1].dst_y =
y;
3164 layers[1].clip_width =
width;
3165 layers[1].clip_height = height;
3166 layers[1].merge_scanlines = alphablend_scanlines;
3171 Warning(
"Gradient",
"Failed to create merged image");
3175 destroy_asimage(&rendered_im);
3190 cmp = (cmp * 12) / 10;
3192 return (cmp > 255) ? 255 : cmp;
3213 return (background >> 1) & 0x7F7F7F7F;
3224 a = ARGB32_ALPHA8(foreground) + ARGB32_ALPHA8(background);
3226 r = ARGB32_RED8(foreground) + ARGB32_RED8(background);
3228 g = ARGB32_GREEN8(foreground) + ARGB32_GREEN8(background);
3230 b = ARGB32_BLUE8(foreground) + ARGB32_BLUE8(background);
3233 return MAKE_ARGB32(
a,
r,
g,
b);
3249 const char *hi_color,
const char *lo_color,
UShort_t thick,
3253 Warning(
"Bevel",
"Visual not initiated");
3260 ARGB32
hi=ARGB32_White, lo=ARGB32_White;
3261 parse_argb_color(hi_color, &
hi);
3262 parse_argb_color(lo_color, &lo);
3265 bevel.lo_color =
hi;
3267 bevel.hi_color = lo;
3270 bevel.hi_color =
hi;
3272 bevel.lo_color = lo;
3277 int extra_hilite = 2;
3278 bevel.left_outline = bevel.top_outline = bevel.right_outline = bevel.bottom_outline = thick;
3279 bevel.left_inline = bevel.top_inline = bevel.right_inline = bevel.bottom_inline = extra_hilite + 1;
3281 if (bevel.top_outline > 1) {
3282 bevel.top_inline += bevel.top_outline - 1;
3285 if (bevel.left_outline > 1) {
3286 bevel.left_inline += bevel.left_outline - 1;
3289 if (bevel.right_outline > 1) {
3290 bevel.right_inline += bevel.right_outline - 1;
3293 if (bevel.bottom_outline > 1) {
3294 bevel.bottom_inline += bevel.bottom_outline - 1;
3298 ARGB32 fill = ((
hi>>24) != 0xff) || ((lo>>24) != 0xff) ? bevel.hilo_color : (bevel.hilo_color | 0xff000000);
3304 Warning(
"Bevel",
"Failed to create image");
3314 height = !height ?
fImage->height : height;
3316 ASImageLayer layers[2];
3317 init_image_layers(&(layers[0]), 2);
3320 layers[0].dst_x = 0;
3321 layers[0].dst_y = 0;
3322 layers[0].clip_width =
fImage->width;
3323 layers[0].clip_height =
fImage->height;
3324 layers[0].bevel = 0;
3326 UInt_t w =
width - (bevel.left_outline + bevel.right_outline);
3327 UInt_t h = height - (bevel.top_outline + bevel.bottom_outline);
3328 ASImage *bevel_im = create_asimage(w,
h, 0);
3331 Warning(
"Bevel",
"Failed to create bevel image");
3335 layers[1].im = bevel_im;
3336 fill_asimage(
fgVisual, bevel_im, 0, 0, w,
h, fill);
3338 layers[1].dst_x =
x;
3339 layers[1].dst_y =
y;
3340 layers[1].clip_width =
width;
3341 layers[1].clip_height = height;
3342 layers[1].bevel = &bevel;
3343 layers[1].merge_scanlines = alphablend_scanlines;
3347 destroy_asimage(&bevel_im);
3350 Warning(
"Bevel",
"Failed to image");
3370 Warning(
"Pad",
"Visual not initiated");
3375 fImage = create_asimage(100, 100, 0);
3378 Warning(
"Pad",
"Failed to create image");
3385 ARGB32 color = ARGB32_White;
3386 parse_argb_color(col, &color);
3397 Warning(
"Pad",
"Failed to create output image");
3414 Warning(
"Crop",
"Visual not initiated");
3427 height =
y + height >
fImage->height ?
fImage->height -
y : height;
3430 Warning(
"Crop",
"input size larger than image");
3433 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3437 Warning(
"Crop",
"Failed to start image decoding");
3441 ASImage *img = create_asimage(
width, height, 0);
3445 Warning(
"Crop",
"Failed to create image");
3449 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3453 Warning(
"Crop",
"Failed to start image output");
3454 destroy_asimage(&img);
3455 if (imdec)
delete [] imdec;
3463 for (
UInt_t i = 0; i < height; i++) {
3464 imdec->decode_image_scanline(imdec);
3465 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3468 stop_image_decoding(&imdec);
3469 stop_image_output(&imout);
3493 Warning(
"Append",
"Visual not initiated");
3511 }
else if (opt ==
"/") {
3513 Merge(im,
"alphablend", 0, height);
3532 Warning(
"BeginPaint",
"Visual not initiated");
3547 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3550 Warning(
"BeginPaint",
"Failed to create image");
3564 Warning(
"EndPaint",
"no image");
3568 if (!
fImage->alt.argb32)
return;
3571 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3574 Warning(
"EndPaint",
"Failed to create image");
3591 Warning(
"GetArgbArray",
"no image");
3598 if (!img->alt.argb32) {
3608 return (
UInt_t *)img->alt.argb32;
3619 Warning(
"GetRgbaArray",
"no image");
3626 if (!img->alt.argb32) {
3644 for (i = 0; i < img->height; i++) {
3645 for (j = 0; j < img->width; j++) {
3647 argb = img->alt.argb32[idx];
3649 rgb = argb & 0x00ffffff;
3650 rgba = (rgb << 8) +
a;
3665 Warning(
"GetScanline",
"no image");
3670 CARD32 *ret =
new CARD32[img->width];
3672 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3673 0,
y, img->width, 1, 0);
3677 Warning(
"GetScanline",
"Failed to start image decoding");
3685 imdec->decode_image_scanline(imdec);
3686 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3687 stop_image_decoding(&imdec);
3702#if defined(R__GNU) && defined(__i386__) && !defined(__sun)
3703#define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\
3704 "movl %1,%%edi \n" \
3705 "movl %2,%%ecx \n" \
3710 :"g" (val), "g" (dst), "g" (lng) \
3711 :"eax","edi","ecx" \
3715 #define _MEMSET_(dst, lng, val) do {\
3716 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0)
3720#define FillSpansInternal(npt, ppt, widths, color) do {\
3721 UInt_t yy = ppt[0].fY*fImage->width;\
3722 for (UInt_t i = 0; i < npt; i++) {\
3723 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\
3724 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\
3736 Warning(
"FillRectangle",
"Visual not initiated");
3741 Warning(
"FillRectangle",
"no image");
3745 if (!
fImage->alt.argb32) {
3749 if (!
fImage->alt.argb32) {
3750 Warning(
"FillRectangle",
"Failed to get pixel array");
3754 ARGB32 color = (ARGB32)col;
3757 if (height == 0) height = 1;
3768 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3774 height =
y + height >
fImage->height ?
fImage->height -
y : height;
3776 if (!
fImage->alt.argb32) {
3781 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3783 for (
UInt_t i = 0; i < height; i++) {
3788 for (
UInt_t i =
y; i <
y + height; i++) {
3813 Warning(
"Fill",
"Visual not initiated");
3817 ARGB32 color = ARGB32_White;
3820 parse_argb_color(col, &color);
3838 ARGB32 color = (ARGB32)col;
3841 if (!thick) thick = 1;
3849 thick += (
x - half);
3857 int yy = y1*
fImage->width;
3859 for (
UInt_t w = 0; w < thick; w++) {
3860 if (
x + w < fImage->
width) {
3873 ARGB32 color = (ARGB32)col;
3876 if (!thick) thick = 1;
3884 thick += (
y - half);
3893 for (
UInt_t w = 0; w < thick; w++) {
3895 if (
y + w < fImage->height) {
3907 const char *col,
UInt_t thick)
3909 ARGB32 color = ARGB32_White;
3910 parse_argb_color(col, &color);
3922 int x,
y, xend, yend;
3929 Warning(
"DrawLine",
"Visual not initiated");
3934 Warning(
"DrawLine",
"no image");
3938 if (!
fImage->alt.argb32) {
3942 if (!
fImage->alt.argb32) {
3943 Warning(
"DrawLine",
"Failed to get pixel array");
3947 ARGB32 color = (ARGB32)col;
3952 if (!dx && !dy)
return;
3956 y2 > y1 ? y2 : y1, color, thick);
3974 i2 = i1 - (dx << 1);
3991 q = (y2 - y1) * ydir;
4024 i2 = i1 - (dy << 1);
4041 q = (
x2 -
x1) * xdir;
4079 const char *col,
UInt_t thick)
4082 Warning(
"DrawRectangle",
"Visual not initiated");
4089 fImage = create_asimage(w,
h, 0);
4094 if (!
fImage->alt.argb32) {
4098 if (!
fImage->alt.argb32) {
4099 Warning(
"DrawRectangle",
"Failed to get pixel array");
4103 ARGB32 color = ARGB32_White;
4104 parse_argb_color(col, &color);
4124 ARGB32 color = ARGB32_White;
4129 fImage = create_asimage(w,
h, 0);
4135 parse_argb_color(col, &color);
4141 parse_argb_color(col, &color);
4171 ARGB32 color = (ARGB32)col;
4181 thick += (
y - half);
4184 thick = thick <= 0 ? 1 : thick;
4193 x2 =
x2 < tmp ? tmp :
x2;
4196 for (
UInt_t w = 0; w < thick; w++) {
4197 if (
y + w < fImage->height) {
4205 if (i >= pDash[iDash]) {
4209 if (iDash >= nDash) {
4225 ARGB32 color = (ARGB32)col;
4235 thick += (
x - half);
4238 thick = thick <= 0 ? 1 : thick;
4245 y1 = y2 < y1 ? y2 : y1;
4246 y2 = y2 < tmp ? tmp : y2;
4250 int yy = y1*
fImage->width;
4252 for (
UInt_t w = 0; w < thick; w++) {
4253 if (
x + w < fImage->
width) {
4261 if (i >= pDash[iDash]) {
4265 if (iDash >= nDash) {
4281 int x,
y, xend, yend;
4291 char *pDash =
new char[nDash];
4296 for (i = 0; i < (
int)nDash; i++) {
4302 i2 = i1 - (dx << 1);
4320 q = (y2 - y1) * ydir;
4325 if ((iDash%2) == 0) {
4337 if (i >= pDash[iDash]) {
4341 if (iDash >= nDash) {
4349 if ((iDash%2) == 0) {
4361 if (i >= pDash[iDash]) {
4365 if (iDash >= nDash) {
4374 for (i = 0; i < (
int)nDash; i++) {
4380 i2 = i1 - (dy << 1);
4398 q = (
x2 -
x1) * xdir;
4403 if ((iDash%2) == 0) {
4417 if (i >= pDash[iDash]) {
4421 if (iDash >= nDash) {
4429 if ((iDash%2) == 0) {
4443 if (i >= pDash[iDash]) {
4447 if (iDash >= nDash) {
4465 double x,
y, xend=0, yend=0, x0, y0;
4473 double *xDash =
new double[nDash];
4474 double *yDash =
new double[nDash];
4479 for (i = 0; i < (
int)nDash; i++) {
4480 xDash[i] = tDash[i] * ac;
4481 yDash[i] = tDash[i] * as;
4485 xDash[i] = xDash[i]/2;
4486 yDash[i] = yDash[i]/2;
4488 xDash[i] = xDash[i]*2;
4489 yDash[i] = yDash[i]*2;
4506 q = (y2 - y1) * ydir;
4513 while ((
x < xend) && (
y < yend)) {
4517 if ((iDash%2) == 0) {
4527 if (iDash >= nDash) {
4532 while ((
x < xend) && (
y > yend)) {
4536 if ((iDash%2) == 0) {
4546 if (iDash >= nDash) {
4565 q = (
x2 -
x1) * xdir;
4572 while ((
x < xend) && (
y < yend)) {
4576 if ((iDash%2) == 0) {
4586 if (iDash >= nDash) {
4591 while ((
x > xend) && (
y < yend)) {
4595 if ((iDash%2) == 0) {
4605 if (iDash >= nDash) {
4619 const char *pDash,
const char *col,
UInt_t thick)
4623 Warning(
"DrawDashLine",
"Visual not initiated");
4628 Warning(
"DrawDashLine",
"no image");
4632 if (!
fImage->alt.argb32) {
4636 if (!
fImage->alt.argb32) {
4637 Warning(
"DrawDashLine",
"Failed to get pixel array");
4641 if ((nDash < 2) || !pDash || (nDash%2)) {
4642 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4646 ARGB32 color = ARGB32_White;
4647 parse_argb_color(col, &color);
4651 }
else if (y1 == y2) {
4665 ARGB32 color = ARGB32_White;
4666 parse_argb_color(col, &color);
4673 for (
UInt_t i = 1; i < nn; i++) {
4690 Warning(
"PutPixel",
"Visual not initiated");
4695 Warning(
"PutPixel",
"no image");
4699 if (!
fImage->alt.argb32) {
4703 if (!
fImage->alt.argb32) {
4704 Warning(
"PutPixel",
"Failed to get pixel array");
4709 parse_argb_color(col, &color);
4711 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4712 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4725 Warning(
"PolyPoint",
"Visual not initiated");
4730 Warning(
"PolyPoint",
"no image");
4734 if (!
fImage->alt.argb32) {
4738 if (!
fImage->alt.argb32) {
4739 Warning(
"PolyPoint",
"Failed to get pixel array");
4744 Warning(
"PolyPoint",
"No points specified");
4751 parse_argb_color(col, &color);
4757 for (i = 0; i < npt; i++) {
4758 ipt[i].
fX += ppt[i].
fX;
4759 ipt[i].
fY += ppt[i].
fY;
4764 for (i = 0; i < npt; i++) {
4765 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4766 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4768 if ((
x < 0) || (
y < 0) || (
x >= (
int)
fImage->width) || (
y >= (
int)
fImage->height)) {
4784 if (!nseg || !seg) {
4785 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%zx", nseg, (
size_t)seg);
4791 for (
UInt_t i = 0; i < nseg; i++) {
4792 pt[0].fX = seg->
fX1;
4793 pt[1].fX = seg->
fX2;
4794 pt[0].fY = seg->
fY1;
4795 pt[1].fY = seg->
fY2;
4809 Warning(
"FillSpans",
"Visual not initiated");
4814 Warning(
"FillSpans",
"no image");
4818 if (!
fImage->alt.argb32) {
4822 if (!
fImage->alt.argb32) {
4823 Warning(
"FillSpans",
"Failed to get pixel array");
4827 if (!npt || !ppt || !widths || (stipple && (!w || !
h))) {
4828 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx col=%s widths=0x%zx stipple=0x%zx w=%d h=%d",
4829 npt, (
size_t)ppt, col, (
size_t)widths, (
size_t)stipple, w,
h);
4834 parse_argb_color(col, &color);
4839 for (
UInt_t i = 0; i < npt; i++) {
4841 for (
UInt_t j = 0; j < widths[i]; j++) {
4842 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4853 if (stipple[ii >> 3] & (1 << (ii%8))) {
4867 Warning(
"FillSpans",
"Visual not initiated");
4872 Warning(
"FillSpans",
"no image");
4876 if (!
fImage->alt.argb32) {
4880 if (!
fImage->alt.argb32) {
4881 Warning(
"FillSpans",
"Failed to get pixel array");
4885 if (!npt || !ppt || !widths || !tile) {
4886 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%zx widths=0x%zx tile=0x%zx",
4887 npt, (
size_t)ppt, (
size_t)widths, (
size_t)tile);
4899 for (
UInt_t i = 0; i < npt; i++) {
4902 for (
UInt_t j = 0; j < widths[i]; j++) {
4903 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4921 Warning(
"CropSpans",
"Visual not initiated");
4926 Warning(
"CropSpans",
"no image");
4930 if (!
fImage->alt.argb32) {
4934 if (!
fImage->alt.argb32) {
4935 Warning(
"CropSpans",
"Failed to get pixel array");
4939 if (!npt || !ppt || !widths) {
4940 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%zx widths=0x%zx", npt, (
size_t)ppt, (
size_t)widths);
4945 int y1 = ppt[npt-1].
fY;
4953 for (
y = 0; (
int)
y < y0;
y++) {
4956 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4961 for (i = 0; i < npt; i++) {
4962 for (
x = 0; (
int)
x < ppt[i].fX;
x++) {
4964 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4966 for (
x = ppt[i].fX + widths[i] + 1;
x <
fImage->width;
x++) {
4968 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4976 if (idx < sz)
fImage->alt.argb32[idx] = 0;
5010 Warning(
"CopyArea",
"Visual not initiated");
5015 Warning(
"CopyArea",
"no image");
5020 ASImage *out = ((
TASImage*)dst)->GetImage();
5026 xsrc = xsrc < 0 ? 0 : xsrc;
5027 ysrc = ysrc < 0 ? 0 : ysrc;
5029 if ((xsrc >= (
int)
fImage->width) || (ysrc >= (
int)
fImage->height))
return;
5031 w = xsrc + w >
fImage->width ?
fImage->width - xsrc : w;
5035 if (!
fImage->alt.argb32) {
5038 if (!out->alt.argb32) {
5040 out = ((
TASImage*)dst)->GetImage();
5043 if (
fImage->alt.argb32 && out->alt.argb32) {
5044 for (
y = 0;
y < (
int)
h;
y++) {
5045 for (
x = 0;
x < (
int)w;
x++) {
5046 idx =
Idx(yy +
x + xsrc);
5047 if ((
x + xdst < 0) || (ydst +
y < 0) ||
5048 (
x + xdst >= (
int)out->width) || (
y + ydst >= (
int)out->height) )
continue;
5050 idx2 =
Idx((ydst +
y)*out->width +
x + xdst);
5054 out->alt.argb32[idx2] = 0;
5057 out->alt.argb32[idx2] &=
fImage->alt.argb32[idx];
5060 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] & (~out->alt.argb32[idx2]);
5063 out->alt.argb32[idx2] &= ~fImage->alt.argb32[idx];
5068 out->alt.argb32[idx2] ^=
fImage->alt.argb32[idx];
5071 out->alt.argb32[idx2] |=
fImage->alt.argb32[idx];
5074 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) & (~out->alt.argb32[idx2]);
5077 out->alt.argb32[idx2] ^= ~fImage->alt.argb32[idx];
5080 out->alt.argb32[idx2] = ~out->alt.argb32[idx2];
5083 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] | (~out->alt.argb32[idx2]);
5086 out->alt.argb32[idx2] = ~fImage->alt.argb32[idx];
5089 out->alt.argb32[idx2] |= ~fImage->alt.argb32[idx];
5092 out->alt.argb32[idx2] = (~fImage->alt.argb32[idx]) | (~out->alt.argb32[idx2]);
5095 out->alt.argb32[idx2] = 0xFFFFFFFF;
5099 out->alt.argb32[idx2] =
fImage->alt.argb32[idx];
5123 int i, j, ix, iy, w,
h;
5125 ARGB32 color = 0xFFFFFFFF;
5132 for (i = 0; i < nx; i++) {
5134 for (j = 0; j < ny; j++) {
5135 icol = (ARGB32)ic[i + (nx*j)];
5136 if (icol != color) {
5190 return (ptMin - ptsStart);
5206 int mr = 0, m1r = 0;
5207 int incr1l = 0, incr2l = 0;
5208 int incr1r = 0, incr2r = 0;
5213 int nextleft, nextright;
5226 Warning(
"GetPolygonSpans",
"Visual not initiated");
5231 Warning(
"GetPolygonSpans",
"no image");
5235 if (!
fImage->alt.argb32) {
5239 if (!
fImage->alt.argb32) {
5240 Warning(
"GetPolygonSpans",
"Failed to get pixel array");
5244 if ((npt < 3) || !ppt) {
5245 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%zx", npt, (
size_t)ppt);
5254 if ((npt < 3) || (dy < 0))
return kFALSE;
5256 ptsOut = firstPoint =
new TPoint[dy];
5260 nextleft = nextright = imin;
5261 y = ppt[nextleft].
fY;
5266 if (ppt[nextleft].fY ==
y) {
5272 if (nextleft >= (
int)npt) {
5279 ppt[left].fX, ppt[nextleft].fX,
5280 xl, dl, ml, m1l, incr1l, incr2l);
5284 if (ppt[nextright].fY ==
y) {
5290 if (nextright < 0) {
5297 ppt[right].fX, ppt[nextright].fX,
5298 xr, dr, mr, m1r, incr1r, incr2r);
5303 i =
TMath::Min(ppt[nextleft].fY, ppt[nextright].fY) -
y;
5307 delete [] firstWidth;
5308 delete [] firstPoint;
5317 *(
width++) = xr - xl;
5318 (ptsOut++)->fX = xl;
5320 *(
width++) = xl - xr;
5321 (ptsOut++)->fX = xr;
5329 }
while (
y !=
ymax);
5331 *nspans =
UInt_t(ptsOut - firstPoint);
5332 *outPoint = firstPoint;
5333 *outWidth = firstWidth;
5350 ARGB32 color = ARGB32_White;
5351 parse_argb_color(col, &color);
5354 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5357 FillSpans(nspans, firstPoint, firstWidth, col, stipple, w,
h);
5361 delete [] firstWidth;
5362 delete [] firstPoint;
5365 if (firstWidth)
delete [] firstWidth;
5366 if (firstPoint)
delete [] firstPoint;
5383 FillSpans(nspans, firstPoint, firstWidth, tile);
5386 delete [] firstWidth;
5387 delete [] firstPoint;
5390 if (firstWidth)
delete [] firstWidth;
5391 if (firstPoint)
delete [] firstPoint;
5407 CropSpans(nspans, firstPoint, firstWidth);
5410 delete [] firstWidth;
5411 delete [] firstPoint;
5414 if (firstWidth)
delete [] firstWidth;
5415 if (firstPoint)
delete [] firstPoint;
5428 Warning(
"DrawFillArea",
"Visual not initiated");
5433 Warning(
"DrawFillArea",
"no image");
5437 if (!
fImage->alt.argb32) {
5441 if (!
fImage->alt.argb32) {
5442 Warning(
"DrawFillArea",
"Failed to get pixel array");
5446 if ((count < 3) || !ptsIn) {
5447 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5456 ARGB32 color = ARGB32_White;
5457 parse_argb_color(col, &color);
5475 static const UInt_t gEdgeTableEntryCacheSize = 200;
5476 static EdgeTableEntry gEdgeTableEntryCache[gEdgeTableEntryCacheSize];
5478 if (count < gEdgeTableEntryCacheSize) {
5489 ptsOut = firstPoint;
5511 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5514 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w,
h);
5516 ptsOut = firstPoint;
5527 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5530 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w,
h);
5534 if (del)
delete [] pETEs;
5544 Warning(
"DrawFillArea",
"Visual not initiated");
5549 Warning(
"DrawFillArea",
"no image");
5553 if (!
fImage->alt.argb32) {
5557 if (!
fImage->alt.argb32) {
5558 Warning(
"DrawFillArea",
"Failed to get pixel array");
5562 if ((count < 3) || !ptsIn) {
5563 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%zx", count, (
size_t)ptsIn);
5592 ptsOut = firstPoint;
5614 FillSpans(nPts, firstPoint, firstWidth, tile);
5615 ptsOut = firstPoint;
5624 FillSpans(nPts, firstPoint, firstWidth, tile);
5635 ASDrawContext *ctx =
new ASDrawContext;
5637 ctx->canvas_width = im->width;
5638 ctx->canvas_height = im->height;
5639 ctx->canvas = im->alt.argb32;
5640 ctx->scratch_canvas = 0;
5642 ctx->flags = ASDrawCTX_CanvasIsARGB;
5643 asim_set_custom_brush_colored( ctx, brush);
5653 if (ctx->scratch_canvas)
free(ctx->scratch_canvas);
5667 Int_t sz = thick*thick;
5674 matrix =
new CARD32[sz];
5677 for (
int i = 0; i < sz; i++) {
5678 matrix[i] = (CARD32)color;
5682 brush.matrix = matrix;
5683 brush.width = thick;
5684 brush.height = thick;
5685 brush.center_y = brush.center_x = thick/2;
5694 if (xx1 ==
fImage->width) --xx1;
5695 if (yy1 ==
fImage->height) --yy1;
5696 if (xx2 ==
fImage->width) --xx2;
5697 if (yy2 ==
fImage->height) --yy2;
5699 asim_move_to(ctx, xx1, yy1);
5700 asim_line_to(ctx, xx2, yy2);
5715 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
5719 FT_Bitmap *source = (FT_Bitmap*)bitmap;
5720 UChar_t d = 0, *s = source->buffer;
5722 Int_t dots =
Int_t(source->width * source->rows);
5726 yy = y0 = by > 0 ? by *
fImage->width : 0;
5727 for (
y = 0;
y < (
int) source->rows;
y++) {
5729 if ((byy >= (
int)
fImage->height) || (byy <0))
continue;
5731 for (
x = 0;
x < (
int) source->width;
x++) {
5733 if ((bxx >= (
int)
fImage->width) || (bxx < 0))
continue;
5735 idx =
Idx(bxx + yy);
5736 r += ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
5737 g += ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
5738 b += (
fImage->alt.argb32[idx] & 0x0000ff);
5748 col[0] = (
r << 16) + (
g << 8) +
b;
5750 Int_t col4r = (col[4] & 0xff0000) >> 16;
5751 Int_t col4g = (col[4] & 0x00ff00) >> 8;
5752 Int_t col4b = (col[4] & 0x0000ff);
5755 for (
x = 3;
x > 0;
x--) {
5757 Int_t colxr = (col4r*
x +
r*xx) >> 2;
5758 Int_t colxg = (col4g*
x +
g*xx) >> 2;
5759 Int_t colxb = (col4b*
x +
b*xx) >> 2;
5760 col[
x] = (colxr << 16) + (colxg << 8) + colxb;
5766 Int_t clipx1=0, clipx2=0, clipy1=0, clipy2=0;
5771 clipx1 =
gPad->XtoAbsPixel(
gPad->GetX1())*is;
5772 clipx2 =
gPad->XtoAbsPixel(
gPad->GetX2())*is;
5773 clipy1 =
gPad->YtoAbsPixel(
gPad->GetY1())*is;
5774 clipy2 =
gPad->YtoAbsPixel(
gPad->GetY2())*is;
5778 for (
y = 0;
y < (
int) source->rows;
y++) {
5781 for (
x = 0;
x < (
int) source->width;
x++) {
5785 d = ((
d + 10) * 5) >> 8;
5789 if ( noClip || ((
x < (
int) source->width) &&
5790 (bxx < (
int)clipx2) && (bxx >= (
int)clipx1) &&
5791 (byy >= (
int)clipy2) && (byy < (
int)clipy1) )) {
5792 idx =
Idx(bxx + yy);
5793 acolor = (ARGB32)col[
d];
5797 fImage->alt.argb32[idx] = acolor;
5816 Warning(
"DrawText",
"Visual not initiated");
5820 if (!
fImage->alt.argb32) {
5845 const wchar_t *wcsTitle =
reinterpret_cast<const wchar_t *
>(
text->
GetWcsTitle());
5846 if (wcsTitle != NULL) {
5859 ARGB32 color = ARGB32_White;
5913 if (align == 1 || align == 2 || align == 3) {
5915 }
else if (align == 4 || align == 5 || align == 6) {
5922 if (align == 3 || align == 6 || align == 9) {
5924 }
else if (align == 2 || align == 5 || align == 8) {
5931 ftal.x = (ftal.x >> 6);
5932 ftal.y = (ftal.y >> 6);
5937 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal, 0, 1 ))
continue;
5939 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
5940 FT_Bitmap *source = &bitmap->bitmap;
5942 Int_t bx =
x - ftal.x + bitmap->left;
5943 Int_t by =
y + ftal.y - bitmap->top;
5971 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal, 0, 1 ))
continue;
5973 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
5974 FT_Bitmap *source = &bitmap->bitmap;
5976 Int_t bx =
x + bitmap->left;
5977 Int_t by =
y +
h - bitmap->top;
5989 static ASImageExportParams params;
5997 ret = ASImage2xpmRawBuff(img, (CARD8 **)buffer,
size, 0);
6000 ret = ASImage2PNGBuff(img, (CARD8 **)buffer,
size, ¶ms);
6044 static ASImageImportParams params;
6048 params.filter = SCL_DO_ALL;
6049 params.gamma = SCREEN_GAMMA;
6050 params.gamma_table =
nullptr;
6051 params.compression = 0;
6052 params.format = ASA_ASImage;
6053 params.search_path = 0;
6054 params.subimage = 0;
6059 char *ptr = buffer[0];
6060 while (isspace((
int)*ptr)) ++ptr;
6062 fImage = xpm_data2ASImage((
const char**)buffer, ¶ms);
6064 fImage = xpmRawBuff2ASImage((
const char*)*buffer, ¶ms);
6069 fImage = PNGBuff2ASimage((CARD8 *)*buffer, ¶ms);
6102 static char *buf = 0;
6124 ASImage *rendered_im;
6125 ASImageLayer layers[2];
6126 init_image_layers(&(layers[0]), 2);
6128 layers[0].dst_x = 0;
6129 layers[0].dst_y = 0;
6130 layers[0].clip_width = img->width;
6131 layers[0].clip_height = img->height;
6132 layers[0].bevel = 0;
6134 layers[1].dst_x = 0;
6135 layers[1].dst_y = 0;
6136 layers[1].clip_width = img->width;
6137 layers[1].clip_height = img->height;
6138 layers[1].merge_scanlines = blend_scanlines_name2func(
"tint");
6139 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, img->width, img->height,
6141 destroy_asimage(&img);
6145 ASImage *padimg = 0;
6150 padimg = pad_asimage(
fgVisual, img, 0,
d, sz, sz, 0x00ffffff,
6154 padimg = pad_asimage(
fgVisual, img,
d, 0, sz, sz, 0x00ffffff,
6159 destroy_asimage(&img);
6164 ASImage2xpmRawBuff(padimg, (CARD8 **)ptr, &
size, 0);
6167 destroy_asimage(&padimg);
6180 if (
b.IsReading()) {
6181 Version_t version =
b.ReadVersion(&R__s, &R__c);
6186 if ( version == 1 ) {
6187 Int_t fileVersion =
b.GetVersionOwner();
6188 if (fileVersion > 0 && fileVersion < 50000 ) {
6189 TImage::Streamer(
b);
6196 if ( fileVersion < 40200 ) {
6207 b.CheckByteCount(R__s, R__c, TASImage::IsA());
6212 TNamed::Streamer(
b);
6215 if (image_type != 0) {
6217 char *buffer =
new char[
size];
6218 b.ReadFastArray(buffer,
size);
6222 TAttImage::Streamer(
b);
6231 b.CheckByteCount(R__s, R__c, TASImage::IsA());
6236 R__c =
b.WriteVersion(TASImage::IsA(),
kTRUE);
6241 TNamed::Streamer(
b);
6243 image_type =
fImage->alt.vector ? 0 : 1;
6246 if (image_type != 0) {
6247 char *buffer =
nullptr;
6250 b.WriteFastArray(buffer,
size);
6253 TAttImage::Streamer(
b);
6258 b.SetByteCount(R__c,
kTRUE);
6267 if (
fImage->alt.vector) {
6309 if ((start > 0) && (stop - start > 0)) {
6320 Int_t sz = thick*thick;
6324 ARGB32 color = ARGB32_White;
6325 parse_argb_color(col, &color);
6330 matrix =
new CARD32[sz];
6333 for (
int i = 0; i < sz; i++) {
6334 matrix[i] = (CARD32)color;
6338 brush.matrix = matrix;
6339 brush.width = thick;
6340 brush.height = thick;
6341 brush.center_y = brush.center_x = thick/2;
6343 ASDrawContext *ctx = 0;
6346 asim_cube_bezier(ctx,
x1, y1,
x2, y2,
x3, y3);
6359 const char *col,
Int_t thick)
6361 thick = !thick ? 1 : thick;
6362 Int_t sz = thick*thick;
6366 ARGB32 color = ARGB32_White;
6367 parse_argb_color(col, &color);
6372 matrix =
new CARD32[sz];
6375 for (
int i = 0; i < sz; i++) {
6376 matrix[i] = (CARD32)color;
6380 brush.matrix = matrix;
6381 brush.width = thick > 0 ? thick : 1;
6382 brush.height = thick > 0 ? thick : 1;
6383 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6386 asim_straight_ellips(ctx,
x,
y, rx, ry, thick < 0);
6400 thick = !thick ? 1 : thick;
6401 Int_t sz = thick*thick;
6405 ARGB32 color = ARGB32_White;
6406 parse_argb_color(col, &color);
6412 matrix =
new CARD32[sz];
6415 for (
int i = 0; i < sz; i++) {
6416 matrix[i] = (CARD32)color;
6420 brush.matrix = matrix;
6421 brush.height = brush.width = thick > 0 ? thick : 1;
6422 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6425 asim_circle(ctx,
x,
y,
r, thick < 0);
6439 const char *col,
Int_t thick)
6441 thick = !thick ? 1 : thick;
6442 Int_t sz = thick*thick;
6446 ARGB32 color = ARGB32_White;
6447 parse_argb_color(col, &color);
6452 matrix =
new CARD32[sz];
6455 for (
int i = 0; i < sz; i++) {
6456 matrix[i] = (CARD32)color;
6460 brush.matrix = matrix;
6461 brush.width = thick > 0 ? thick : 1;
6462 brush.height = thick > 0 ? thick : 1;
6463 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6466 asim_ellips(ctx,
x,
y, rx, ry, angle, thick < 0);
6479 const char *col,
Int_t thick)
6481 thick = !thick ? 1 : thick;
6482 Int_t sz = thick*thick;
6486 ARGB32 color = ARGB32_White;
6487 parse_argb_color(col, &color);
6492 matrix =
new CARD32[sz];
6495 for (
int i = 0; i < sz; i++) {
6496 matrix[i] = (CARD32)color;
6500 brush.matrix = matrix;
6501 brush.width = thick > 0 ? thick : 1;
6502 brush.height = thick > 0 ? thick : 1;
6503 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6506 asim_ellips2(ctx,
x,
y, rx, ry, angle, thick < 0);
6518 const char * ,
const char * )
6532 Warning(
"Gray",
"Image not initiated");
6537 Warning(
"Gray",
"Visual not initiated");
6562 if (
fImage->alt.argb32) {
6564 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
6566 for (i = 0; i <
fImage->height; i++) {
6567 for (j = 0; j <
fImage->width; j++) {
6570 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6571 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6572 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6573 l = (57*
r + 181*
g + 18*
b)/256;
6581 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
6593 Warning(
"ToGray",
"Failed to start image output");
6600 CARD32 *aa = imdec->buffer.alpha;
6601 CARD32 *rr = imdec->buffer.red;
6602 CARD32 *gg = imdec->buffer.green;
6603 CARD32 *bb = imdec->buffer.blue;
6608 for (i = 0; i <
fImage->height; i++) {
6609 imdec->decode_image_scanline(imdec);
6610 result.flags = imdec->buffer.flags;
6611 result.back_color = imdec->buffer.back_color;
6613 for (j = 0; j <
fImage->width; j++) {
6614 l = (57*rr[j] + 181*gg[j]+ 18*bb[j])/256;
6615 result.alpha[j] = aa[j];
6617 result.green[j] =
l;
6620 imout->output_image_scanline(imout, &result, 1);
6623 stop_image_decoding(&imdec);
6624 stop_image_output(&imout);
6664 Warning(
"FromWindow",
"Visual not initiated");
6672 static int x11 = -1;
6673 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
6678 unsigned char *bits =
gVirtualX->GetColorBits(wid, 0, 0, w,
h);
6683 fImage = bitmap2asimage(bits, w,
h, 0, 0);
6698 for (
UInt_t i = 0; i <
h/2; ++i) {
6699 memcpy(xx, buf + 4*w*i, 4*w);
6700 memcpy(buf + 4*w*i, buf + 4*w*(
h-i-1), 4*w);
6701 memcpy(buf + 4*w*(
h-i-1), xx, 4*w);
6705 fImage = bitmap2asimage(buf, w,
h, 0, 0);
6718 if (!
fImage->alt.vector && on) {
6729 gPad->Range(-left / (1.0 - left - right),
6730 -bottom / (1.0 - top - bottom),
6731 1 + right / (1.0 - left - right),
6732 1 + top / ( 1.0 - top - bottom));
6733 gPad->RangeAxis(0, 0, 1, 1);
6758 name.ReplaceAll(
".",
"_");
6767 out << std::endl << str << std::endl << std::endl;
6770 out << xpm <<
"_img = TImage::Create();" << std::endl;
6771 out <<
" " << xpm <<
"_img->SetImageBuffer( (char **)" << xpm <<
", TImage::kXpm);" << std::endl;
6772 out <<
" " << xpm <<
"_img->Draw();" << std::endl;
6785 static char buf[32];
6786 FILE *fp = fopen(
name,
"rb+");
6789 printf(
"file %s : failed to open\n",
name);
6793 if (!fread(buf, 1, 20, fp)) {
6798 char dpi1 = (set & 0xffff) >> 8;
6799 char dpi2 = set & 0xff;
6804 for (i = 0; i < 20; i++) {
6805 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6806 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6812 if (i == 20 || dpi+4 >= 20) {
6814 printf(
"file %s : wrong JPEG format\n",
name);
6821 buf[dpi + 1] = dpi1;
6822 buf[dpi + 2] = dpi2;
6825 buf[dpi + 3] = dpi1;
6826 buf[dpi + 4] = dpi2;
6829 fwrite(buf, 1, 20, fp);
const Mask_t kGCClipXOrigin
@ kGXorReverse
src OR NOT dst
@ kGXnand
NOT src OR NOT dst.
@ kGXandReverse
src AND NOT dst
@ kGXorInverted
NOT src OR dst.
@ kGXandInverted
NOT src AND dst.
@ kGXequiv
NOT src XOR dst.
@ kGXnor
NOT src AND NOT dst.
@ kGXcopyInverted
NOT src.
Handle_t Pixmap_t
Pixmap handle.
Handle_t Drawable_t
Drawable handle.
Handle_t GContext_t
Graphics context handle.
const Mask_t kGCClipYOrigin
Handle_t Window_t
Window handle.
static const double x2[5]
static const double x1[5]
static const double x3[11]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
static ARGB32 GetShadow(ARGB32 background)
Calculate shadow color.
static const UInt_t kBrushCacheSize
static CARD32 gBrushCache[kBrushCacheSize *kBrushCacheSize]
static unsigned long kAllPlanes
static ARGB32 GetAverage(ARGB32 foreground, ARGB32 background)
Get average.
static char * gIconPaths[7]
static int GetPolyYBounds(TPoint *pts, int n, int *by, int *ty)
Get poly bounds along Y.
static CARD8 MakeComponentHilite(int cmp)
Make component hilite.
static ARGB32 GetHilite(ARGB32 background)
Calculate highlite color.
static const UInt_t NUMPTSTOBUFFER
static ASFontManager * gFontManager
static void init_icon_paths()
Set icons paths.
#define _MEMSET_(dst, lng, val)
#define FillSpansInternal(npt, ppt, widths, color)
static ASDrawContext * create_draw_context_argb32(ASImage *im, ASDrawTool *brush)
Create draw context.
#define _alphaBlend(bot, top)
static void destroy_asdraw_context32(ASDrawContext *ctx)
Destroy asdraw context32.
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
static int InsertionSort(EdgeTableEntry *AET)
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2)
static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
static void FreeStorage(ScanLineListBlock *pSLLBlock)
static void CreateETandAET(int count, TPoint *pts, EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2)
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
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 FillPolygon(UInt_t npt, TPoint *ppt, const char *col="#000000", const char *stipple=0, UInt_t w=16, UInt_t h=16)
Fill a convex polygon with background color or bitmap.
Bool_t IsEditable() const
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
Pixmap_t GetPixmap()
Returns image pixmap.
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
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)
Copy source region to the destination image.
Bool_t SetImageBuffer(char **buffer, EImageFileTypes type=TImage::kPng)
Create image from compressed buffer.
Double_t fMinValue
! min value in image
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
void Merge(const TImage *im, const char *op="alphablend", Int_t x=0, Int_t y=0)
Merge two images.
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, const char *col="#000000", const char *stipple=0, UInt_t w=16, UInt_t h=16)
Fill spans with specified color or/and stipple.
static Bool_t fgInit
global flag to init afterimage only once
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
Double_t fMaxValue
! max value in image
void Append(const TImage *im, const char *option="+", const char *color="#00000000")
Append image.
void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col="#000000", Int_t thick=1)
Draw a circle.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t *ic)
Draw a cell array.
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
void Crop(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0)
Crop an image.
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths)
Crop spans.
TArrayL * GetPixels(Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0)
Return 2D array of machine dependent pixel values.
UInt_t * GetScanline(UInt_t y)
Return a pointer to scan-line.
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
void EndPaint()
EndPaint does internal RLE compression of image data.
void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick)
Draw a vertical line.
UInt_t GetWidth() const
Return width of original image not of the displayed image.
void Gradient(UInt_t angle=0, const char *colors="#FFFFFF #000000", const char *offsets=0, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0)
Render multipoint gradient inside rectangle of size (width, height) at position (x,...
void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col="#000000", Int_t thick=1)
Draw a straight ellipse.
void DrawText(Int_t x=0, Int_t y=0, const char *text="", Int_t size=12, const char *color=0, const char *font="fixed", EText3DType type=TImage::kPlain, const char *fore_file=0, Float_t angle=0)
Draw text of size (in pixels for TrueType fonts) at position (x, y) with color specified by hex strin...
ASImage * fImage
! pointer to image structure of original image
UInt_t GetHeight() const
Return height of original image not of the displayed image.
UInt_t fZoomHeight
! hight of zoomed image in image pixels
static THashTable * fgPlugList
! hash table containing loaded plugins
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 DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1)
Draw segments.
void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col="#000000", UInt_t thick=1, TImage::ECoordMode mode=kCoordModeOrigin)
Draw a polyline.
void SetDefaults()
Set default parameters.
void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Draw wide line.
void CropPolygon(UInt_t npt, TPoint *ppt)
Crop a convex polygon.
void StartPaletteEditor()
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)
Bevel is used to create 3D effect while drawing buttons, or any other image that needs to be framed.
void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
UInt_t * GetRgbaArray()
Return a pointer to an array[width x height] of RGBA32 values.
void PolyPoint(UInt_t npt, TPoint *ppt, const char *col="#000000", TImage::ECoordMode mode=kCoordModeOrigin)
Draw a poly point.
Pixmap_t GetMask()
Returns image mask pixmap (alpha channel).
static const ASVisual * GetVisual()
Return visual.
const char * GetTitle() const
Title is used to keep 32x32 xpm image's thumbnail.
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="")
Draw image on the drawable wid (pixmap, window) at x,y position.
void SetPaletteEnabled(Bool_t on=kTRUE)
Switch on/off the image palette.
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 Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height)
The area of an image displayed in a pad is defined by this function.
void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height)
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified col...
void 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)
Draw a dashed line.
void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
TASImage * fScaledImage
! temporary scaled and zoomed image produced from original image
void FillRectangle(const char *col=0, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0)
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified col...
void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col="#000000", UInt_t thick=1)
Draw a line.
UInt_t fZoomOffX
! X - offset for zooming in image pixels
void FromWindow(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0)
Create an image (screenshot) from specified window.
void DrawFillArea(UInt_t npt, TPoint *ppt, const char *col="#000000", const char *stipple=0, UInt_t w=16, UInt_t h=16)
Fill a polygon (any type convex, non-convex).
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng)
Return in-memory buffer compressed according image type.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Is the mouse in the image ?
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
void Browse(TBrowser *)
Browse image.
void Gray(Bool_t on=kTRUE)
Convert RGB image to Gray image and vice versa.
void Tile(UInt_t width, UInt_t height)
Tile the original image.
void Draw(Option_t *option="")
Draw image.
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Write image to specified file.
char * GetObjectInfo(Int_t px, Int_t py) const
Get image pixel coordinates and the pixel value at the mouse pointer.
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
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 ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Read specified image file.
void BeginPaint(Bool_t fast=kTRUE)
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
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.
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)
Draw an ellipse.
static Bool_t InitVisual()
Static function to initialize the ASVisual.
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=0)
Flood fill.
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
Double_t * Vectorize(UInt_t max_colors=256, UInt_t dither=4, Int_t opaque_threshold=1)
Reduce color-depth of an image and fills vector of "scientific data" [0...1].
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)
This function will tile original image to specified size with offsets requested, and then it will go ...
void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd, UInt_t toWidth, UInt_t toHeight)
Another method of enlarging images where corners remain unchanged, but middle part gets tiled.
void Scale(UInt_t width, UInt_t height)
Scale the original image.
void Mirror(Bool_t vert=kTRUE)
Mirror image in place.
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)
Draw an ellipse.
TArrayD * GetArray(UInt_t w=0, UInt_t h=0, TImagePalette *pal=gWebImagePalette)
In case of vectorized image return an associated array of doubles otherwise this method creates and r...
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.
UInt_t * GetArgbArray()
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible...
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
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 PutPixel(Int_t x, Int_t y, const char *col="#000000")
Draw a point at the specified position.
void UnZoom()
Un-zoom the image to original size.
void SetPalette(const TImagePalette *palette)
Set a new palette to an image.
TASImage()
Default image constructor.
TASImage & operator=(const TASImage &img)
Image assignment operator.
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)
Draw a cubic bezier line.
Double_t * GetVecArray()
Return a pointer to internal array[width x height] of double values [0,1].
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 Paint(Option_t *option="")
Paint image.
void Flip(Int_t flip=180)
Flip image in place.
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h)
Creates an image (screenshot) from a RGBA buffer.
void FromPad(TVirtualPad *pad, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0)
Create an image from the given pad, afterwards this image can be saved in any of the supported image ...
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 DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col="#000000", UInt_t thick=1)
Draw a rectangle.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse events.
void Pad(const char *color="#00FFFFFF", UInt_t left=0, UInt_t right=0, UInt_t top=0, UInt_t bottom=0)
Enlarge image, padding it with specified color on each side in accordance with requested geometry.
static ASVisual * fgVisual
pointer to visual structure
virtual ~TASImage()
Image destructor, clean up image and visual.
void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const
Return the zoom parameters.
TObject * Clone(const char *newname) const
Clone image.
void Blur(Double_t hr=3, Double_t vr=3)
Perform Gaussian blur of the image (useful for drop shadows).
UInt_t GetScaledHeight() const
Return height of the displayed image not of the original image.
void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette=0)
Deletes the old image and creates a new image depending on the values of imageData.
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)
Draw a box.
void SetTitle(const char *title="")
Set a title for an image.
Bool_t fIsGray
! kTRUE if image is gray
void CreateThumbnail()
Create image thumbnail.
Array of doubles (64 bits per element).
void AddAt(Double_t c, Int_t i)
Set the double c value at position i in the array.
const Double_t * GetArray() const
Array of longs (32 or 64 bits per element).
void AddAt(Long_t c, Int_t i)
Add long c at position i. Check for out of bounds.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
Bool_t fConstRatio
keep aspect ratio of image on the screen
EImageQuality GetImageQuality() const
Bool_t GetConstRatio() const
virtual const TImagePalette & GetPalette() const
TImagePalette fPalette
color palette for value -> color conversion
UInt_t GetImageCompression() const
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Float_t GetTextSize() const
Return the text size.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
virtual Color_t GetTextColor() const
Return the text color.
virtual Float_t GetTextAngle() const
Return the text angle.
virtual void SetY2(Double_t y2)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void SetX1(Double_t x1)
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
virtual void SetX2(Double_t x2)
virtual void SetY1(Double_t y1)
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.
virtual void Draw(Option_t *option="")
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)
Add object to the hash table.
TObject * FindObject(const char *name) const
Find object using its name.
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.
virtual UInt_t * GetArgbArray()
virtual UInt_t GetWidth() const
static TImage * Create()
Create an image.
TImage & operator=(const TImage &img)
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual void BeginPaint(Bool_t=kTRUE)
virtual UInt_t GetHeight() const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual void Delete(Option_t *option="")
Delete this object.
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, const T &... params)
Int_t LoadPlugin()
Load the plugin library for this handler.
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
void ToLower()
Change string to lower-case.
Int_t Atoi() const
Return integer value of string.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Float_t GetScreenFactor() const
Float_t GetImageScaling() const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
TTF helper class containing glyphs description.
FT_Glyph fImage
glyph image
static Bool_t IsInitialized()
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
static void Init()
Initialise the TrueType fonts interface.
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
static void SetTextFont(Font_t fontnumber)
Set specified font.
static TTGlyph * GetGlyphs()
static Int_t GetNumGlyphs()
static const FT_BBox & GetBox()
static void SetTextSize(Float_t textsize)
Set current text size.
static FT_Matrix * GetRotMatrix()
Base class for several text objects.
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
Int_t GetNoElements() const
Element * GetMatrixArray()
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual void CellArrayEnd()=0
virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)=0
virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)=0
virtual void * GetStream() const
virtual void Open(const char *filename, Int_t type=-111)=0
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
const char * GetName() const override=0
Returns name of object.
virtual Int_t GetPixmapID() const =0
virtual Int_t VtoPixel(Double_t v) const =0
void Paint(Option_t *option="") override=0
This method must be overridden if a class wants to paint itself.
virtual Int_t UtoPixel(Double_t u) const =0
virtual Int_t GetCanvasID() const =0
virtual TCanvas * GetCanvas() const =0
virtual void SetBorderMode(Short_t bordermode)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Double_t ATan2(Double_t y, Double_t x)
Short_t Min(Short_t a, Short_t b)
Graphics context structure.
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fClipXOrigin
origin for clipping
Mask_t fMask
bit mask specifying which fields are valid
Used for drawing line segments (maps to the X11 XSegments structure)
struct _EdgeTableEntry * next
struct _ScanLineListBlock * next
EdgeTableEntry * edgelist
struct _ScanLineList * next
void flip(struct mesh *m, struct behavior *b, struct otri *flipedge)