Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TASImage.h
Go to the documentation of this file.
1// @(#)root/asimage:$Id$
2// Author: Fons Rademakers, Reiner Rohlfs 28/11/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TASImage
13#define ROOT_TASImage
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TASImage //
18// //
19// Interface to image processing library libAfterImage. //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23
24#include "TImage.h"
25
26struct ASImage;
27struct ASVisual;
28class TBrowser;
29class THashTable;
30
31class TASImage : public TImage {
32
33private:
34 enum { kNoZoom = 0, kZoom = 1, kZoomOps = -1 };
36
37 void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick);
38 void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick);
41 void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick);
42 void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick);
43 void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col);
44 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);
45 Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth);
46 void GetFillAreaSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth);
47 inline Int_t Idx(Int_t idx);
49 void DrawTextTTF(Int_t x, Int_t y, const char *text, Int_t size, UInt_t color, const char *font_name, Float_t angle);
50 void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y);
51 void SetDefaults();
52 void CreateThumbnail();
53 void DestroyImage();
54 const char *TypeFromMagicNumber(const char *file);
55
56protected:
57 ASImage *fImage; ///<! pointer to image structure of original image
58 TASImage *fScaledImage; ///<! temporary scaled and zoomed image produced from original image
59 Double_t fMaxValue; ///<! max value in image
60 Double_t fMinValue; ///<! min value in image
61 UInt_t fZoomOffX; ///<! X - offset for zooming in image pixels
62 UInt_t fZoomOffY; ///<! Y - offset for zooming im image pixels
63 UInt_t fZoomWidth; ///<! width of zoomed image in image pixels
64 UInt_t fZoomHeight; ///<! hight of zoomed image in image pixels
65 Int_t fZoomUpdate; ///<! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops
66 Bool_t fEditable; ///<! kTRUE image can be resized, moved by resizing/moving gPad
67 Int_t fPaintMode; ///<! 1 - fast mode, 0 - low memory slow mode
68 ASImage *fGrayImage; ///<! gray image
69 Bool_t fIsGray; ///<! kTRUE if image is gray
70 static THashTable *fgPlugList; ///<! hash table containing loaded plugins
71
72 static ASVisual *fgVisual; ///< pointer to visual structure
73 static Bool_t fgInit; ///< global flag to init afterimage only once
74
75 EImageFileTypes GetFileType(const char *ext);
76 void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas = kTRUE);
77 void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas = kTRUE);
78
79 static Bool_t InitVisual();
80
81public:
82 TASImage();
85 TASImage(const char *name, const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette = nullptr);
86 TASImage(const char *name, const TArrayD &imageData, UInt_t width, TImagePalette *palette = nullptr);
87 TASImage(const char *name, const TVectorD &imageData, UInt_t width, TImagePalette *palette = nullptr);
88 TASImage(const TASImage &img);
89 TASImage &operator=(const TASImage &img);
90 virtual ~TASImage();
91
92 TObject *Clone(const char *newname) const override;
93
94 void SetEditable(Bool_t on = kTRUE) override { fEditable = on; } //*TOGGLE*
95 Bool_t IsEditable() const override { return fEditable; }
96 void Browse(TBrowser *) override;
97 void SetTitle(const char *title = "") override; // *MENU*
98 const char *GetTitle() const override;
99 const char *GetIconName() const override { return GetTitle(); }
100
101 // Pad conversions
102 void FromPad(TVirtualPad *pad, Int_t x = 0, Int_t y = 0,
103 UInt_t w = 0, UInt_t h = 0) override;
104 void Draw(Option_t *option = "") override;
105 void Paint(Option_t *option = "") override;
106 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
107 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
108 char *GetObjectInfo(Int_t px, Int_t py) const override;
109
110 // Transformations
111 void SetPalette(const TImagePalette *palette) override;
112 void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height) override; //*MENU*
113 void UnZoom() override; //*MENU*
114 void Flip(Int_t flip = 180) override; //*MENU*
115 void Mirror(Bool_t vert = kTRUE) override; //*MENU*
116 void Scale(UInt_t width, UInt_t height) override; //*MENU*
117 void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd,
118 UInt_t toWidth, UInt_t toHeight) override; //*MENU*
119 void Tile(UInt_t width, UInt_t height) override; //*MENU*
120 void Crop(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) override; //*MENU*
121 void Pad(const char *color = "#00FFFFFF", UInt_t left = 0,
122 UInt_t right = 0, UInt_t top = 0, UInt_t bottom = 0) override; //*MENU*
123 void Blur(Double_t hr = 3, Double_t vr = 3) override; //*MENU*
124 Double_t *Vectorize(UInt_t max_colors = 256, UInt_t dither = 4, Int_t opaque_threshold = 1) override;
125 void Gray(Bool_t on = kTRUE) override; //*TOGGLE* *GETTER=IsGray
126 void StartPaletteEditor() override; //*MENU*
127 void HSV(UInt_t hue = 0, UInt_t radius = 360, Int_t H = 0, Int_t S = 0, Int_t V = 0,
128 Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) override;
129 void Merge(const TImage *im, const char *op = "alphablend", Int_t x = 0, Int_t y = 0) override;
130 void Append(const TImage *im, const char * option = "+", const char *color = "#00000000") override;
131 void Gradient(UInt_t angle = 0, const char *colors = "#FFFFFF #000000", const char *offsets = nullptr,
132 Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) override;
133 void Bevel(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0, const char *hi = "#ffdddddd",
134 const char *lo = "#ff555555", UShort_t thick = 1, Bool_t pressed = kFALSE) override;
135 void DrawText(Int_t x = 0, Int_t y = 0, const char *text = "", Int_t size = 12,
136 const char *color = nullptr, const char *font = "fixed", EText3DType type = TImage::kPlain,
137 const char *fore_file = nullptr, Float_t angle = 0) override;
138 void DrawText(TText *text, Int_t x = 0, Int_t y = 0) override;
139
140 // Vector graphics
141 void BeginPaint(Bool_t fast = kTRUE) override;
142 void EndPaint() override;
143 void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col = "#000000", UInt_t thick = 1) override;
144 void DrawDashLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, const char *col = "#000000", UInt_t thick = 1) override;
145 void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, const char *col = "#000000", UInt_t thick = 1, Int_t mode = 0) override;
146 void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col = "#000000", UInt_t thick = 1) override;
147 void FillRectangle(const char *col = nullptr, Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) override;
148 void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col = "#000000", UInt_t thick = 1, TImage::ECoordMode mode = kCoordModeOrigin) override;
149 void PutPixel(Int_t x, Int_t y, const char *col = "#000000") override;
150 void PolyPoint(UInt_t npt, TPoint *ppt, const char *col = "#000000", TImage::ECoordMode mode = kCoordModeOrigin) override;
151 void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col = "#000000", UInt_t thick = 1) override;
152 void FillPolygon(UInt_t npt, TPoint *ppt, const char *col = "#000000", const char *stipple = nullptr, UInt_t w = 16, UInt_t h = 16) override;
153 void FillPolygon(UInt_t npt, TPoint *ppt, TImage *tile) override;
154 void CropPolygon(UInt_t npt, TPoint *ppt) override;
155 void DrawFillArea(UInt_t npt, TPoint *ppt, const char *col = "#000000", const char *stipple = nullptr, UInt_t w = 16, UInt_t h = 16) override;
156 void DrawFillArea(UInt_t npt, TPoint *ppt, TImage *tile) override;
157 void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, const char *col = "#000000", const char *stipple = nullptr, UInt_t w = 16, UInt_t h = 16) override;
158 void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, TImage *tile) override;
159 void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths) override;
160 void CopyArea(TImage *dst, Int_t xsrc, Int_t ysrc, UInt_t w, UInt_t h, Int_t xdst = 0, Int_t ydst = 0, Int_t gfunc = 3, EColorChan chan = kAllChan) override;
161 void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t *ic) override;
162 void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col = nullptr) override;
163 void DrawCubeBezier(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t x3, Int_t y3, const char *col = "#000000", UInt_t thick = 1) override;
164 void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col = "#000000", Int_t thick = 1) override;
165 void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col = "#000000", Int_t thick = 1) override;
166 void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col = "#000000", Int_t thick = 1) override;
167 void DrawEllips2(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col = "#000000", Int_t thick = 1) override;
168
169 // Input / output
170 void ReadImage(const char *file, EImageFileTypes type = TImage::kUnknown) override;
171 void WriteImage(const char *file, EImageFileTypes type = TImage::kUnknown) override; //*MENU*
172 void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette = nullptr) override;
173 void SetImage(const TArrayD &imageData, UInt_t width, TImagePalette *palette = nullptr) override;
174 void SetImage(const TVectorD &imageData, UInt_t width, TImagePalette *palette = nullptr) override;
175 void SetImage(Pixmap_t pxm, Pixmap_t mask = 0) override;
176 void FromWindow(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) override;
177 void FromGLBuffer(UChar_t* buf, UInt_t w, UInt_t h) override;
178
179 // Utilities
180 UInt_t GetWidth() const override;
181 UInt_t GetHeight() const override;
182 UInt_t GetScaledWidth() const;
183 UInt_t GetScaledHeight() const;
184 Bool_t IsValid() const override { return fImage ? kTRUE : kFALSE; }
185 Bool_t IsGray() const override { return fIsGray; }
186 ASImage *GetImage() const { return fImage; }
187 void SetImage(ASImage *image) { DestroyImage(); fImage = image; }
188 TImage *GetScaledImage() const override { return fScaledImage; }
189 Pixmap_t GetPixmap() override;
190 Pixmap_t GetMask() override;
191 TArrayL *GetPixels(Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) override;
192 TArrayD *GetArray(UInt_t w = 0, UInt_t h = 0, TImagePalette *pal = gWebImagePalette) override;
193 UInt_t *GetArgbArray() override;
194 UInt_t *GetRgbaArray() override;
195 Double_t *GetVecArray() override;
196 UInt_t *GetScanline(UInt_t y) override;
197 void GetImageBuffer(char **buffer, int *size, EImageFileTypes type = TImage::kPng) override;
198 void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const;
199 Bool_t SetImageBuffer(char **buffer, EImageFileTypes type = TImage::kPng) override;
200 void PaintImage(Drawable_t wid, Int_t x, Int_t y, Int_t xsrc = 0, Int_t ysrc = 0, UInt_t wsrc = 0, UInt_t hsrc = 0, Option_t *opt = "") override;
201 void SetPaletteEnabled(Bool_t on = kTRUE) override; // *TOGGLE*
202 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
203
204 static const ASVisual *GetVisual();
205 static UInt_t AlphaBlend(UInt_t bot, UInt_t top);
206 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 = "");
207
208 // some static functions
209 Bool_t SetJpegDpi(const char *name, UInt_t dpi = 72);
210
211 ClassDefOverride(TASImage,2) // image processing class
212};
213
214#endif
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:31
#define h(i)
Definition RSha256.hxx:106
static const double x3[11]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
unsigned short UShort_t
Definition RtypesCore.h:40
int Int_t
Definition RtypesCore.h:45
unsigned char UChar_t
Definition RtypesCore.h:38
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
R__EXTERN TImagePalette * gWebImagePalette
Definition TAttImage.h:110
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t DrawFillArea
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t CopyArea
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char PutPixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char FillPolygon
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t FillRectangle
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pxm
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition TGX11.cxx:110
#define hi
Color * colors
Definition X3DBuffer.c:21
Image class.
Definition TASImage.h:31
const char * GetIconName() const override
Returns mime type name of object.
Definition TASImage.h:99
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths) override
Crop spans.
void Gradient(UInt_t angle=0, const char *colors="#FFFFFF #000000", const char *offsets=nullptr, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Render multipoint gradient inside rectangle of size (width, height) at position (x,...
void Blur(Double_t hr=3, Double_t vr=3) override
Perform Gaussian blur of the image (useful for drop shadows).
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
void StartPaletteEditor() override
Start palette editor.
void Bevel(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0, const char *hi="#ffdddddd", const char *lo="#ff555555", UShort_t thick=1, Bool_t pressed=kFALSE) override
Bevel is used to create 3D effect while drawing buttons, or any other image that needs to be framed.
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
Definition TASImage.h:67
UInt_t GetWidth() const override
Return width of original image not of the displayed image.
Double_t fMinValue
! min value in image
Definition TASImage.h:60
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col="#000000", Int_t thick=1) override
Draw an ellipse.
void Paint(Option_t *option="") override
Paint image.
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
void SetPaletteEnabled(Bool_t on=kTRUE) override
Switch on/off the image palette.
@ kNoZoom
Definition TASImage.h:34
@ kZoomOps
Definition TASImage.h:34
static Bool_t fgInit
global flag to init afterimage only once
Definition TASImage.h:73
const char * GetTitle() const override
Title is used to keep 32x32 xpm image's thumbnail.
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h) override
Creates an image (screenshot) from a RGBA buffer.
void HSV(UInt_t hue=0, UInt_t radius=360, Int_t H=0, Int_t S=0, Int_t V=0, Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
This function will tile original image to specified size with offsets requested, and then it will go ...
void Tile(UInt_t width, UInt_t height) override
Tile the original image.
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Write image to specified file.
Definition TASImage.cxx:656
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Is the mouse in the image ?
char * GetObjectInfo(Int_t px, Int_t py) const override
Get image pixel coordinates and the pixel value at the mouse pointer.
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
Definition TASImage.cxx:402
Double_t fMaxValue
! max value in image
Definition TASImage.h:59
void GetFillAreaSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth)
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
Definition TASImage.cxx:956
void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height) override
The area of an image displayed in a pad is defined by this function.
@ kReadWritePNG
Definition TASImage.h:35
@ kReadWriteVector
Definition TASImage.h:35
UInt_t fZoomWidth
! width of zoomed image in image pixels
Definition TASImage.h:63
Bool_t fEditable
! kTRUE image can be resized, moved by resizing/moving gPad
Definition TASImage.h:66
TObject * Clone(const char *newname) const override
Clone image.
Int_t fZoomUpdate
! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops
Definition TASImage.h:65
Bool_t IsValid() const override
Definition TASImage.h:184
void DrawCubeBezier(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t x3, Int_t y3, const char *col="#000000", UInt_t thick=1) override
Draw a cubic bezier line.
void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick)
Draw a vertical line.
UInt_t * GetRgbaArray() override
Return a pointer to an array[width x height] of RGBA32 values.
void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col="#000000", Int_t thick=1) override
Draw a straight ellipse.
Double_t * GetVecArray() override
Return a pointer to internal array[width x height] of double values [0,1].
void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col="#000000", Int_t thick=1) override
Draw a circle.
ASImage * fImage
! pointer to image structure of original image
Definition TASImage.h:57
void Gray(Bool_t on=kTRUE) override
Convert RGB image to Gray image and vice versa.
UInt_t fZoomHeight
! hight of zoomed image in image pixels
Definition TASImage.h:64
void Pad(const char *color="#00FFFFFF", UInt_t left=0, UInt_t right=0, UInt_t top=0, UInt_t bottom=0) override
Enlarge image, padding it with specified color on each side in accordance with requested geometry.
static THashTable * fgPlugList
! hash table containing loaded plugins
Definition TASImage.h:70
UInt_t * GetArgbArray() override
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible...
Bool_t SetImageBuffer(char **buffer, EImageFileTypes type=TImage::kPng) override
Create image from compressed buffer.
Double_t * Vectorize(UInt_t max_colors=256, UInt_t dither=4, Int_t opaque_threshold=1) override
Reduce color-depth of an image and fills vector of "scientific data" [0...1].
Int_t Idx(Int_t idx)
Return a valid index in fImage tables to avoid seg-fault by accessing out of indices out of array's r...
void SetDefaults()
Set default parameters.
Definition TASImage.cxx:200
void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Draw wide line.
Pixmap_t GetMask() override
Returns image mask pixmap (alpha channel).
UInt_t * GetScanline(UInt_t y) override
Return a pointer to scan-line.
void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, const char *col="#000000", const char *stipple=nullptr, UInt_t w=16, UInt_t h=16) override
Fill spans with specified color or/and stipple.
void DrawEllips2(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col="#000000", Int_t thick=1) override
Draw an ellipse.
void CropPolygon(UInt_t npt, TPoint *ppt) override
Crop a convex polygon.
static const ASVisual * GetVisual()
Return visual.
void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col="#000000", UInt_t thick=1, TImage::ECoordMode mode=kCoordModeOrigin) override
Draw a polyline.
void PolyPoint(UInt_t npt, TPoint *ppt, const char *col="#000000", TImage::ECoordMode mode=kCoordModeOrigin) override
Draw a poly point.
static void Image2Drawable(ASImage *im, Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="")
Draw asimage on drawable.
void Merge(const TImage *im, const char *op="alphablend", Int_t x=0, Int_t y=0) override
Merge two images.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t *ic) override
Draw a cell array.
void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height)
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified col...
void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=nullptr) override
Flood fill.
TASImage * fScaledImage
! temporary scaled and zoomed image produced from original image
Definition TASImage.h:58
Bool_t IsEditable() const override
Definition TASImage.h:95
UInt_t fZoomOffX
! X - offset for zooming in image pixels
Definition TASImage.h:61
void ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown) override
Read specified image file.
Definition TASImage.cxx:487
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng) override
Return in-memory buffer compressed according image type.
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
Definition TASImage.cxx:827
void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd, UInt_t toWidth, UInt_t toHeight) override
Another method of enlarging images where corners remain unchanged, but middle part gets tiled.
void SetEditable(Bool_t on=kTRUE) override
Definition TASImage.h:94
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette=nullptr) override
Deletes the old image and creates a new image depending on the values of imageData.
Definition TASImage.cxx:993
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 Browse(TBrowser *) override
Browse image.
void DrawDashZTLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed line with thick pixel width.
void DestroyImage()
Destroy image.
Definition TASImage.cxx:182
ASImage * GetImage() const
Definition TASImage.h:186
static Bool_t InitVisual()
Static function to initialize the ASVisual.
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
Definition TASImage.h:62
Bool_t IsGray() const override
Definition TASImage.h:185
void UnZoom() override
Un-zoom the image to original size.
TImage * GetScaledImage() const override
Definition TASImage.h:188
TArrayL * GetPixels(Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Return 2D array of machine dependent pixel values.
void PaintImage(Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="") override
Draw image on the drawable wid (pixmap, window) at x,y position.
ASImage * fGrayImage
! gray image
Definition TASImage.h:68
void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed vertical line.
void SetTitle(const char *title="") override
Set a title for an image.
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
Definition TASImage.cxx:871
void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col="#000000", UInt_t thick=1) override
Draw a rectangle.
void Append(const TImage *im, const char *option="+", const char *color="#00000000") override
Append image.
void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
Draw a dashed horizontal line.
void DrawDashLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, const char *col="#000000", UInt_t thick=1) override
Draw a dashed line.
void SetPalette(const TImagePalette *palette) override
Set a new palette to an image.
void Scale(UInt_t width, UInt_t height) override
Scale the original image.
TASImage()
Default image constructor.
Definition TASImage.cxx:227
void SetImage(ASImage *image)
Definition TASImage.h:187
TASImage & operator=(const TASImage &img)
Image assignment operator.
Definition TASImage.cxx:324
void Mirror(Bool_t vert=kTRUE) override
Mirror image in place.
void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col)
Draw a dashed line with one pixel width.
void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1) override
Draw segments.
Pixmap_t GetPixmap() override
Returns image pixmap.
void FromWindow(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Create an image (screenshot) from specified window.
TArrayD * GetArray(UInt_t w=0, UInt_t h=0, TImagePalette *pal=gWebImagePalette) override
In case of vectorized image return an associated array of doubles otherwise this method creates and r...
void Flip(Int_t flip=180) override
Flip image in place.
Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth)
The code is based on Xserver/mi/mipolycon.c "Copyright 1987, 1998 The Open Group".
void Crop(Int_t x=0, Int_t y=0, UInt_t width=0, UInt_t height=0) override
Crop an image.
void EndPaint() override
EndPaint does internal RLE compression of image data.
void BeginPaint(Bool_t fast=kTRUE) override
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
static ASVisual * fgVisual
pointer to visual structure
Definition TASImage.h:72
virtual ~TASImage()
Image destructor, clean up image and visual.
Definition TASImage.cxx:358
void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const
Return the zoom parameters.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
UInt_t GetScaledHeight() const
Return height of the displayed image not of the original image.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute mouse events.
void FromPad(TVirtualPad *pad, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Create an image from the given pad, afterwards this image can be saved in any of the supported image ...
UInt_t GetHeight() const override
Return height of original image not of the displayed image.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, const char *col="#000000", UInt_t thick=1, Int_t mode=0) override
Draw a box.
Bool_t fIsGray
! kTRUE if image is gray
Definition TASImage.h:69
void CreateThumbnail()
Create image thumbnail.
Array of doubles (64 bits per element).
Definition TArrayD.h:27
Array of longs (32 or 64 bits per element).
Definition TArrayL.h:27
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
THashTable implements a hash table to store TObject's.
Definition THashTable.h:35
A class to define a conversion from pixel values to pixel color.
Definition TAttImage.h:33
An abstract interface to image processing library.
Definition TImage.h:29
EColorChan
Definition TImage.h:90
@ kAllChan
Definition TImage.h:95
ECoordMode
Definition TImage.h:85
@ kCoordModeOrigin
Definition TImage.h:86
EImageFileTypes
Definition TImage.h:36
@ kPng
Definition TImage.h:40
@ kUnknown
Definition TImage.h:54
EText3DType
Definition TImage.h:58
@ kPlain
Definition TImage.h:59
Mother of all ROOT objects.
Definition TObject.h:41
Base class for several text objects.
Definition TText.h:22
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
#define H(x, y, z)
Definition file.py:1
Used for drawing line segments (maps to the X11 XSegments structure)
Definition GuiTypes.h:351
th1 Draw()
void flip(struct mesh *m, struct behavior *b, struct otri *flipedge)
Definition triangle.c:7890