60 # include <ft2build.h> 61 # include FT_FREETYPE_H 87 #include "RConfigure.h" 92 # include <X11/Xlib.h> 95 # include "Windows4root.h" 99 # define X_DISPLAY_MISSING 1 101 # include <afterbase.h> 103 # include <win32/config.h> 104 # include <win32/afterbase.h> 105 # define X_DISPLAY_MISSING 1 107 # include <afterimage.h> 132 #if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) && !__INTEL_COMPILER 133 #pragma GCC diagnostic ignored "-Wstrict-aliasing" 154 #define _alphaBlend(bot, top) {\ 155 __argb32__ *T = (__argb32__*)(top);\ 156 __argb32__ *B = (__argb32__*)(bot);\ 161 B->a = ((B->a*aa)>>8) + T->a;\ 162 B->r = (B->r*aa + T->r*T->a)>>8;\ 163 B->g = (B->g*aa + T->g*T->a)>>8;\ 164 B->b = (B->b*aa + T->b*T->a)>>8;\ 231 fImage = create_asimage(w ? w : 20, h ? h : 20, 0);
257 SetImage(imageData, width, height, palette);
270 SetImage(imageData, width, palette);
283 SetImage(imageData, width, palette);
298 if (img.
fImage->alt.vector) {
301 memcpy(
fImage->alt.vector, img.
fImage->alt.vector, size);
319 if (
this != &img && img.
IsValid()) {
328 if (img.
fImage->alt.vector) {
331 memcpy(
fImage->alt.vector, img.
fImage->alt.vector, size);
378 const char *delim =
":";
380 const char *delim =
";";
382 while (icon_path.
Tokenize(token, from, delim) && cnt < 6) {
398 FILE *fp = fopen(file,
"rb");
399 const char *ret =
"";
403 if (!fread(&magic, 1, 1, fp)) {
411 if (!fread(&magic, 1, 1, fp)) {
415 if (!fread(&magic, 1, 1, fp)) {
420 ret = (magic == 1) ?
"ico" :
"cur";
425 if (!fread(&magic, 1, 1, fp)) {
430 if (magic == 0x21) ret =
"ps";
431 else if (magic == 0x50) ret =
"pdf";
481 Warning(
"Scale",
"Visual not initiated");
485 Bool_t xpm = filename && (filename[0] ==
'/' &&
486 filename[1] ==
'*') && filename[2] ==
' ';
498 set_output_threshold(0);
500 static ASImageImportParams iparams;
504 iparams.filter = SCL_DO_ALL;
505 iparams.gamma = SCREEN_GAMMA;
506 iparams.gamma_table = NULL;
508 iparams.format = ASA_ASImage;
510 iparams.subimage = 0;
511 iparams.return_animation_delay = -1;
515 if (filename) dot = strrchr(filename,
'.');
528 iparams.subimage = ext.
Atoi();
530 ext = strrchr(fname.
Data(),
'.') + 1;
533 image = file2ASImage_extra(fname.
Data(), &iparams);
545 unsigned char *bitmap = 0;
551 if (!handler || ((handler->
LoadPlugin() == -1))) {
570 image = bitmap2asimage(bitmap, w, h, 0, 0);
650 Error(
"WriteImage",
"no image loaded");
654 if (!file || !*file) {
655 Error(
"WriteImage",
"no file name specified");
660 if ((s = strrchr(file,
'.'))) {
664 Error(
"WriteImage",
"cannot determine a valid file type");
672 Error(
"WriteImage",
"not a valid file type was specified");
678 ASImageFileTypes atype = (ASImageFileTypes)mytype;
686 static ASImageExportParams parms;
691 parms.xpm.type = atype;
692 parms.xpm.flags = EXPORT_ALPHA;
693 parms.xpm.dither = 4;
694 parms.xpm.opaque_threshold = 127;
695 parms.xpm.max_colors = 512;
698 ASImage2bmp(im, fname.
Data(), 0);
701 ASImage2xcf(im, fname.
Data(), 0);
704 parms.png.type = atype;
705 parms.png.flags = EXPORT_ALPHA;
709 parms.jpeg.type = atype;
710 parms.jpeg.flags = 0;
711 parms.jpeg.quality = aquality;
714 parms.gif.type = atype;
715 parms.gif.flags = EXPORT_ALPHA;
716 parms.gif.dither = 0;
717 parms.gif.opaque_threshold = 0;
721 parms.gif.type = atype;
722 parms.gif.flags = EXPORT_ALPHA | EXPORT_APPEND;
723 parms.gif.dither = 0;
724 parms.gif.opaque_threshold = 0;
725 parms.gif.animate_repeats = 0;
738 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
739 parms.gif.animate_repeats = 0;
740 }
else if(sufix==
"") {
757 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
758 parms.gif.animate_repeats = atoi(s);
767 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
768 parms.gif.animate_repeats = 0;
775 delay = atoi(sDelay);
776 parms.gif.flags |= EXPORT_ANIMATION_REPEATS;
777 parms.gif.animate_repeats = atoi(sRepeats);
779 Error(
"WriteImage",
"gif suffix %s not yet supported", s);
783 parms.gif.animate_delay = delay;
785 int i1 = fname.
Index(
"gif+");
787 fname = fname(0, i1 + 3);
790 Error(
"WriteImage",
"unexpected gif extension structure %s", fname.
Data());
796 parms.tiff.type = atype;
797 parms.tiff.flags = EXPORT_ALPHA;
798 parms.tiff.rows_per_strip = 0;
799 parms.tiff.compression_type = aquality <= 50 ? TIFF_COMPRESSION_JPEG :
800 TIFF_COMPRESSION_NONE;
801 parms.tiff.jpeg_quality = 100;
802 parms.tiff.opaque_threshold = 0;
805 Error(
"WriteImage",
"file type %s not yet supported", s);
809 if (!ASImage2file(im, 0, fname.
Data(), atype, &parms)) {
810 Error(
"WriteImage",
"error writing file %s", file);
828 if (s ==
"jpg" || s ==
"jpeg")
867 astype = ASIT_Xpm;
break;
869 astype = ASIT_ZCompressedXpm;
break;
871 astype = ASIT_GZCompressedXpm;
break;
873 astype = ASIT_Png;
break;
875 astype = ASIT_Jpeg;
break;
877 astype = ASIT_Xcf;
break;
879 astype = ASIT_Ppm;
break;
881 astype = ASIT_Pnm;
break;
883 astype = ASIT_Bmp;
break;
885 astype = ASIT_Ico;
break;
887 astype = ASIT_Cur;
break;
889 astype = ASIT_Gif;
break;
891 astype = ASIT_Gif;
break;
893 astype = ASIT_Tiff;
break;
895 astype = ASIT_Xbm;
break;
897 astype = ASIT_Targa;
break;
899 astype = ASIT_XMLScript;
break;
901 astype = ASIT_Unknown;
907 case ASIT_ZCompressedXpm:
909 case ASIT_GZCompressedXpm:
952 asquality = 25;
break;
954 asquality = 75;
break;
956 asquality = 50;
break;
958 asquality = 100;
break;
964 if (asquality > 0 && asquality <= 25)
966 if (asquality > 26 && asquality <= 50)
968 if (asquality > 51 && asquality <= 75)
970 if (asquality > 76 && asquality <= 100)
990 Warning(
"SetImage",
"Visual not initiated");
1000 for (
Int_t pixel = 1; pixel <
Int_t(width * height); pixel++) {
1008 ASVectorPalette asPalette;
1012 for (col = 0; col < 4; col++)
1013 asPalette.channels[col] =
new UShort_t[asPalette.npoints];
1020 asPalette.points =
new Double_t[asPalette.npoints];
1021 for (Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1025 height, &asPalette, ASA_ASImage,
1028 delete [] asPalette.points;
1029 for (col = 0; col < 4; col++)
1030 delete [] asPalette.channels[col];
1074 Error(
"FromPad",
"pad cannot be 0");
1079 Warning(
"FromPad",
"Visual not initiated");
1089 if (
gROOT->IsBatch()) {
1097 if (itmp && itmp->
fImage) {
1106 if (itmp && itmp->
fImage && (itmp !=
this)) {
1108 if (itmp->
fImage->alt.argb32) {
1110 fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
1111 memcpy(
fImage->alt.argb32, itmp->
fImage->alt.argb32, sz*4);
1138 static int x11 = -1;
1139 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1144 unsigned char *bits =
gVirtualX->GetColorBits(wd, 0, 0, w, h);
1149 fImage = bitmap2asimage(bits, w, h, 0, 0);
1170 Error(
"Draw",
"no image set");
1183 w =
Int_t(w*cx) + 4;
1184 h =
Int_t(h*cx) + 28;
1188 rname =
"new TCanvas(\"" + rname +
Form(
"\", %d, %d);", w, h);
1189 gROOT->ProcessLineFast(rname.Data());
1198 gPad->Range(-left / (1.0 - left - right),
1199 -bottom / (1.0 - top - bottom),
1200 1 + right / (1.0 - left - right),
1201 1 + top / ( 1.0 - top - bottom));
1202 gPad->RangeAxis(0, 0, 1, 1);
1225 wsrc = wsrc ? wsrc : im->width;
1226 hsrc = hsrc ? hsrc : im->height;
1228 static int x11 = -1;
1229 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
1236 UInt_t ww = wsrc - ow + (ow ? 8 : 0);
1243 char *bits =
new char[ww*hh];
1245 ASImageDecoder *imdec = start_image_decoding(
fgVisual, im, SCL_DO_ALPHA,
1246 xsrc, ysrc, ww, 0, 0);
1248 for (yy = 0; yy < hh; yy++) {
1249 imdec->decode_image_scanline(imdec);
1250 CARD32 *
a = imdec->buffer.alpha;
1252 for (xx = 0; xx < ww; xx++) {
1267 stop_image_decoding(&imdec);
1270 (
const char *)bits, ww, hh);
1288 if (x11 && (!
gPad ||
gPad->GetGLDevice() == -1)) {
1289 asimage2drawable(
fgVisual, wid, im, (GC)gc, xsrc, ysrc, x, y, wsrc, hsrc, 1);
1292 unsigned char *bits = (
unsigned char *)im->alt.argb32;
1294 img = tile_asimage(
fgVisual, im, xsrc, ysrc, wsrc, hsrc,
1295 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
1297 bits = (
unsigned char *)img->alt.argb32;
1304 if (
gPad &&
gPad->GetGLDevice() != -1) {
1306 painter->DrawPixels(bits, wsrc, hsrc, x, y, !option.
Contains(
"opaque"));
1314 gVirtualX->CopyArea(pic, wid, gc, 0, 0, wsrc, hsrc, x, y);
1321 destroy_asimage(&img);
1345 xsrc, ysrc, wsrc, hsrc, opt);
1364 Error(
"Paint",
"no image set");
1369 Warning(
"Paint",
"Visual not initiated");
1373 Int_t tile_x = 0, tile_y = 0;
1374 CARD32 tile_tint = 0;
1383 if (sscanf(opt.
Data() + opt.
Index(
"t"),
"t%d,%d,%s", &tile_x, &tile_y,
1386 if (parse_argb_color(stint, (CARD32*)&tile_tint) == stint)
1389 Error(
"Paint",
"tile option error");
1397 if (!
fImage->alt.vector) {
1410 to_h = (
Int_t)(to_h * (1.0 -
gPad->GetBottomMargin() -
gPad->GetTopMargin() ) + 0.5);
1411 to_w = (
Int_t)(to_w * (1.0 -
gPad->GetLeftMargin() -
gPad->GetRightMargin() ) + 0.5);
1414 if ((to_w < 25 || to_h < 25) && !expand) {
1415 Error(
"Paint",
"pad too small to display an image");
1427 Int_t pal_Ax = to_w +
gPad->UtoAbsPixel(
gPad->GetLeftMargin()) +
1428 (
gPad->UtoAbsPixel(
gPad->GetRightMargin()) / 10);
1430 Int_t pal_x = to_w +
gPad->UtoPixel(
gPad->GetLeftMargin()) +
1431 (
gPad->UtoPixel(
gPad->GetRightMargin()) / 10);
1436 ASImage *grad_im = 0;
1444 grad.type = GRADIENT_Top2Bottom;
1445 grad.color =
new ARGB32[grad.npoints];
1446 grad.offset =
new double[grad.npoints];
1449 Int_t oldPt = grad.npoints -
pt -1;
1450 grad.offset[
pt] = 1 - pal.
fPoints[oldPt];
1451 grad.color[
pt] = (((ARGB32)(pal.
fColorBlue[oldPt] & 0xff00)) >> 8) |
1453 (((ARGB32)(pal.
fColorRed[oldPt] & 0xff00)) << 8) |
1454 (((ARGB32)(pal.
fColorAlpha[oldPt] & 0xff00)) << 16);
1458 pal_h, SCL_DO_COLOR,
1461 delete [] grad.color;
1462 delete [] grad.offset;
1470 to_w, to_h, tile_tint, ASA_ASImage,
1497 ASImage *tmpImage = 0;
1508 destroy_asimage(&tmpImage);
1523 Error(
"Paint",
"image could not be rendered to display");
1527 int tox = expand ? 0 : int(
gPad->UtoPixel(1.) *
gPad->GetLeftMargin());
1528 int toy = expand ? 0 : int(
gPad->VtoPixel(0.) *
gPad->GetTopMargin());
1530 if (!
gROOT->IsBatch()) {
1545 axis.
PaintAxis(pal_Xpos,
gPad->PixeltoY(pal_Ay + pal_h - 1),
1546 pal_Xpos,
gPad->PixeltoY(pal_Ay),
1547 min, max, ndiv,
"+LU");
1552 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1553 min, max, ndiv,
"+L");
1563 gPad->XtoAbsPixel(0),
gPad->YtoAbsPixel(1));
1568 dump->
Merge(&tgrad,
"alphablend", pal_Ax, pal_Ay);
1578 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1579 min, max, ndiv,
"+L");
1583 Warning(
"Paint",
"PDF not implemented yet");
1586 Warning(
"Paint",
"SVG not implemented yet");
1606 x2 = x1+dx/image->width;
1608 y2 = y1+dy/image->height;
1610 x1 =
gPad->GetX1()+dx*
gPad->GetLeftMargin();
1611 x2 = x1+(dx*(1-
gPad->GetRightMargin()-
gPad->GetLeftMargin()))/image->width;
1612 y1 =
gPad->GetY2()-dy*
gPad->GetTopMargin();
1613 y2 = y1+(dy*(1-
gPad->GetTopMargin()-
gPad->GetBottomMargin()))/image->height;
1618 ASImageDecoder *imdec = start_image_decoding(
fgVisual, image, SCL_DO_ALL,
1619 0, 0, image->width, image->height, 0);
1621 for (
Int_t yt = 0; yt < (
Int_t)image->height; yt++) {
1622 imdec->decode_image_scanline(imdec);
1623 for (
Int_t xt = 0; xt < (
Int_t)image->width; xt++)
1625 imdec->buffer.green[xt],
1626 imdec->buffer.blue[xt]);
1628 stop_image_decoding(&imdec);
1633 Double_t xconv = (
gPad->AbsPixeltoX(pal_Ax + pal_w) -
gPad->AbsPixeltoX(pal_Ax)) / grad_im->width;
1634 Double_t yconv = (
gPad->AbsPixeltoY(pal_Ay - pal_h) -
gPad->AbsPixeltoY(pal_Ay)) / grad_im->height;
1635 x1 =
gPad->AbsPixeltoX(pal_Ax);
1637 y2 =
gPad->AbsPixeltoY(pal_Ay);
1642 imdec = start_image_decoding(
fgVisual, grad_im, SCL_DO_ALL,
1643 0, 0, grad_im->width, grad_im->height, 0);
1645 for (
Int_t yt = 0; yt < (
Int_t)grad_im->height; yt++) {
1646 imdec->decode_image_scanline(imdec);
1647 for (
Int_t xt = 0; xt < (
Int_t)grad_im->width; xt++)
1649 imdec->buffer.green[xt],
1650 imdec->buffer.blue[xt]);
1653 stop_image_decoding(&imdec);
1664 pal_Xpos,
gPad->AbsPixeltoY(pal_Ay + 1),
1665 min, max, ndiv,
"+L");
1671 destroy_asimage(&grad_im);
1680 Int_t pxl, pyl, pxt, pyt;
1687 if (px1 < px2) {pxl = px1; pxt = px2;}
1688 else {pxl = px2; pxt = px1;}
1689 if (py1 < py2) {pyl = py1; pyt = py2;}
1690 else {pyl = py2; pyt = py1;}
1692 if ((px > pxl && px < pxt) && (py > pyl && py < pyt))
1703 static TBox *ZoomBox;
1708 gPad->ExecuteEvent(event, px, py);
1714 static Int_t px1old, py1old, px2old, py2old;
1715 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
1726 if (imgX < 0) px = px - imgX;
1727 if (imgY < 0) py = py - imgY;
1732 if (imgX >= (
int)image->width) px = px - imgX + image->width - 1;
1733 if (imgY >= (
int)image->height) py = py - imgY + image->height - 1;
1738 px1 =
gPad->XtoAbsPixel(
gPad->GetX1());
1739 py1 =
gPad->YtoAbsPixel(
gPad->GetY1());
1740 px2 =
gPad->XtoAbsPixel(
gPad->GetX2());
1741 py2 =
gPad->YtoAbsPixel(
gPad->GetY2());
1742 px1old = px; py1old = py;
1764 ZoomBox =
new TBox(pxl, pyl, pxt, pyt);
1766 ZoomBox->
Draw(
"l*");
1785 Int_t imgX1 = px1old -
gPad->XtoAbsPixel(0);
1786 Int_t imgY1 = py1old -
gPad->YtoAbsPixel(1);
1787 Int_t imgX2 = px -
gPad->XtoAbsPixel(0);
1788 Int_t imgY2 = py -
gPad->YtoAbsPixel(1);
1790 imgY1 = image->height - 1 - imgY1;
1791 imgY2 = image->height - 1 - imgY2;
1797 Zoom((imgX1 < imgX2) ? imgX1 : imgX2, (imgY1 < imgY2) ? imgY1 : imgY2,
1816 static char info[64];
1822 px -=
gPad->XtoAbsPixel(0);
1823 py -=
gPad->YtoAbsPixel(1);
1826 if (px < 0 || py < 0)
return info;
1830 if (px >= (
int)image->width || py >= (
int)image->height)
1833 py = image->height - 1 - py;
1840 if (
fImage->alt.vector) {
1841 snprintf(info,64,
"x: %d y: %d %.5g",
1844 snprintf(info,64,
"x: %d y: %d", px, py);
1860 Warning(
"SetPalette",
"Visual not initiated");
1865 Warning(
"SetPalette",
"Image not valid");
1869 if (
fImage->alt.vector == 0)
1875 ASVectorPalette asPalette;
1877 asPalette.channels[0] =
new CARD16 [asPalette.npoints];
1878 asPalette.channels[1] =
new CARD16 [asPalette.npoints];
1879 asPalette.channels[2] =
new CARD16 [asPalette.npoints];
1880 asPalette.channels[3] =
new CARD16 [asPalette.npoints];
1886 asPalette.points =
new double[asPalette.npoints];
1887 for (
Int_t point = 0; point <
Int_t(asPalette.npoints); point++)
1893 delete [] asPalette.points;
1894 for (Int_t col = 0; col < 4; col++)
1895 delete [] asPalette.channels[col];
1914 Warning(
"Scale",
"Image not initiated");
1919 Warning(
"Scale",
"Visual not initiated");
1927 if (toWidth > 30000)
1929 if (toHeight > 30000)
1932 ASImage *img = scale_asimage(
fgVisual,
fImage, toWidth, toHeight,
1949 Warning(
"Scale",
"Image not initiated");
1954 Warning(
"Scale",
"Visual not initiated");
1962 if (toWidth > 30000)
1964 if (toHeight > 30000)
1968 yStart, yEnd, toWidth, toHeight,
1984 Warning(
"Tile",
"Image not initiated");
1989 Warning(
"Tile",
"Visual not initiated");
1997 if (toWidth > 30000)
1999 if (toHeight > 30000)
2002 ASImage *img = tile_asimage(
fgVisual,
fImage, 0, 0, toWidth, toHeight, 0,
2024 Warning(
"Zoom",
"Image not valid");
2046 Warning(
"UnZoom",
"Image not valid");
2074 Warning(
"Flip",
"Image not valid");
2078 Warning(
"Flip",
"Visual not initiated");
2082 if (
fImage->alt.vector) {
2083 Warning(
"Flip",
"flip does not work for data images");
2087 Int_t rflip = flip/90;
2121 Warning(
"Mirror",
"Image not valid");
2126 Warning(
"Mirror",
"Visual not initiated");
2130 if (
fImage->alt.vector) {
2131 Warning(
"Mirror",
"mirror does not work for data images");
2203 if (inbatch && !noX) {
2215 fgVisual = create_asvisual(0, 0, 0, 0);
2222 fgVisual = create_asvisual(0, 0, 0, 0);
2225 disp = (Display*)
gVirtualX->GetDisplay();
2228 Visual *vis = (Visual*)
gVirtualX->GetVisual();
2231 if (vis == 0 || cmap == 0) {
2232 fgVisual = create_asvisual(0, 0, 0, 0);
2234 fgVisual = create_asvisual_for_id(disp, screen, depth,
2235 XVisualIDFromVisual(vis), cmap, 0);
2239 fgVisual = create_asvisual(0, 0, 0, 0);
2252 Warning(
"StartPaletteEditor",
"Image not valid");
2255 if (
fImage->alt.vector == 0) {
2256 Warning(
"StartPaletteEditor",
"palette can be modified only for data images");
2271 Warning(
"GetPixmap",
"Visual not initiated");
2279 static int x11 = -1;
2280 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2286 if (!
fImage->alt.argb32) {
2289 ret =
gVirtualX->CreatePixmapFromData((
unsigned char*)
fImage->alt.argb32,
2305 Warning(
"GetMask",
"Visual not initiated");
2312 Warning(
"GetMask",
"No image");
2317 UInt_t ow = img->width%8;
2318 UInt_t ww = img->width - ow + (ow ? 8 : 0);
2325 char *bits =
new char[ww*hh];
2327 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALPHA,
2334 for (y = 0; y < hh; y++) {
2335 imdec->decode_image_scanline(imdec);
2336 CARD32 *
a = imdec->buffer.alpha;
2338 for (x = 0; x < ww; x++) {
2352 stop_image_decoding(&imdec);
2353 pxmap =
gVirtualX->CreateBitmap(
gVirtualX->GetDefaultRootWindow(), (
const char *)bits,
2365 Warning(
"SetImage",
"Visual not initiated");
2375 gVirtualX->GetWindowSize(pxm, xy, xy, w, h);
2379 static int x11 = -1;
2380 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
2385 unsigned char *bits =
gVirtualX->GetColorBits(pxm, 0, 0, w, h);
2392 fImage = bitmap2asimage(bits, w, h, 0, 0);
2396 unsigned char *mask_bits =
gVirtualX->GetColorBits(mask, 0, 0, w, h);
2397 fImage = bitmap2asimage(bits, w, h, 0, mask_bits);
2398 delete [] mask_bits;
2409 Warning(
"GetPixels",
"Wrong Image");
2414 ASImageDecoder *imdec;
2416 width = !width ? img->width : width;
2417 height = !height ? img->height : height;
2428 if ((x >= (
int)img->width) || (y >= (
int)img->height)) {
2432 if ((
int)(x + width) > (
int)img->width) {
2433 width = img->width -
x;
2436 if ((
int)(y + height) > (
int)img->height) {
2437 height = img->height -
y;
2440 if ((imdec = start_image_decoding(0,
fImage, SCL_DO_ALL, 0, y,
2441 img->width, height, 0)) == 0) {
2442 Warning(
"GetPixels",
"Failed to create image decoder");
2452 for (
UInt_t k = 0; k < height; k++) {
2453 imdec->decode_image_scanline(imdec);
2455 for (
UInt_t i = 0; i < width; ++i) {
2456 if ((r == (
Int_t)imdec->buffer.red[i]) &&
2457 (g == (
Int_t)imdec->buffer.green[i]) &&
2458 (b == (
Int_t)imdec->buffer.blue[i])) {
2460 r = (
Int_t)imdec->buffer.red[i];
2461 g = (
Int_t)imdec->buffer.green[i];
2462 b = (
Int_t)imdec->buffer.blue[i];
2465 ret->
AddAt(p, k*width + i);
2469 stop_image_decoding(&imdec);
2481 Warning(
"GetVecArray",
"Bad Image");
2484 if (
fImage->alt.vector) {
2485 return fImage->alt.vector;
2503 Warning(
"GetArray",
"Bad Image");
2509 if (
fImage->alt.vector) {
2514 ASImageDecoder *imdec;
2516 w = w ? w :
fImage->width;
2525 if ((imdec = start_image_decoding(0, img, SCL_DO_ALL, 0, 0,
2526 img->width, 0, 0)) == 0) {
2527 Warning(
"GetArray",
"Failed to create image decoder");
2538 for (
UInt_t k = 0; k <
h; k++) {
2539 imdec->decode_image_scanline(imdec);
2541 for (
UInt_t i = 0; i < w; ++i) {
2542 if ((r == imdec->buffer.red[i]) &&
2543 (g == imdec->buffer.green[i]) &&
2544 (b == imdec->buffer.blue[i])) {
2546 r = imdec->buffer.red[i];
2547 g = imdec->buffer.green[i];
2548 b = imdec->buffer.blue[i];
2549 if (palette) p = palette->
FindColor(r, g, b);
2551 v = palette ? palette->
fPoints[p] :
Double_t((r << 16) + (g << 8) + b)/0xFFFFFF;
2552 ret->
AddAt(v, (h-k-1)*w + i);
2556 stop_image_decoding(&imdec);
2579 const char *color,
const char *font_name,
2582 UInt_t width=0, height=0;
2583 ARGB32 text_color = ARGB32_Black;
2584 ASImage *fore_im = 0;
2585 ASImage *text_im = 0;
2589 Warning(
"DrawText",
"Visual not initiated");
2597 if (fn.
Last(
'/') == 0) fn = fn(1, fn.
Length() - 1);
2610 parse_argb_color(color, &text_color);
2623 Warning(
"DrawText",
"cannot create Font Manager");
2630 font = get_asfont(
gFontManager,
"fixed", 0, size, ASF_GuessWho);
2632 Warning(
"DrawText",
"cannot find a font %s", font_name);
2637 get_text_size(text, font, (ASText3DType)type, &width, &height);
2640 fImage = create_asimage(width, height, 0);
2644 text_im = draw_text(text, font, (ASText3DType)type, 0);
2649 ASImage *tmp = file2ASImage(fore_file, 0xFFFFFFFF, SCREEN_GAMMA, 0, 0);
2651 if ((tmp->width != width) || (tmp->height != height)) {
2652 fore_im = tile_asimage(
fgVisual, tmp, 0, 0, width, height, 0,
2655 destroy_asimage(&tmp);
2662 move_asimage_channel(fore_im, IC_ALPHA, text_im, IC_ALPHA);
2663 destroy_asimage(&text_im);
2671 ASImage *rendered_im;
2672 ASImageLayer layers[2];
2674 init_image_layers(&(layers[0]), 2);
2675 fore_im->back_color = text_color;
2676 layers[0].im = rimg;
2677 layers[0].dst_x = 0;
2678 layers[0].dst_y = 0;
2679 layers[0].clip_width = rimg->width;
2680 layers[0].clip_height = rimg->height;
2681 layers[0].bevel = 0;
2682 layers[1].im = fore_im;
2683 layers[1].dst_x =
x;
2684 layers[1].dst_y =
y;
2685 layers[1].clip_width = fore_im->width;
2686 layers[1].clip_height = fore_im->height;
2688 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, rimg->width, rimg->height,
2691 destroy_asimage(&fore_im);
2724 Warning(
"Merge",
"Visual not initiated");
2728 ASImage *rendered_im;
2729 ASImageLayer layers[2];
2731 init_image_layers(&(layers[0]), 2);
2733 layers[0].dst_x = 0;
2734 layers[0].dst_y = 0;
2735 layers[0].clip_width =
fImage->width;
2736 layers[0].clip_height =
fImage->height;
2737 layers[0].bevel = 0;
2738 layers[1].im = ((
TASImage*)im)->fImage;
2739 layers[1].dst_x =
x;
2740 layers[1].dst_y =
y;
2741 layers[1].clip_width = im->
GetWidth();
2742 layers[1].clip_height = im->
GetHeight();
2743 layers[1].merge_scanlines = blend_scanlines_name2func(op ? op :
"add");
2761 Warning(
"Blur",
"Visual not initiated");
2766 fImage = create_asimage(100, 100, 0);
2769 Warning(
"Blur",
"Failed to create image");
2776 ASImage *rendered_im = blur_asimage_gauss(
fgVisual,
fImage, hr > 0 ? hr : 3,
2777 vr > 0 ? vr : 3, SCL_DO_ALL,
2790 Warning(
"Clone",
"Image not initiated");
2797 Warning(
"Clone",
"Failed to create image");
2813 if (
fImage->alt.argb32) {
2815 im->
fImage->alt.argb32 = (ARGB32*)safemalloc(sz*
sizeof(ARGB32));
2816 memcpy(im->
fImage->alt.argb32,
fImage->alt.argb32, sz *
sizeof(ARGB32));
2836 Warning(
"Vectorize",
"Visual not initiated");
2841 fImage = create_asimage(100, 100, 0);
2844 Warning(
"Vectorize",
"Failed to create image");
2855 dither = dither > 7 ? 7 : dither;
2857 res = colormap_asimage(
fImage, &cmap, max_colors, dither, opaque_threshold);
2869 g = INDEX_SHIFT_GREEN(cmap.entries[res[i]].green);
2870 b = INDEX_SHIFT_BLUE(cmap.entries[res[i]].blue);
2871 r = INDEX_SHIFT_RED(cmap.entries[res[i]].red);
2873 v = MAKE_INDEXED_COLOR24(r,
g,
b);
2883 for (
UInt_t j = 0; j < cmap.count; j++) {
2884 g = INDEX_SHIFT_GREEN(cmap.entries[j].green);
2885 b = INDEX_SHIFT_BLUE(cmap.entries[j].blue);
2886 r = INDEX_SHIFT_RED(cmap.entries[j].red);
2887 v = MAKE_INDEXED_COLOR24(r,
g,
b);
2889 v = (v>>12) & 0x0FFF;
2892 pal->
fColorRed[j] = cmap.entries[j].red << 8;
2894 pal->
fColorBlue[j] = cmap.entries[j].blue << 8;
2898 destroy_colormap(&cmap,
kTRUE);
2901 fImage->alt.vector = vec;
2903 if (res)
delete res;
2949 Warning(
"HSV",
"Visual not initiated");
2954 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
2957 Warning(
"HSV",
"Failed to create image");
2966 width = !width ?
fImage->width : width;
2967 height = !height ?
fImage->height : height;
2969 ASImage *rendered_im = 0;
2972 rendered_im = adjust_asimage_hsv(
fgVisual,
fImage, x, y, width, height,
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);
3301 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
3304 Warning(
"Bevel",
"Failed to create image");
3313 width = !width ?
fImage->width : width;
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");
3387 ARGB32 color = ARGB32_White;
3388 parse_argb_color(col, &color);
3399 Warning(
"Pad",
"Failed to create output image");
3416 Warning(
"Crop",
"Visual not initiated");
3428 width = x + width >
fImage->width ?
fImage->width -
x : width;
3429 height = y + height >
fImage->height ?
fImage->height -
y : height;
3431 if ((width ==
fImage->width) && (height ==
fImage->height)) {
3432 Warning(
"Crop",
"input size larger than image");
3435 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
3436 x, y, width, height, 0);
3439 Warning(
"Crop",
"Failed to start image decoding");
3443 ASImage *img = create_asimage(width, height, 0);
3447 Warning(
"Crop",
"Failed to create image");
3451 ASImageOutput *imout = start_image_output(
fgVisual, img, ASA_ASImage,
3455 Warning(
"Crop",
"Failed to start image output");
3456 destroy_asimage(&img);
3457 if (imdec)
delete [] imdec;
3465 for (
UInt_t i = 0; i < height; i++) {
3466 imdec->decode_image_scanline(imdec);
3467 imout->output_image_scanline(imout, &(imdec->buffer), 1);
3470 stop_image_decoding(&imdec);
3471 stop_image_output(&imout);
3495 Warning(
"Append",
"Visual not initiated");
3512 Merge(im,
"alphablend", width, 0);
3513 }
else if (opt ==
"/") {
3515 Merge(im,
"alphablend", 0, height);
3534 Warning(
"BeginPaint",
"Visual not initiated");
3549 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
3552 Warning(
"BeginPaint",
"Failed to create image");
3566 Warning(
"EndPaint",
"no image");
3570 if (!
fImage->alt.argb32)
return;
3573 0, ASA_ASImage, 0, ASIMAGE_QUALITY_DEFAULT);
3576 Warning(
"EndPaint",
"Failed to create image");
3593 Warning(
"GetArgbArray",
"no image");
3600 if (!img->alt.argb32) {
3610 return (
UInt_t *)img->alt.argb32;
3621 Warning(
"GetRgbaArray",
"no image");
3628 if (!img->alt.argb32) {
3646 for (i = 0; i < img->height; i++) {
3647 for (j = 0; j < img->width; j++) {
3649 argb = img->alt.argb32[idx];
3651 rgb = argb & 0x00ffffff;
3652 rgba = (rgb << 8) + a;
3667 Warning(
"GetScanline",
"no image");
3672 CARD32 *ret =
new CARD32[img->width];
3674 ASImageDecoder *imdec = start_image_decoding(
fgVisual, img, SCL_DO_ALL,
3675 0, y, img->width, 1, 0);
3679 Warning(
"GetScanline",
"Failed to start image decoding");
3687 imdec->decode_image_scanline(imdec);
3688 memcpy(imdec->buffer.buffer, ret, img->width*
sizeof(CARD32));
3689 stop_image_decoding(&imdec);
3704 #if defined(R__GNU) && defined(__i386__) && !defined(__sun) 3705 #define _MEMSET_(dst, lng, val) __asm__("movl %0,%%eax \n"\ 3706 "movl %1,%%edi \n" \ 3707 "movl %2,%%ecx \n" \ 3712 :"g" (val), "g" (dst), "g" (lng) \ 3713 :"eax","edi","ecx" \ 3717 #define _MEMSET_(dst, lng, val) do {\ 3718 for( UInt_t j=0; j < lng; j++) *((dst)+j) = val; } while (0) 3722 #define FillSpansInternal(npt, ppt, widths, color) do {\ 3723 UInt_t yy = ppt[0].fY*fImage->width;\ 3724 for (UInt_t i = 0; i < npt; i++) {\ 3725 _MEMSET_(&fImage->alt.argb32[Idx(yy + ppt[i].fX)], widths[i], color);\ 3726 yy += ((i+1 < npt) && (ppt[i].fY != ppt[i+1].fY) ? fImage->width : 0);\ 3738 Warning(
"FillRectangle",
"Visual not initiated");
3743 Warning(
"FillRectangle",
"no image");
3747 if (!
fImage->alt.argb32) {
3751 if (!
fImage->alt.argb32) {
3752 Warning(
"FillRectangle",
"Failed to get pixel array");
3756 ARGB32 color = (ARGB32)col;
3758 if (width == 0) width = 1;
3759 if (height == 0) height = 1;
3770 Bool_t has_alpha = (color & 0xff000000) != 0xff000000;
3775 width = x + width >
fImage->width ?
fImage->width -
x : width;
3776 height = y + height >
fImage->height ?
fImage->height -
y : height;
3778 if (!
fImage->alt.argb32) {
3781 int yyy = y*
fImage->width;
3783 ARGB32 *p0 =
fImage->alt.argb32 + yyy +
x;
3785 for (
UInt_t i = 0; i < height; i++) {
3790 for (
UInt_t i = y; i < y + height; i++) {
3815 Warning(
"Fill",
"Visual not initiated");
3819 ARGB32 color = ARGB32_White;
3822 parse_argb_color(col, &color);
3826 fImage = create_asimage(width ? width : 20, height ? height : 20, 0);
3840 ARGB32 color = (ARGB32)col;
3843 if (!thick) thick = 1;
3851 thick += (x - half);
3857 x = x + thick >=
fImage->width ?
fImage->width - thick - 1 :
x;
3859 int yy = y1*
fImage->width;
3861 for (
UInt_t w = 0; w < thick; w++) {
3862 if (x + w < fImage->width) {
3875 ARGB32 color = (ARGB32)col;
3878 if (!thick) thick = 1;
3886 thick += (y - half);
3890 y = y + thick >=
fImage->height ?
fImage->height - thick - 1 :
y;
3894 int yy = y*
fImage->width;
3895 for (
UInt_t w = 0; w < thick; w++) {
3897 if (y + w < fImage->height) {
3909 const char *col,
UInt_t thick)
3911 ARGB32 color = ARGB32_White;
3912 parse_argb_color(col, &color);
3924 int x,
y, xend, yend;
3931 Warning(
"DrawLine",
"Visual not initiated");
3936 Warning(
"DrawLine",
"no image");
3940 if (!
fImage->alt.argb32) {
3944 if (!
fImage->alt.argb32) {
3945 Warning(
"DrawLine",
"Failed to get pixel array");
3949 ARGB32 color = (ARGB32)col;
3954 if (!dx && !dy)
return;
3958 y2 > y1 ? y2 : y1, color, thick);
3964 x2 > x1 ? x2 : x1, color, thick);
3976 i2 = i1 - (dx << 1);
3993 q = (y2 - y1) * ydir;
4026 i2 = i1 - (dy << 1);
4043 q = (x2 -
x1) * xdir;
4081 const char *col,
UInt_t thick)
4084 Warning(
"DrawRectangle",
"Visual not initiated");
4093 fImage = create_asimage(w, h, 0);
4098 if (!
fImage->alt.argb32) {
4102 if (!
fImage->alt.argb32) {
4103 Warning(
"DrawRectangle",
"Failed to get pixel array");
4107 ARGB32 color = ARGB32_White;
4108 parse_argb_color(col, &color);
4128 ARGB32 color = ARGB32_White;
4133 fImage = create_asimage(w, h, 0);
4139 parse_argb_color(col, &color);
4145 parse_argb_color(col, &color);
4175 ARGB32 color = (ARGB32)col;
4185 thick += (y - half);
4188 thick = thick <= 0 ? 1 : thick;
4190 y = y + thick >=
fImage->height ?
fImage->height - thick - 1 :
y;
4196 x1 = x2 < x1 ?
x2 :
x1;
4197 x2 = x2 < tmp ? tmp :
x2;
4200 for (
UInt_t w = 0; w < thick; w++) {
4201 if (y + w < fImage->height) {
4209 if (i >= pDash[iDash]) {
4213 if (iDash >= nDash) {
4229 ARGB32 color = (ARGB32)col;
4239 thick += (x - half);
4242 thick = thick <= 0 ? 1 : thick;
4249 y1 = y2 < y1 ? y2 : y1;
4250 y2 = y2 < tmp ? tmp : y2;
4252 x = x + thick >=
fImage->width ?
fImage->width - thick - 1 :
x;
4254 int yy = y1*
fImage->width;
4256 for (
UInt_t w = 0; w < thick; w++) {
4257 if (x + w < fImage->width) {
4265 if (i >= pDash[iDash]) {
4269 if (iDash >= nDash) {
4285 int x,
y, xend, yend;
4295 char *pDash =
new char[nDash];
4300 for (i = 0; i < (int)nDash; i++) {
4306 i2 = i1 - (dx << 1);
4324 q = (y2 - y1) * ydir;
4329 if ((iDash%2) == 0) {
4341 if (i >= pDash[iDash]) {
4345 if (iDash >= nDash) {
4353 if ((iDash%2) == 0) {
4365 if (i >= pDash[iDash]) {
4369 if (iDash >= nDash) {
4378 for (i = 0; i < (int)nDash; i++) {
4384 i2 = i1 - (dy << 1);
4402 q = (x2 -
x1) * xdir;
4407 if ((iDash%2) == 0) {
4421 if (i >= pDash[iDash]) {
4425 if (iDash >= nDash) {
4433 if ((iDash%2) == 0) {
4447 if (i >= pDash[iDash]) {
4451 if (iDash >= nDash) {
4469 double x,
y, xend=0, yend=0, x0, y0;
4477 double *xDash =
new double[nDash];
4478 double *yDash =
new double[nDash];
4483 for (i = 0; i < (int)nDash; i++) {
4484 xDash[i] = tDash[i] * ac;
4485 yDash[i] = tDash[i] *
as;
4489 xDash[i] = xDash[i]/2;
4490 yDash[i] = yDash[i]/2;
4492 xDash[i] = xDash[i]*2;
4493 yDash[i] = yDash[i]*2;
4510 q = (y2 - y1) * ydir;
4517 while ((x < xend) && (y < yend)) {
4521 if ((iDash%2) == 0) {
4531 if (iDash >= nDash) {
4536 while ((x < xend) && (y > yend)) {
4540 if ((iDash%2) == 0) {
4550 if (iDash >= nDash) {
4569 q = (x2 -
x1) * xdir;
4576 while ((x < xend) && (y < yend)) {
4580 if ((iDash%2) == 0) {
4590 if (iDash >= nDash) {
4595 while ((x > xend) && (y < yend)) {
4599 if ((iDash%2) == 0) {
4609 if (iDash >= nDash) {
4623 const char *pDash,
const char *col,
UInt_t thick)
4627 Warning(
"DrawDashLine",
"Visual not initiated");
4632 Warning(
"DrawDashLine",
"no image");
4636 if (!
fImage->alt.argb32) {
4640 if (!
fImage->alt.argb32) {
4641 Warning(
"DrawDashLine",
"Failed to get pixel array");
4645 if ((nDash < 2) || !pDash || (nDash%2)) {
4646 Warning(
"DrawDashLine",
"Wrong input parameters n=%d %ld", nDash, (
Long_t)
sizeof(pDash)-1);
4650 ARGB32 color = ARGB32_White;
4651 parse_argb_color(col, &color);
4655 }
else if (y1 == y2) {
4669 ARGB32 color = ARGB32_White;
4670 parse_argb_color(col, &color);
4677 for (
UInt_t i = 1; i < nn; i++) {
4694 Warning(
"PutPixel",
"Visual not initiated");
4699 Warning(
"PutPixel",
"no image");
4703 if (!
fImage->alt.argb32) {
4707 if (!
fImage->alt.argb32) {
4708 Warning(
"PutPixel",
"Failed to get pixel array");
4713 parse_argb_color(col, &color);
4715 if ((x < 0) || (y < 0) || (x >= (
int)
fImage->width) || (y >= (
int)
fImage->height)) {
4716 Warning(
"PutPixel",
"Out of range width=%d x=%d, height=%d y=%d",
4729 Warning(
"PolyPoint",
"Visual not initiated");
4734 Warning(
"PolyPoint",
"no image");
4738 if (!
fImage->alt.argb32) {
4742 if (!
fImage->alt.argb32) {
4743 Warning(
"PolyPoint",
"Failed to get pixel array");
4748 Warning(
"PolyPoint",
"No points specified");
4755 parse_argb_color(col, &color);
4761 for (i = 0; i < npt; i++) {
4762 ipt[i].
fX += ppt[i].
fX;
4763 ipt[i].
fY += ppt[i].
fY;
4768 for (i = 0; i < npt; i++) {
4769 x = ipt ? ipt[i].
fX : ppt[i].
fX;
4770 y = ipt ? ipt[i].
fY : ppt[i].
fY;
4772 if ((x < 0) || (y < 0) || (x >= (
int)
fImage->width) || (y >= (
int)
fImage->height)) {
4788 if (!nseg || !seg) {
4789 Warning(
"DrawSegments",
"Invalid data nseg=%d seg=0x%lx", nseg, (
Long_t)seg);
4795 for (
UInt_t i = 0; i < nseg; i++) {
4796 pt[0].
fX = seg->
fX1;
4797 pt[1].
fX = seg->
fX2;
4798 pt[0].
fY = seg->
fY1;
4799 pt[1].
fY = seg->
fY2;
4813 Warning(
"FillSpans",
"Visual not initiated");
4818 Warning(
"FillSpans",
"no image");
4822 if (!
fImage->alt.argb32) {
4826 if (!
fImage->alt.argb32) {
4827 Warning(
"FillSpans",
"Failed to get pixel array");
4831 if (!npt || !ppt || !widths || (stipple && (!w || !h))) {
4832 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%lx col=%s widths=0x%lx stipple=0x%lx w=%d h=%d",
4838 parse_argb_color(col, &color);
4843 for (
UInt_t i = 0; i < npt; i++) {
4845 for (
UInt_t j = 0; j < widths[i]; j++) {
4846 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4857 if (stipple[ii >> 3] & (1 << (ii%8))) {
4871 Warning(
"FillSpans",
"Visual not initiated");
4876 Warning(
"FillSpans",
"no image");
4880 if (!
fImage->alt.argb32) {
4884 if (!
fImage->alt.argb32) {
4885 Warning(
"FillSpans",
"Failed to get pixel array");
4889 if (!npt || !ppt || !widths || !tile) {
4890 Warning(
"FillSpans",
"Invalid input data npt=%d ppt=0x%lx widths=0x%lx tile=0x%lx",
4904 for (
UInt_t i = 0; i < npt; i++) {
4907 for (
UInt_t j = 0; j < widths[i]; j++) {
4908 if ((ppt[i].fX >= (
Int_t)
fImage->width) || (ppt[i].
fX < 0) ||
4927 Warning(
"CropSpans",
"Visual not initiated");
4932 Warning(
"CropSpans",
"no image");
4936 if (!
fImage->alt.argb32) {
4940 if (!
fImage->alt.argb32) {
4941 Warning(
"CropSpans",
"Failed to get pixel array");
4945 if (!npt || !ppt || !widths) {
4946 Warning(
"CropSpans",
"No points specified npt=%d ppt=0x%lx widths=0x%lx", npt, (
Long_t)ppt, (
Long_t)widths);
4951 int y1 = ppt[npt-1].
fY;
4959 for (y = 0; (int)y < y0; y++) {
4960 for (x = 0; x <
fImage->width; x++) {
4962 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4967 for (i = 0; i < npt; i++) {
4968 for (x = 0; (int)x < ppt[i].fX; x++) {
4970 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4972 for (x = ppt[i].fX + widths[i] + 1; x <
fImage->width; x++) {
4974 if (idx < sz)
fImage->alt.argb32[idx] = 0;
4979 for (y = y1; y <
fImage->height; y++) {
4980 for (x = 0; x <
fImage->width; x++) {
4982 if (idx < sz)
fImage->alt.argb32[idx] = 0;
5016 Warning(
"CopyArea",
"Visual not initiated");
5021 Warning(
"CopyArea",
"no image");
5026 ASImage *out = ((
TASImage*)dst)->GetImage();
5032 xsrc = xsrc < 0 ? 0 : xsrc;
5033 ysrc = ysrc < 0 ? 0 : ysrc;
5035 if ((xsrc >= (
int)
fImage->width) || (ysrc >= (
int)
fImage->height))
return;
5037 w = xsrc + w >
fImage->width ?
fImage->width - xsrc : w;
5041 if (!
fImage->alt.argb32) {
5044 if (!out->alt.argb32) {
5046 out = ((
TASImage*)dst)->GetImage();
5049 if (
fImage->alt.argb32 && out->alt.argb32) {
5050 for (y = 0; y < (int)h; y++) {
5051 for (x = 0; x < (int)w; x++) {
5052 idx =
Idx(yy + x + xsrc);
5053 if ((x + xdst < 0) || (ydst + y < 0) ||
5054 (x + xdst >= (
int)out->width) || (y + ydst >= (
int)out->height) )
continue;
5056 idx2 =
Idx((ydst + y)*out->width + x + xdst);
5060 out->alt.argb32[idx2] = 0;
5063 out->alt.argb32[idx2] &=
fImage->alt.argb32[idx];
5066 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] & (~out->alt.argb32[idx2]);
5069 out->alt.argb32[idx2] &= ~
fImage->alt.argb32[idx];
5074 out->alt.argb32[idx2] ^=
fImage->alt.argb32[idx];
5077 out->alt.argb32[idx2] |=
fImage->alt.argb32[idx];
5080 out->alt.argb32[idx2] = (~
fImage->alt.argb32[idx]) & (~out->alt.argb32[idx2]);
5083 out->alt.argb32[idx2] ^= ~
fImage->alt.argb32[idx];
5086 out->alt.argb32[idx2] = ~out->alt.argb32[idx2];
5089 out->alt.argb32[idx2] =
fImage->alt.argb32[idx] | (~out->alt.argb32[idx2]);
5092 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]) | (~out->alt.argb32[idx2]);
5101 out->alt.argb32[idx2] = 0xFFFFFFFF;
5105 out->alt.argb32[idx2] =
fImage->alt.argb32[idx];
5129 int i, j, ix, iy, w,
h;
5131 ARGB32 color = 0xFFFFFFFF;
5138 for (i = 0; i < nx; i++) {
5140 for (j = 0; j < ny; j++) {
5141 icol = (ARGB32)ic[i + (nx*j)];
5142 if (icol != color) {
5181 ymin = ymax = (pts++)->fY;
5184 if (pts->
fY < ymin) {
5188 if (pts->
fY > ymax) {
5196 return (ptMin - ptsStart);
5212 int mr = 0, m1r = 0;
5213 int incr1l = 0, incr2l = 0;
5214 int incr1r = 0, incr2r = 0;
5219 int nextleft, nextright;
5232 Warning(
"GetPolygonSpans",
"Visual not initiated");
5237 Warning(
"GetPolygonSpans",
"no image");
5241 if (!
fImage->alt.argb32) {
5245 if (!
fImage->alt.argb32) {
5246 Warning(
"GetPolygonSpans",
"Failed to get pixel array");
5250 if ((npt < 3) || !ppt) {
5251 Warning(
"GetPolygonSpans",
"No points specified npt=%d ppt=0x%lx", npt, (
Long_t)ppt);
5259 dy = ymax - ymin + 1;
5260 if ((npt < 3) || (dy < 0))
return kFALSE;
5262 ptsOut = firstPoint =
new TPoint[dy];
5263 width = firstWidth =
new UInt_t[dy];
5266 nextleft = nextright = imin;
5267 y = ppt[nextleft].
fY;
5272 if (ppt[nextleft].fY == y) {
5278 if (nextleft >= (
int)npt) {
5285 ppt[left].fX, ppt[nextleft].fX,
5286 xl, dl, ml, m1l, incr1l, incr2l);
5290 if (ppt[nextright].fY == y) {
5296 if (nextright < 0) {
5303 ppt[right].fX, ppt[nextright].fX,
5304 xr, dr, mr, m1r, incr1r, incr2r);
5309 i =
TMath::Min(ppt[nextleft].fY, ppt[nextright].fY) -
y;
5313 delete [] firstWidth;
5314 delete [] firstPoint;
5323 *(width++) = xr - xl;
5324 (ptsOut++)->fX = xl;
5326 *(width++) = xl - xr;
5327 (ptsOut++)->fX = xr;
5335 }
while (y != ymax);
5337 *nspans =
UInt_t(ptsOut - firstPoint);
5338 *outPoint = firstPoint;
5339 *outWidth = firstWidth;
5356 ARGB32 color = ARGB32_White;
5357 parse_argb_color(col, &color);
5360 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5363 FillSpans(nspans, firstPoint, firstWidth, col, stipple, w, h);
5367 delete [] firstWidth;
5368 delete [] firstPoint;
5371 if (firstWidth)
delete [] firstWidth;
5372 if (firstPoint)
delete [] firstPoint;
5389 FillSpans(nspans, firstPoint, firstWidth, tile);
5392 delete [] firstWidth;
5393 delete [] firstPoint;
5396 if (firstWidth)
delete [] firstWidth;
5397 if (firstPoint)
delete [] firstPoint;
5413 CropSpans(nspans, firstPoint, firstWidth);
5416 delete [] firstWidth;
5417 delete [] firstPoint;
5420 if (firstWidth)
delete [] firstWidth;
5421 if (firstPoint)
delete [] firstPoint;
5434 Warning(
"DrawFillArea",
"Visual not initiated");
5439 Warning(
"DrawFillArea",
"no image");
5443 if (!
fImage->alt.argb32) {
5447 if (!
fImage->alt.argb32) {
5448 Warning(
"DrawFillArea",
"Failed to get pixel array");
5452 if ((count < 3) || !ptsIn) {
5453 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%lx", count, (
Long_t)ptsIn);
5462 ARGB32 color = ARGB32_White;
5463 parse_argb_color(col, &color);
5481 static const UInt_t gEdgeTableEntryCacheSize = 200;
5482 static EdgeTableEntry gEdgeTableEntryCache[gEdgeTableEntryCacheSize];
5484 if (count < gEdgeTableEntryCacheSize) {
5492 ptsOut = firstPoint;
5495 pSLL = ET.scanlines.next;
5497 for (y = ET.ymin; y < ET.ymax; y++) {
5498 if (pSLL && y == pSLL->scanline) {
5499 loadAET(&AET, pSLL->edgelist);
5506 ptsOut->
fX = pAET->bres.minor_axis;
5511 *width++ = pAET->next->bres.minor_axis - pAET->bres.minor_axis;
5514 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5517 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w, h);
5519 ptsOut = firstPoint;
5530 if (!stipple && ((color & 0xff000000)==0xff000000)) {
5533 FillSpans(nPts, firstPoint, firstWidth, col, stipple, w, h);
5537 if (del)
delete [] pETEs;
5547 Warning(
"DrawFillArea",
"Visual not initiated");
5552 Warning(
"DrawFillArea",
"no image");
5556 if (!
fImage->alt.argb32) {
5560 if (!
fImage->alt.argb32) {
5561 Warning(
"DrawFillArea",
"Failed to get pixel array");
5565 if ((count < 3) || !ptsIn) {
5566 Warning(
"DrawFillArea",
"No points specified npt=%d ppt=0x%lx", count, (
Long_t)ptsIn);
5592 ptsOut = firstPoint;
5595 pSLL = ET.scanlines.next;
5597 for (y = ET.ymin; y < ET.ymax; y++) {
5598 if (pSLL && y == pSLL->scanline) {
5599 loadAET(&AET, pSLL->edgelist);
5606 ptsOut->
fX = pAET->bres.minor_axis;
5611 *width++ = pAET->next->bres.minor_axis - pAET->bres.minor_axis;
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;
5770 clipx1 =
gPad->XtoAbsPixel(
gPad->GetX1());
5771 clipx2 =
gPad->XtoAbsPixel(
gPad->GetX2());
5772 clipy1 =
gPad->YtoAbsPixel(
gPad->GetY1());
5773 clipy2 =
gPad->YtoAbsPixel(
gPad->GetY2());
5777 for (y = 0; y < (int) source->rows; y++) {
5780 for (x = 0; x < (int) source->width; x++) {
5784 d = ((d + 10) * 5) >> 8;
5788 if ( noClip || ((x < (
int) source->width) &&
5789 (bxx < (
int)clipx2) && (bxx >= (
int)clipx1) &&
5790 (byy >= (
int)clipy2) && (byy < (
int)clipy1) )) {
5791 idx =
Idx(bxx + yy);
5792 acolor = (ARGB32)col[d];
5796 fImage->alt.argb32[idx] = acolor;
5815 Warning(
"DrawText",
"Visual not initiated");
5819 if (!
fImage->alt.argb32) {
5844 const wchar_t *wcsTitle =
reinterpret_cast<const wchar_t *
>(text->
GetWcsTitle());
5845 if (wcsTitle != NULL) {
5855 col =
gROOT->GetColor(1);
5858 ARGB32 color = ARGB32_White;
5912 if (align == 1 || align == 2 || align == 3) {
5914 }
else if (align == 4 || align == 5 || align == 6) {
5921 if (align == 3 || align == 6 || align == 9) {
5923 }
else if (align == 2 || align == 5 || align == 8) {
5930 ftal.x = (ftal.x >> 6);
5931 ftal.y = (ftal.y >> 6);
5936 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal, 0, 1 ))
continue;
5938 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
5939 FT_Bitmap *source = &bitmap->bitmap;
5941 Int_t bx = x - ftal.x + bitmap->left;
5942 Int_t by = y + ftal.y - bitmap->top;
5970 if (FT_Glyph_To_Bitmap(&glyph->
fImage, ft_render_mode_normal, 0, 1 ))
continue;
5972 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
5973 FT_Bitmap *source = &bitmap->bitmap;
5975 Int_t bx = x + bitmap->left;
5976 Int_t by = y + h - bitmap->top;
5988 static ASImageExportParams params;
5998 ret = ASImage2xpmRawBuff(img, (CARD8 **)buffer, size, 0);
6001 ret = ASImage2PNGBuff(img, (CARD8 **)buffer, size, ¶ms);
6042 static ASImageImportParams params;
6046 params.filter = SCL_DO_ALL;
6048 params.gamma_table = 0;
6049 params.compression = 0;
6050 params.format = ASA_ASImage;
6051 params.search_path = 0;
6052 params.subimage = 0;
6057 char *ptr = buffer[0];
6058 while (isspace((
int)*ptr)) ++ptr;
6060 fImage = xpm_data2ASImage((
const char**)buffer, ¶ms);
6062 fImage = xpmRawBuff2ASImage((
const char*)*buffer, ¶ms);
6067 fImage = PNGBuff2ASimage((CARD8 *)*buffer, ¶ms);
6098 static char *buf = 0;
6120 ASImage *rendered_im;
6121 ASImageLayer layers[2];
6122 init_image_layers(&(layers[0]), 2);
6124 layers[0].dst_x = 0;
6125 layers[0].dst_y = 0;
6126 layers[0].clip_width = img->width;
6127 layers[0].clip_height = img->height;
6128 layers[0].bevel = 0;
6130 layers[1].dst_x = 0;
6131 layers[1].dst_y = 0;
6132 layers[1].clip_width = img->width;
6133 layers[1].clip_height = img->height;
6134 layers[1].merge_scanlines = blend_scanlines_name2func(
"tint");
6135 rendered_im = merge_layers(
fgVisual, &(layers[0]), 2, img->width, img->height,
6137 destroy_asimage(&img);
6141 ASImage *padimg = 0;
6146 padimg = pad_asimage(
fgVisual, img, 0, d, sz, sz, 0x00ffffff,
6150 padimg = pad_asimage(
fgVisual, img, d, 0, sz, sz, 0x00ffffff,
6155 destroy_asimage(&img);
6160 ASImage2xpmRawBuff(padimg, (CARD8 **)ptr, &size, 0);
6163 destroy_asimage(&padimg);
6169 void TASImage::Streamer(
TBuffer &
b)
6183 if ( version == 1 ) {
6185 if (fileVersion > 0 && fileVersion < 50000 ) {
6186 TImage::Streamer(b);
6193 if ( fileVersion < 40200 ) {
6209 TNamed::Streamer(b);
6212 if (image_type != 0) {
6214 buffer =
new char[size];
6219 TAttImage::Streamer(b);
6238 TNamed::Streamer(b);
6240 image_type =
fImage->alt.vector ? 0 : 1;
6243 if (image_type != 0) {
6249 TAttImage::Streamer(b);
6263 if (
fImage->alt.vector) {
6305 if ((start > 0) && (stop - start > 0)) {
6316 Int_t sz = thick*thick;
6320 ARGB32 color = ARGB32_White;
6321 parse_argb_color(col, &color);
6326 matrix =
new CARD32[sz];
6329 for (
int i = 0; i < sz; i++) {
6330 matrix[i] = (CARD32)color;
6334 brush.matrix = matrix;
6335 brush.width = thick;
6336 brush.height = thick;
6337 brush.center_y = brush.center_x = thick/2;
6339 ASDrawContext *ctx = 0;
6342 asim_cube_bezier(ctx, x1, y1, x2, y2, x3, y3);
6355 const char *col,
Int_t thick)
6357 thick = !thick ? 1 : thick;
6358 Int_t sz = thick*thick;
6362 ARGB32 color = ARGB32_White;
6363 parse_argb_color(col, &color);
6368 matrix =
new CARD32[sz];
6371 for (
int i = 0; i < sz; i++) {
6372 matrix[i] = (CARD32)color;
6376 brush.matrix = matrix;
6377 brush.width = thick > 0 ? thick : 1;
6378 brush.height = thick > 0 ? thick : 1;
6379 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6382 asim_straight_ellips(ctx, x, y, rx, ry, thick < 0);
6396 thick = !thick ? 1 : thick;
6397 Int_t sz = thick*thick;
6401 ARGB32 color = ARGB32_White;
6402 parse_argb_color(col, &color);
6408 matrix =
new CARD32[sz];
6411 for (
int i = 0; i < sz; i++) {
6412 matrix[i] = (CARD32)color;
6416 brush.matrix = matrix;
6417 brush.height = brush.width = thick > 0 ? thick : 1;
6418 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6421 asim_circle(ctx, x, y, r, thick < 0);
6435 const char *col,
Int_t thick)
6437 thick = !thick ? 1 : thick;
6438 Int_t sz = thick*thick;
6442 ARGB32 color = ARGB32_White;
6443 parse_argb_color(col, &color);
6448 matrix =
new CARD32[sz];
6451 for (
int i = 0; i < sz; i++) {
6452 matrix[i] = (CARD32)color;
6456 brush.matrix = matrix;
6457 brush.width = thick > 0 ? thick : 1;
6458 brush.height = thick > 0 ? thick : 1;
6459 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6462 asim_ellips(ctx, x, y, rx, ry, angle, thick < 0);
6475 const char *col,
Int_t thick)
6477 thick = !thick ? 1 : thick;
6478 Int_t sz = thick*thick;
6482 ARGB32 color = ARGB32_White;
6483 parse_argb_color(col, &color);
6488 matrix =
new CARD32[sz];
6491 for (
int i = 0; i < sz; i++) {
6492 matrix[i] = (CARD32)color;
6496 brush.matrix = matrix;
6497 brush.width = thick > 0 ? thick : 1;
6498 brush.height = thick > 0 ? thick : 1;
6499 brush.center_y = brush.center_x = thick > 0 ? thick/2 : 0;
6502 asim_ellips2(ctx, x, y, rx, ry, angle, thick < 0);
6514 const char * ,
const char * )
6528 Warning(
"Gray",
"Image not initiated");
6533 Warning(
"Gray",
"Visual not initiated");
6558 if (
fImage->alt.argb32) {
6560 0, ASA_ARGB32, 0, ASIMAGE_QUALITY_DEFAULT);
6562 for (i = 0; i <
fImage->height; i++) {
6563 for (j = 0; j <
fImage->width; j++) {
6566 r = ((
fImage->alt.argb32[idx] & 0xff0000) >> 16);
6567 g = ((
fImage->alt.argb32[idx] & 0x00ff00) >> 8);
6568 b = (
fImage->alt.argb32[idx] & 0x0000ff);
6569 l = (57*r + 181*g + 18*
b)/256;
6570 fGrayImage->alt.argb32[idx] = (l << 16) + (l << 8) +
l;
6577 ASImageDecoder *imdec = start_image_decoding(
fgVisual,
fImage, SCL_DO_ALL,
6589 Warning(
"ToGray",
"Failed to start image output");
6596 CARD32 *aa = imdec->buffer.alpha;
6597 CARD32 *rr = imdec->buffer.red;
6598 CARD32 *gg = imdec->buffer.green;
6599 CARD32 *bb = imdec->buffer.blue;
6604 for (i = 0; i <
fImage->height; i++) {
6605 imdec->decode_image_scanline(imdec);
6606 result.flags = imdec->buffer.flags;
6607 result.back_color = imdec->buffer.back_color;
6609 for (j = 0; j <
fImage->width; j++) {
6610 l = (57*rr[j] + 181*gg[j]+ 18*bb[j])/256;
6611 result.alpha[j] = aa[j];
6613 result.green[j] =
l;
6616 imout->output_image_scanline(imout, &result, 1);
6619 stop_image_decoding(&imdec);
6620 stop_image_output(&imout);
6652 gVirtualX->GetWindowSize(wid, xy, xy, w, h);
6660 Warning(
"FromWindow",
"Visual not initiated");
6668 static int x11 = -1;
6669 if (x11 < 0) x11 =
gVirtualX->InheritsFrom(
"TGX11");
6674 unsigned char *bits =
gVirtualX->GetColorBits(wid, 0, 0, w, h);
6679 fImage = bitmap2asimage(bits, w, h, 0, 0);
6694 for (
UInt_t i = 0; i < h/2; ++i) {
6695 memcpy(xx, buf + 4*w*i, 4*w);
6696 memcpy(buf + 4*w*i, buf + 4*w*(h-i-1), 4*w);
6697 memcpy(buf + 4*w*(h-i-1), xx, 4*w);
6701 fImage = bitmap2asimage(buf, w, h, 0, 0);
6714 if (!
fImage->alt.vector && on) {
6725 gPad->Range(-left / (1.0 - left - right),
6726 -bottom / (1.0 - top - bottom),
6727 1 + right / (1.0 - left - right),
6728 1 + top / ( 1.0 - top - bottom));
6729 gPad->RangeAxis(0, 0, 1, 1);
6765 out << std::endl << str << std::endl << std::endl;
6768 out << xpm <<
"_img = TImage::Create();" << std::endl;
6769 out <<
" " << xpm <<
"_img->SetImageBuffer( (char **)" << xpm <<
", TImage::kXpm);" << std::endl;
6770 out <<
" " << xpm <<
"_img->Draw();" << std::endl;
6783 static char buf[32];
6784 FILE *fp = fopen(name,
"rb+");
6787 printf(
"file %s : failed to open\n", name);
6791 if (!fread(buf, 1, 20, fp)) {
6796 char dpi1 = (
set & 0xffff) >> 8;
6797 char dpi2 =
set & 0xff;
6802 for (i = 0; i < 20; i++) {
6803 if ((buf[i] == 0x4a) && (buf[i+1] == 0x46) && (buf[i+2] == 0x49) &&
6804 (buf[i+3] == 0x46) && (buf[i+4] == 0x00) ) {
6810 if (i == 20 || dpi+4 >= 20) {
6812 printf(
"file %s : wrong JPEG format\n", name);
6819 buf[dpi + 1] = dpi1;
6820 buf[dpi + 2] = dpi2;
6823 buf[dpi + 3] = dpi1;
6824 buf[dpi + 4] = dpi2;
6827 fwrite(buf, 1, 20, fp);
void SetTitle(const char *title="")
Set a title for an image.
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].
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * GetName() const
Returns name of object.
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
static void Init()
Initialise the TrueType fonts interface.
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
static void FreeStorage(ScanLineListBlock *pSLLBlock)
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)=0
static ASFontManager * gFontManager
static void init_icon_paths()
Set icons paths.
virtual UInt_t GetHeight() const
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 PutPixel(Int_t x, Int_t y, const char *col="#000000")
Draw a point at the specified position.
static ARGB32 GetAverage(ARGB32 foreground, ARGB32 background)
Get average.
virtual void Paint(Option_t *option="")=0
This method must be overridden if a class wants to paint itself.
virtual Color_t GetTextColor() const
Return the text color.
static Bool_t InitVisual()
Static function to initialize the ASVisual.
void SetPaletteEnabled(Bool_t on=kTRUE)
Switch on/off the image palette.
virtual void SetBorderMode(Short_t bordermode)
virtual Short_t GetTextAlign() const
Return the text alignment.
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.
virtual UInt_t GetWidth() const
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
static const ASVisual * GetVisual()
Return visual.
TString & ReplaceAll(const TString &s1, const TString &s2)
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
R__EXTERN TStyle * gStyle
const Double_t * GetArray() const
static Bool_t IsInitialized()
FT_Glyph fImage
glyph image
virtual void SetName(const char *name)
Set the name of the TNamed.
void Draw(Option_t *option="")
Draw image.
virtual Float_t GetTextAngle() const
Return the text angle.
static unsigned long kAllPlanes
char * GetObjectInfo(Int_t px, Int_t py) const
Get image pixel coordinates and the pixel value at the mouse pointer.
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 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.
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
Buffer base class used for serializing objects.
virtual UInt_t * GetArgbArray()
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
UInt_t GetHeight() const
Return height of original image not of the displayed image.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Bool_t fEditable
! kTRUE image can be resized, moved by resizing/moving gPad
UInt_t * GetArgbArray()
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible...
Int_t LoadPlugin()
Load the plugin library for this handler.
EImageQuality GetImageQuality() const
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
void StartPaletteEditor()
Start palette editor.
void ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Read specified image file.
UInt_t GetWidth() const
Return width of original image not of the displayed image.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetX1(Double_t x1)
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
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.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual void CellArrayEnd()=0
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 ...
An abstract interface to image processing library.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
void Browse(TBrowser *)
Browse image.
void CreateThumbnail()
Create image thumbnail.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
Float_t GetScreenFactor() const
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.
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.
virtual void SetX2(Double_t x2)
Bool_t fPaletteEnabled
! kTRUE - palette is drawn on the image
UInt_t * GetScanline(UInt_t y)
Return a pointer to scan-line.
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 SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static CARD32 gBrushCache[kBrushCacheSize *kBrushCacheSize]
static ARGB32 GetShadow(ARGB32 background)
Calculate shadow color.
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Double_t * GetVecArray()
Return a pointer to internal array[width x height] of double values [0,1].
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Bool_t SetImageBuffer(char **buffer, EImageFileTypes type=TImage::kPng)
Create image from compressed buffer.
static THashTable * fgPlugList
! hash table containing loaded plugins
void PolyPoint(UInt_t npt, TPoint *ppt, const char *col="#000000", TImage::ECoordMode mode=kCoordModeOrigin)
Draw a poly point.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Is the mouse in the image ?
void Paint(Option_t *option="")
Paint image.
static const double x2[5]
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...
THashTable implements a hash table to store TObject's.
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * GetName() const =0
Returns name of object.
void BeginPaint(Bool_t fast=kTRUE)
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
static void SetTextFont(Font_t fontnumber)
Set specified font.
virtual Float_t GetTextSize() const
Return the text size.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
virtual Int_t GetVersionOwner() const =0
void EndPaint()
EndPaint does internal RLE compression of image data.
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2)
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
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 MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
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...
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
void Gray(Bool_t on=kTRUE)
Convert RGB image to Gray image and vice versa.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer on [ 0, imax-1 ].
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Write image to specified file.
virtual void * GetStream() const
Base class for several text objects.
virtual void Draw(Option_t *option="")
Draw this frame with its current attributes.
static TTGlyph * GetGlyphs()
static ASDrawContext * create_draw_context_argb32(ASImage *im, ASDrawTool *brush)
Create draw context.
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).
Ssiz_t First(char c) const
Find first occurrence of a character c.
static int GetPolyYBounds(TPoint *pts, int n, int *by, int *ty)
Get poly bounds along Y.
Double_t ATan2(Double_t, Double_t)
virtual const TImagePalette & GetPalette() const
TVirtualPad is an abstract base class for the Pad and Canvas classes.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
void Scale(UInt_t width, UInt_t height)
Scale the original image.
void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
virtual Int_t GetPixmapID() const =0
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...
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
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.
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.
Element * GetMatrixArray()
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.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Int_t UtoPixel(Double_t u) const =0
void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const
Return the zoom parameters.
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
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.
virtual void Delete(Option_t *option="")
Delete this object.
Using a TBrowser one can browse all ROOT objects.
void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col="#000000", Int_t thick=1)
Draw a circle.
RooArgSet S(const RooAbsArg &v1)
R__EXTERN const char * gProgName
void UnZoom()
Un-zoom the image to original size.
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...
Bool_t fIsGray
! kTRUE if image is gray
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.
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.
static char * gIconPaths[7]
void Append(const TImage *im, const char *option="+", const char *color="#00000000")
Append image.
void SetPalette(const TImagePalette *palette)
Set a new palette to an image.
void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Draw wide line.
Double_t fMaxValue
! max value in image
UInt_t GetScaledHeight() const
Return height of the displayed image not of the original image.
R__EXTERN TSystem * gSystem
const char * GetTitle() const
Title is used to keep 32x32 xpm image's thumbnail.
void Merge(const TImage *im, const char *op="alphablend", Int_t x=0, Int_t y=0)
Merge two images.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
#define FillSpansInternal(npt, ppt, widths, color)
const Mask_t kGCClipXOrigin
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.
virtual Font_t GetTextFont() const
Return the text font.
Long_t ExecPlugin(int nargs, const T &... params)
TImagePalette fPalette
color palette for value -> color conversion
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=0)
Flood fill.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void CropPolygon(UInt_t npt, TPoint *ppt)
Crop a convex polygon.
static FT_Matrix * GetRotMatrix()
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths)
Crop spans.
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
TTF helper class containing glyphs description.
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...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)=0
UInt_t GetImageCompression() const
Pixmap_t GetMask()
Returns image mask pixmap (alpha channel).
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
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.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const Mask_t kGCClipYOrigin
Int_t GetNoElements() const
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.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
void Blur(Double_t hr=3, Double_t vr=3)
Perform Gaussian blur of the image (useful for drop shadows).
UInt_t fNumPoints
number of anchor points
virtual Int_t GetCanvasID() const =0
UInt_t fZoomOffX
! X - offset for zooming in image pixels
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
static void CreateETandAET(int count, TPoint *pts, EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
Bool_t IsEditable() const
void Flip(Int_t flip=180)
Flip image in place.
R__EXTERN TRandom * gRandom
static int InsertionSort(EdgeTableEntry *AET)
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
virtual ~TASImage()
Image destructor, clean up image and visual.
static const UInt_t NUMPTSTOBUFFER
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 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 ...
virtual void SetY2(Double_t y2)
Bool_t fConstRatio
keep aspect ratio of image on the screen
UInt_t * GetRgbaArray()
Return a pointer to an array[width x height] of RGBA32 values.
void Tile(UInt_t width, UInt_t height)
Tile the original image.
Int_t fZoomUpdate
! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops ...
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...
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...
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TObject * FindObject(const char *name) const
Find object using its name.
void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col="#000000", UInt_t thick=1, TImage::ECoordMode mode=kCoordModeOrigin)
Draw a polyline.
static const double x1[5]
void Crop(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0)
Crop an image.
struct _EdgeTableEntry EdgeTableEntry
void Mirror(Bool_t vert=kTRUE)
Mirror image in place.
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.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
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.
UInt_t fZoomHeight
! hight of zoomed image in image pixels
virtual Int_t FindColor(UShort_t r, UShort_t g, UShort_t b)
Returns an index of the closest color.
static ARGB32 GetHilite(ARGB32 background)
Calculate highlite color.
static void destroy_asdraw_context32(ASDrawContext *ctx)
Destroy asdraw context32.
void Add(TObject *obj)
Add object to the hash table.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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.
static constexpr double s
#define _MEMSET_(dst, lng, val)
The color creation and management class.
struct _ScanLineListBlock ScanLineListBlock
static CARD8 MakeComponentHilite(int cmp)
Make component hilite.
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng)
Return in-memory buffer compressed according image type.
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h)
Creates an image (screenshot) from a RGBA buffer.
#define _alphaBlend(bot, top)
TImage & operator=(const TImage &img)
A class to define a conversion from pixel values to pixel color.
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
TObject * Clone(const char *newname) const
Clone image.
Array of doubles (64 bits per element).
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Mother of all ROOT objects.
Double_t fMinValue
! min value in 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.
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
static ASVisual * fgVisual
pointer to visual structure
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
TASImage()
Default image constructor.
void AddAt(Double_t c, Int_t i)
Set the double c value at position i in the array.
static Bool_t fgInit
global flag to init afterimage only once
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.
virtual Int_t VtoPixel(Double_t v) const =0
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1)
Draw segments.
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.
Short_t Max(Short_t a, Short_t b)
struct _ScanLineList ScanLineList
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
const void * GetWcsTitle(void) const
Returns the text as UNICODE.
R__EXTERN TVirtualPS * gVirtualPS
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
TASImage & operator=(const TASImage &img)
Image assignment operator.
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Int_t Atoi() const
Return integer value of string.
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2)
static void SetTextSize(Float_t textsize)
Set current text size.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
float type_of_call hi(const int &, const int &)
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
void flip(struct mesh *m, struct behavior *b, struct otri *flipedge)
UInt_t fZoomWidth
! width of zoomed image in image pixels
ASImage * fGrayImage
! gray image
static TImage * Create()
Create an image.
void DestroyImage()
Destroy image.
const char * AsHexString() const
Return color as hexadecimal string.
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
static const UInt_t kBrushCacheSize
static Int_t GetNumGlyphs()
Pixmap_t GetPixmap()
Returns image pixmap.
virtual void SetY1(Double_t y1)
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
ASImage * fImage
! pointer to image structure of original 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 ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse events.
void SetDefaults()
Set default parameters.
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.
virtual unsigned char * ReadFile(const char *filename, UInt_t &w, UInt_t &h)=0
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 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,y) within the existing image.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual const char * GetTitle() const
Returns title of object.
static const FT_BBox & GetBox()
Bool_t GetConstRatio() const
virtual TCanvas * GetCanvas() const =0
static const double x3[11]
void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick)
Draw a vertical line.
virtual void BeginPaint(Bool_t=kTRUE)
const char * Data() const
static constexpr double g