Logo ROOT   6.08/07
Reference Guide
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 #ifndef ROOT_TImage
25 #include "TImage.h"
26 #endif
27 
28 struct ASImage;
29 struct ASVisual;
30 class TBrowser;
31 class THashTable;
32 
33 class TASImage : public TImage {
34 
35 private:
36  enum { kNoZoom = 0, kZoom = 1, kZoomOps = -1 };
38 
39  void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick);
40  void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick);
41  void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick);
42  void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick);
43  void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick);
44  void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick);
45  void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col);
46  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);
47  Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth);
48  void GetFillAreaSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth);
49  inline Int_t Idx(Int_t idx);
50  void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height);
51  void DrawTextTTF(Int_t x, Int_t y, const char *text, Int_t size, UInt_t color, const char *font_name, Float_t angle);
52  void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y);
53  void SetDefaults();
54  void CreateThumbnail();
55  void DestroyImage();
56  const char *TypeFromMagicNumber(const char *file);
57 
58 protected:
59  ASImage *fImage; ///<! pointer to image structure of original image
60  TASImage *fScaledImage; ///<! temporary scaled and zoomed image produced from original image
61  Double_t fMaxValue; ///<! max value in image
62  Double_t fMinValue; ///<! min value in image
63  UInt_t fZoomOffX; ///<! X - offset for zooming in image pixels
64  UInt_t fZoomOffY; ///<! Y - offset for zooming im image pixels
65  UInt_t fZoomWidth; ///<! width of zoomed image in image pixels
66  UInt_t fZoomHeight; ///<! hight of zoomed image in image pixels
67  Int_t fZoomUpdate; ///<! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops
68  Bool_t fEditable; ///<! kTRUE image can be resized, moved by resizing/moving gPad
69  Int_t fPaintMode; ///<! 1 - fast mode, 0 - low memory slow mode
70  ASImage *fGrayImage; ///<! gray image
71  Bool_t fIsGray; ///<! kTRUE if image is gray
72  static THashTable *fgPlugList; ///<! hash table containing loaded plugins
73 
74  static ASVisual *fgVisual; ///< pointer to visual structure
75  static Bool_t fgInit; ///< global flag to init afterimage only once
76 
77  EImageFileTypes GetFileType(const char *ext);
78  void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas = kTRUE);
79  void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas = kTRUE);
80 
81  static Bool_t InitVisual();
82 
83 public:
84  TASImage();
85  TASImage(UInt_t w, UInt_t h);
86  TASImage(const char *file, EImageFileTypes type = kUnknown);
87  TASImage(const char *name, const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette = 0);
88  TASImage(const char *name, const TArrayD &imageData, UInt_t width, TImagePalette *palette = 0);
89  TASImage(const char *name, const TVectorD &imageData, UInt_t width, TImagePalette *palette = 0);
90  TASImage(const TASImage &img);
91  TASImage &operator=(const TASImage &img);
92  virtual ~TASImage();
93 
94  TObject *Clone(const char *newname) const;
95 
96  void SetEditable(Bool_t on = kTRUE) { fEditable = on; } //*TOGGLE*
97  Bool_t IsEditable() const { return fEditable; }
98  void Browse(TBrowser *);
99  void SetTitle(const char *title=""); // *MENU*
100  const char *GetTitle() const;
101  const char *GetIconName() const { return GetTitle(); }
102 
103  // Pad conversions
104  void FromPad(TVirtualPad *pad, Int_t x = 0, Int_t y = 0,
105  UInt_t w = 0, UInt_t h = 0);
106  void Draw(Option_t *option = "");
107  void Paint(Option_t *option = "");
109  void ExecuteEvent(Int_t event, Int_t px, Int_t py);
110  char *GetObjectInfo(Int_t px, Int_t py) const;
111 
112  // Transformations
113  void SetPalette(const TImagePalette *palette);
114  void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height); //*MENU*
115  void UnZoom(); //*MENU*
116  void Flip(Int_t flip = 180); //*MENU*
117  void Mirror(Bool_t vert = kTRUE); //*MENU*
118  void Scale(UInt_t width, UInt_t height); //*MENU*
119  void Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd,
120  UInt_t toWidth, UInt_t toHeight); //*MENU*
121  void Tile(UInt_t width, UInt_t height); //*MENU*
122  void Crop(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0); //*MENU*
123  void Pad(const char *color = "#00FFFFFF", UInt_t left = 0,
124  UInt_t right = 0, UInt_t top = 0, UInt_t bottom = 0); //*MENU*
125  void Blur(Double_t hr = 3, Double_t vr = 3); //*MENU*
126  Double_t *Vectorize(UInt_t max_colors = 256, UInt_t dither = 4, Int_t opaque_threshold = 1);
127  void Gray(Bool_t on = kTRUE); //*TOGGLE* *GETTER=IsGray
128  void StartPaletteEditor(); //*MENU*
129  void HSV(UInt_t hue = 0, UInt_t radius = 360, Int_t H = 0, Int_t S = 0, Int_t V = 0,
130  Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0);
131  void Merge(const TImage *im, const char *op = "alphablend", Int_t x = 0, Int_t y = 0);
132  void Append(const TImage *im, const char * option = "+", const char *color = "#00000000");
133  void Gradient(UInt_t angle = 0, const char *colors = "#FFFFFF #000000", const char *offsets = 0,
134  Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0);
135  void Bevel(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0, const char *hi = "#ffdddddd",
136  const char *lo = "#ff555555", UShort_t thick = 1, Bool_t pressed = kFALSE);
137  void DrawText(Int_t x = 0, Int_t y = 0, const char *text = "", Int_t size = 12,
138  const char *color = 0, const char *font = "fixed", EText3DType type = TImage::kPlain,
139  const char *fore_file = 0, Float_t angle = 0);
140  void DrawText(TText *text, Int_t x = 0, Int_t y = 0);
141 
142  // Vector graphics
143  void BeginPaint(Bool_t fast = kTRUE);
144  void EndPaint();
145  void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col = "#000000", UInt_t thick = 1);
146  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);
147  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);
148  void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col = "#000000", UInt_t thick = 1);
149  void FillRectangle(const char *col = 0, Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0);
150  void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col = "#000000", UInt_t thick = 1, TImage::ECoordMode mode = kCoordModeOrigin);
151  void PutPixel(Int_t x, Int_t y, const char *col = "#000000");
152  void PolyPoint(UInt_t npt, TPoint *ppt, const char *col = "#000000", TImage::ECoordMode mode = kCoordModeOrigin);
153  void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col = "#000000", UInt_t thick = 1);
154  void FillPolygon(UInt_t npt, TPoint *ppt, const char *col = "#000000", const char *stipple = 0, UInt_t w = 16, UInt_t h = 16);
155  void FillPolygon(UInt_t npt, TPoint *ppt, TImage *tile);
156  void CropPolygon(UInt_t npt, TPoint *ppt);
157  void DrawFillArea(UInt_t npt, TPoint *ppt, const char *col = "#000000", const char *stipple = 0, UInt_t w = 16, UInt_t h = 16);
158  void DrawFillArea(UInt_t npt, TPoint *ppt, TImage *tile);
159  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);
160  void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, TImage *tile);
161  void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths);
162  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);
163  void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t *ic);
164  void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col = 0);
165  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);
166  void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col = "#000000", Int_t thick = 1);
167  void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col = "#000000", Int_t thick = 1);
168  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);
169  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);
170 
171  // Input / output
172  void ReadImage(const char *file, EImageFileTypes type = TImage::kUnknown);
173  void WriteImage(const char *file, EImageFileTypes type = TImage::kUnknown); //*MENU*
174  void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette = 0);
175  void SetImage(const TArrayD &imageData, UInt_t width, TImagePalette *palette = 0);
176  void SetImage(const TVectorD &imageData, UInt_t width, TImagePalette *palette = 0);
177  void SetImage(Pixmap_t pxm, Pixmap_t mask = 0);
178  void FromWindow(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0);
179  void FromGLBuffer(UChar_t* buf, UInt_t w, UInt_t h);
180 
181  // Utilities
182  UInt_t GetWidth() const;
183  UInt_t GetHeight() const;
184  UInt_t GetScaledWidth() const;
185  UInt_t GetScaledHeight() const;
186  Bool_t IsValid() const { return fImage ? kTRUE : kFALSE; }
187  Bool_t IsGray() const { return fIsGray; }
188  ASImage *GetImage() const { return fImage; }
189  void SetImage(ASImage *image) { DestroyImage(); fImage = image; }
190  TImage *GetScaledImage() const { return fScaledImage; }
192  Pixmap_t GetMask();
193  TArrayL *GetPixels(Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0);
195  UInt_t *GetArgbArray();
196  UInt_t *GetRgbaArray();
199  void GetImageBuffer(char **buffer, int *size, EImageFileTypes type = TImage::kPng);
200  void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const;
202  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 = "");
203  void SetPaletteEnabled(Bool_t on = kTRUE); // *TOGGLE*
204  void SavePrimitive(std::ostream &out, Option_t *option = "");
205 
206  static const ASVisual *GetVisual();
207  static UInt_t AlphaBlend(UInt_t bot, UInt_t top);
208  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 = "");
209 
210  // some static functions
211  Bool_t SetJpegDpi(const char *name, UInt_t dpi = 72);
212 
213  ClassDef(TASImage,2) // image processing class
214 };
215 
216 #endif
const int nx
Definition: kalman.C:16
void SetTitle(const char *title="")
Set a title for an image.
Definition: TASImage.cxx:6271
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].
Definition: TASImage.cxx:2828
Bool_t IsGray() const
Definition: TASImage.h:187
EImageFileTypes
Definition: TImage.h: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)
Draw a dashed line with thick pixel width.
Definition: TASImage.cxx:4457
void PutPixel(Int_t x, Int_t y, const char *col="#000000")
Draw a point at the specified position.
Definition: TASImage.cxx:4684
static Bool_t InitVisual()
Static function to initialize the ASVisual.
Definition: TASImage.cxx:2195
void SetPaletteEnabled(Bool_t on=kTRUE)
Switch on/off the image palette.
Definition: TASImage.cxx:6686
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
Bool_t IsValid() const
Definition: TASImage.h:186
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.
Definition: TASImage.cxx:4113
Image class.
Definition: TASImage.h:33
static const ASVisual * GetVisual()
Return visual.
Definition: TASImage.cxx:5159
EImageFileTypes GetFileType(const char *ext)
Return file type depending on specified extension.
Definition: TASImage.cxx:815
unsigned short UShort_t
Definition: RtypesCore.h:36
TH1 * h
Definition: legend2.C:5
void Draw(Option_t *option="")
Draw image.
Definition: TASImage.cxx:1167
char * GetObjectInfo(Int_t px, Int_t py) const
Get image pixel coordinates and the pixel value at the mouse pointer.
Definition: TASImage.cxx:1814
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.
Definition: TASImage.cxx:4073
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.
Definition: TASImage.cxx:5005
UInt_t GetScaledWidth() const
Return width of the displayed image not of the original image.
Definition: TASImage.cxx:2166
#define H(x, y, z)
UInt_t GetHeight() const
Return height of original image not of the displayed image.
Definition: TASImage.cxx:2157
Bool_t fEditable
! kTRUE image can be resized, moved by resizing/moving gPad
Definition: TASImage.h:68
UInt_t * GetArgbArray()
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible...
Definition: TASImage.cxx:3585
void StartPaletteEditor()
Start palette editor.
Definition: TASImage.cxx:2249
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void ReadImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Read specified image file.
Definition: TASImage.cxx:475
UInt_t GetWidth() const
Return width of original image not of the displayed image.
Definition: TASImage.cxx:2148
const Bool_t kFALSE
Definition: Rtypes.h:92
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.
Definition: TASImage.cxx:2021
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 ...
Definition: TASImage.cxx:1068
Handle_t Drawable_t
Definition: GuiTypes.h:32
An abstract interface to image processing library.
Definition: TImage.h:37
void Browse(TBrowser *)
Browse image.
Definition: TASImage.cxx:6240
void CreateThumbnail()
Create image thumbnail.
Definition: TASImage.cxx:6064
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.
Definition: TASImage.cxx:3903
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.
Definition: TASImage.cxx:6292
UInt_t * GetScanline(UInt_t y)
Return a pointer to scan-line.
Definition: TASImage.cxx:3659
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.
Definition: TASImage.cxx:5930
Double_t * GetVecArray()
Return a pointer to internal array[width x height] of double values [0,1].
Definition: TASImage.cxx:2478
Bool_t SetImageBuffer(char **buffer, EImageFileTypes type=TImage::kPng)
Create image from compressed buffer.
Definition: TASImage.cxx:6017
static THashTable * fgPlugList
! hash table containing loaded plugins
Definition: TASImage.h:72
void PolyPoint(UInt_t npt, TPoint *ppt, const char *col="#000000", TImage::ECoordMode mode=kCoordModeOrigin)
Draw a poly point.
Definition: TASImage.cxx:4719
void SetEditable(Bool_t on=kTRUE)
Definition: TASImage.h:96
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Is the mouse in the image ?
Definition: TASImage.cxx:1678
void Paint(Option_t *option="")
Paint image.
Definition: TASImage.cxx:1361
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&#39;s r...
Definition: TASImage.cxx:6815
THashTable implements a hash table to store TObject&#39;s.
Definition: THashTable.h:39
Double_t x[n]
Definition: legend1.C:17
ASImage * GetImage() const
Definition: TASImage.h:188
#define ClassDef(name, id)
Definition: Rtypes.h:254
EColorChan
Definition: TImage.h:98
void BeginPaint(Bool_t fast=kTRUE)
BeginPaint initializes internal array[width x height] of ARGB32 pixel values.
Definition: TASImage.cxx:3526
void EndPaint()
EndPaint does internal RLE compression of image data.
Definition: TASImage.cxx:3558
const int ny
Definition: kalman.C:17
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.
Definition: TASImage.cxx:5119
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas=kTRUE)
Map file type to/from AfterImage types.
Definition: TASImage.cxx:859
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...
Definition: TASImage.cxx:2500
UInt_t fZoomOffY
! Y - offset for zooming im image pixels
Definition: TASImage.h:64
void Gray(Bool_t on=kTRUE)
Convert RGB image to Gray image and vice versa.
Definition: TASImage.cxx:6500
static UInt_t AlphaBlend(UInt_t bot, UInt_t top)
Return alpha-blended value computed from bottom and top pixel values.
Definition: TASImage.cxx:5148
void WriteImage(const char *file, EImageFileTypes type=TImage::kUnknown)
Write image to specified file.
Definition: TASImage.cxx:644
Base class for several text objects.
Definition: TText.h:33
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).
Definition: TASImage.cxx:5423
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
void Scale(UInt_t width, UInt_t height)
Scale the original image.
Definition: TASImage.cxx:1911
void DrawGlyph(void *bitmap, UInt_t color, Int_t x, Int_t y)
Draw glyph bitmap.
Definition: TASImage.cxx:5704
R__EXTERN TImagePalette * gWebImagePalette
Definition: TAttImage.h:116
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...
Definition: TASImage.cxx:3359
Int_t fPaintMode
! 1 - fast mode, 0 - low memory slow mode
Definition: TASImage.h:69
Definition: TPoint.h:33
void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TASImage.cxx:6715
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.
Definition: TASImage.cxx:2406
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.
Definition: TASImage.cxx:4273
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.
Definition: TASImage.cxx:4162
void GetZoomPosition(UInt_t &x, UInt_t &y, UInt_t &w, UInt_t &h) const
Return the zoom parameters.
Definition: TASImage.cxx:2184
Bool_t SetJpegDpi(const char *name, UInt_t dpi=72)
Set an image printing resolution in Dots Per Inch units.
Definition: TASImage.cxx:6759
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.
Definition: TASImage.cxx:4802
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col="#000000", Int_t thick=1)
Draw a circle.
Definition: TASImage.cxx:6373
RooArgSet S(const RooAbsArg &v1)
void UnZoom()
Un-zoom the image to original size.
Definition: TASImage.cxx:2043
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...
Definition: TASImage.cxx:3729
Bool_t fIsGray
! kTRUE if image is gray
Definition: TASImage.h:71
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.
Definition: TASImage.cxx:981
void Append(const TImage *im, const char *option="+", const char *color="#00000000")
Append image.
Definition: TASImage.cxx:3485
void SetPalette(const TImagePalette *palette)
Set a new palette to an image.
Definition: TASImage.cxx:1855
void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Draw wide line.
Definition: TASImage.cxx:5657
TRandom2 r(17)
Double_t fMaxValue
! max value in image
Definition: TASImage.h:61
UInt_t GetScaledHeight() const
Return height of the displayed image not of the original image.
Definition: TASImage.cxx:2175
const char * GetTitle() const
Title is used to keep 32x32 xpm image&#39;s thumbnail.
Definition: TASImage.cxx:6253
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
void Merge(const TImage *im, const char *op="alphablend", Int_t x=0, Int_t y=0)
Merge two images.
Definition: TASImage.cxx:2714
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.
Definition: TASImage.cxx:6614
void FloodFill(Int_t x, Int_t y, const char *col, const char *min_col, const char *max_col=0)
Flood fill.
Definition: TASImage.cxx:6492
void CropPolygon(UInt_t npt, TPoint *ppt)
Crop a convex polygon.
Definition: TASImage.cxx:5397
void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths)
Crop spans.
Definition: TASImage.cxx:4917
unsigned int UInt_t
Definition: RtypesCore.h:42
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...
Definition: TASImage.cxx:1945
Pixmap_t GetMask()
Returns image mask pixmap (alpha channel).
Definition: TASImage.cxx:2300
Array of longs (32 or 64 bits per element).
Definition: TArrayL.h:29
void GetFillAreaSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **firstPoint, UInt_t **firstWidth)
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.
Definition: TASImage.cxx:5341
void Blur(Double_t hr=3, Double_t vr=3)
Perform Gaussian blur of the image (useful for drop shadows).
Definition: TASImage.cxx:2753
UInt_t fZoomOffX
! X - offset for zooming in image pixels
Definition: TASImage.h:63
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas=kTRUE)
Map quality to/from AfterImage quality.
Definition: TASImage.cxx:944
Bool_t IsEditable() const
Definition: TASImage.h:97
void Flip(Int_t flip=180)
Flip image in place.
Definition: TASImage.cxx:2071
virtual ~TASImage()
Image destructor, clean up image and visual.
Definition: TASImage.cxx:348
TASImage * fScaledImage
! temporary scaled and zoomed image produced from original image
Definition: TASImage.h:60
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...
Definition: TASImage.cxx:3807
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 ...
Definition: TASImage.cxx:2940
UInt_t * GetRgbaArray()
Return a pointer to an array[width x height] of RGBA32 values.
Definition: TASImage.cxx:3613
Color * colors
Definition: X3DBuffer.c:19
void Tile(UInt_t width, UInt_t height)
Tile the original image.
Definition: TASImage.cxx:1981
Int_t fZoomUpdate
! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops ...
Definition: TASImage.h:67
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...
Definition: TASImage.cxx:2578
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...
Definition: TASImage.cxx:3243
void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col="#000000", UInt_t thick=1, TImage::ECoordMode mode=kCoordModeOrigin)
Draw a polyline.
Definition: TASImage.cxx:4659
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.
Definition: TASImage.cxx:3408
void Mirror(Bool_t vert=kTRUE)
Mirror image in place.
Definition: TASImage.cxx:2118
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.
Definition: TASImage.cxx:6413
double Double_t
Definition: RtypesCore.h:55
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.
Definition: TASImage.cxx:1341
TText * text
int type
Definition: TGX11.cxx:120
UInt_t fZoomHeight
! hight of zoomed image in image pixels
Definition: TASImage.h:66
ECoordMode
Definition: TImage.h:93
Double_t y[n]
Definition: legend1.C:17
const char * GetIconName() const
Returns mime type name of object.
Definition: TASImage.h:101
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.
Definition: TASImage.cxx:4615
void GetImageBuffer(char **buffer, int *size, EImageFileTypes type=TImage::kPng)
Return in-memory buffer compressed according image type.
Definition: TASImage.cxx:5965
void FromGLBuffer(UChar_t *buf, UInt_t w, UInt_t h)
Creates an image (screenshot) from a RGBA buffer.
Definition: TASImage.cxx:6665
A class to define a conversion from pixel values to pixel color.
Definition: TAttImage.h:39
void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
Internal line drawing.
Definition: TASImage.cxx:3914
void SetImage(ASImage *image)
Definition: TASImage.h:189
TObject * Clone(const char *newname) const
Clone image.
Definition: TASImage.cxx:2782
Array of doubles (64 bits per element).
Definition: TArrayD.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t fMinValue
! min value in image
Definition: TASImage.h:62
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.
Definition: TASImage.cxx:4216
static ASVisual * fgVisual
pointer to visual structure
Definition: TASImage.h:74
TASImage()
Default image constructor.
Definition: TASImage.cxx:217
static Bool_t fgInit
global flag to init afterimage only once
Definition: TASImage.h:75
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.
Definition: TASImage.cxx:6453
const char * TypeFromMagicNumber(const char *file)
Guess the file type from the first byte of file.
Definition: TASImage.cxx:392
void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col="#000000", UInt_t thick=1)
Draw segments.
Definition: TASImage.cxx:4779
Definition: file.py:1
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.
Definition: TASImage.cxx:6333
Handle_t Pixmap_t
Definition: GuiTypes.h:31
TASImage & operator=(const TASImage &img)
Image assignment operator.
Definition: TASImage.cxx:314
float type_of_call hi(const int &, const int &)
unsigned char UChar_t
Definition: RtypesCore.h:34
void flip(struct mesh *m, struct behavior *b, struct otri *flipedge)
Definition: triangle.c:7889
const int nn
UInt_t fZoomWidth
! width of zoomed image in image pixels
Definition: TASImage.h:65
ASImage * fGrayImage
! gray image
Definition: TASImage.h:70
EText3DType
Definition: TImage.h:66
void DestroyImage()
Destroy image.
Definition: TASImage.cxx:172
TImage * GetScaledImage() const
Definition: TASImage.h:190
void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
Draw an horizontal line.
Definition: TASImage.cxx:3868
const Bool_t kTRUE
Definition: Rtypes.h:91
Pixmap_t GetPixmap()
Returns image pixmap.
Definition: TASImage.cxx:2268
ASImage * fImage
! pointer to image structure of original image
Definition: TASImage.h:59
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".
Definition: TASImage.cxx:5196
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse events.
Definition: TASImage.cxx:1701
void SetDefaults()
Set default parameters.
Definition: TASImage.cxx:190
char name[80]
Definition: TGX11.cxx:109
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.
Definition: TASImage.cxx:1219
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.
Definition: TASImage.cxx:3003
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.
Definition: TASImage.cxx:3833