library: libASImage
#include "TASImage.h"

TASImage


class description - source file - inheritance tree (.pdf)

class TASImage : public TImage

Inheritance Chart:
TObject
<-
TNamed
TAttImage
<-
TImage
<-
TASImage
    private:
void CreateThumbnail() void DestroyImage() void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char* pDash, UInt_t col, UInt_t thick) void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char* pDash, UInt_t col, UInt_t thick) void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char* pDash, UInt_t col) void DrawGlyph(void* bitmap, UInt_t color, Int_t x, Int_t y) void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick) void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick) void DrawTextTTF(Int_t x, Int_t y, const char* text, Int_t size, UInt_t color, const char* font_name, Float_t angle) void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick) void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick) void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height) void GetFillAreaSpans(UInt_t npt, TPoint* ppt, UInt_t* nspans, TPoint** firstPoint, UInt_t** firstWidth) Bool_t GetPolygonSpans(UInt_t npt, TPoint* ppt, UInt_t* nspans, TPoint** firstPoint, UInt_t** firstWidth) void SetDefaults() protected:
TImage::EImageFileTypes GetFileType(const char* ext) static Bool_t InitVisual() void MapFileTypes(TImage::EImageFileTypes& type, UInt_t& astype, Bool_t toas = kTRUE) void MapQuality(TAttImage::EImageQuality& quality, UInt_t& asquality, Bool_t toas = kTRUE) public:
TASImage() TASImage(UInt_t w, UInt_t h) TASImage(const char* file, TImage::EImageFileTypes type = kUnknown) TASImage(const char* name, const Double_t* imageData, UInt_t width, UInt_t height, TImagePalette* palette = 0) TASImage(const char* name, const TArrayD& imageData, UInt_t width, TImagePalette* palette = 0) TASImage(const char* name, const TVectorD& imageData, UInt_t width, TImagePalette* palette = 0) TASImage(const TASImage& img) virtual ~TASImage() static UInt_t AlphaBlend(UInt_t bot, UInt_t top) virtual void Append(const TImage* im, const char* option = "+", const char* color = "#00000000") virtual void BeginPaint(Bool_t fast = kTRUE) virtual 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) virtual void Blur(Double_t hr = 3, Double_t vr = 3) virtual void Browse(TBrowser*) static TClass* Class() virtual TObject* Clone(const char* newname) const virtual 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, TImage::EColorChan chan = kAllChan) virtual void Crop(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) virtual void CropPolygon(UInt_t npt, TPoint* ppt) virtual void CropSpans(UInt_t npt, TPoint* ppt, UInt_t* widths) virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) virtual void Draw(Option_t* option = "") virtual 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) virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, UInt_t* ic) virtual void DrawCircle(Int_t x, Int_t y, Int_t r, const char* col = "#000000", UInt_t thick = 1) virtual 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) virtual 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) virtual void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char* col = "#000000", UInt_t thick = 1) virtual void DrawEllips2(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char* col = "#000000", UInt_t thick = 1) virtual void DrawFillArea(UInt_t npt, TPoint* ppt, const char* col = "#000000", const char* stipple = "0", UInt_t w = 16, UInt_t h = 16) virtual void DrawFillArea(UInt_t npt, TPoint* ppt, TImage* tile) virtual void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char* col = "#000000", UInt_t thick = 1) virtual void DrawPolyLine(UInt_t nn, TPoint* xy, const char* col = "#000000", UInt_t thick = 1, TImage::ECoordMode mode = kCoordModeOrigin) virtual void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char* col = "#000000", UInt_t thick = 1) virtual void DrawSegments(UInt_t nseg, Segment_t* seg, const char* col = "#000000", UInt_t thick = 1) virtual void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char* col = "#000000", UInt_t thick = 1) virtual 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", TImage::EText3DType type = TImage::kPlain, const char* fore_file = "0", Float_t angle = 0) virtual void EndPaint() virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void FillPolygon(UInt_t npt, TPoint* ppt, const char* col = "#000000", const char* stipple = "0", UInt_t w = 16, UInt_t h = 16) virtual void FillPolygon(UInt_t npt, TPoint* ppt, TImage* tile) virtual void FillRectangle(const char* col = "0", Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0) virtual 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) virtual void FillSpans(UInt_t npt, TPoint* ppt, UInt_t* widths, TImage* tile) virtual void Flip(Int_t flip = 180) virtual void FloodFill(Int_t x, Int_t y, const char* col, const char* min_col, const char* max_col = "0") virtual void FromPad(TVirtualPad* pad, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) virtual void FromWindow(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) virtual UInt_t* GetArgbArray() virtual TArrayD* GetArray(UInt_t w = 0, UInt_t h = 0, TImagePalette* pal = gWebImagePalette) virtual UInt_t GetHeight() const virtual const char* GetIconName() const ASImage* GetImage() const virtual void GetImageBuffer(char** buffer, int* size, TImage::EImageFileTypes type = TImage::kPng) virtual Pixmap_t GetMask() virtual char* GetObjectInfo(Int_t px, Int_t py) const virtual TArrayL* GetPixels(Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) virtual Pixmap_t GetPixmap() UInt_t GetScaledHeight() const virtual TImage* GetScaledImage() const UInt_t GetScaledWidth() const virtual UInt_t* GetScanline(UInt_t y) virtual const char* GetTitle() const static const ASVisual* GetVisual() const virtual UInt_t GetWidth() const virtual 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) virtual void Gray(Bool_t on = kTRUE) virtual 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) static void Image2Drawable(ASImage* im, Drawable_t wid, Int_t x, Int_t y) virtual TClass* IsA() const virtual Bool_t IsEditable() const virtual Bool_t IsGray() const virtual Bool_t IsValid() const virtual void Merge(const TImage* im, const char* op = "alphablend", Int_t x = 0, Int_t y = 0) virtual void Mirror(Bool_t vert = kTRUE) TASImage& operator=(const TASImage& img) virtual void Pad(const char* color = "#00FFFFFF", UInt_t left = 0, UInt_t right = 0, UInt_t top = 0, UInt_t bottom = 0) virtual void Paint(Option_t* option = "") virtual void PaintImage(Drawable_t wid, Int_t x, Int_t y) virtual void PolyPoint(UInt_t npt, TPoint* ppt, const char* col = "#000000", TImage::ECoordMode mode = kCoordModeOrigin) virtual void PutPixel(Int_t x, Int_t y, const char* col = "#000000") virtual void ReadImage(const char* file, TImage::EImageFileTypes type = TImage::kUnknown) virtual void SavePrimitive(ofstream& out, Option_t* option) virtual void Scale(UInt_t width, UInt_t height) virtual void SetEditable(Bool_t on = kTRUE) virtual void SetImage(const Double_t* imageData, UInt_t width, UInt_t height, TImagePalette* palette = 0) virtual void SetImage(const TArrayD& imageData, UInt_t width, TImagePalette* palette = 0) virtual void SetImage(const TVectorD& imageData, UInt_t width, TImagePalette* palette = 0) virtual void SetImage(Pixmap_t pxm, Pixmap_t mask = 0) virtual Bool_t SetImageBuffer(char** buffer, TImage::EImageFileTypes type = TImage::kPng) virtual void SetPalette(const TImagePalette* palette) virtual void SetPaletteEnabled(Bool_t on = kTRUE) virtual void SetTitle(const char* title = "") virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void StartPaletteEditor() virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void Tile(UInt_t width, UInt_t height) virtual void UnZoom() virtual void Vectorize(UInt_t max_colors = 256, UInt_t dither = 4, Int_t opaque_threshold = 1) virtual void WriteImage(const char* file, TImage::EImageFileTypes type = TImage::kUnknown) virtual void Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height)

Data Members


    protected:
ASImage* fImage ! pointer to image structure of original image TASImage* fScaledImage ! temporary scaled and zoomed image produced from original image Double_t fMaxValue ! max value in image Double_t fMinValue ! min value in image UInt_t fZoomOffX ! X - offset for zooming in image pixels UInt_t fZoomOffY ! Y - offset for zooming im image pixels UInt_t fZoomWidth ! width of zoomed image in image pixels UInt_t fZoomHeight ! hight of zoomed image in image pixels Int_t fZoomUpdate ! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops Bool_t fEditable ! kTRUE image can be resized, moved by resizing/moving gPad Int_t fPaintMode ! 1 - fast mode, 0 - low memory slow mode Pixmap_t fPic ! pixmap Pixmap_t fMask ! mask ASImage* fGrayImage ! gray image Bool_t fIsGray ! kTRUE if image is gray static THashTable* fgPlugList ! hash table containing loaded plugins static ASVisual* fgVisual pointer to visual structure static Bool_t fgInit global flag to init afterimage only once public:
static const enum TASImage:: kNoZoom static const enum TASImage:: kZoom static const enum TASImage:: kZoomOps static const enum TASImage:: kReadWritePNG static const enum TASImage:: kReadWriteVector

Class Description

                                                                      
 TASImage                                                             
                                                                      
 Interface to image processing library using libAfterImage.           
 It allows reading and writing of images in different                 
 formats, several image manipulations (scaling, tiling, merging,      
 etc.) and displaying in pads.                                        
 The size of the image on the screen does not depend on the original  
 size of the image but on the size of the pad. Therefore it is very   
 easy to resize the image on the screen by resizing the pad.          
                                                                      
 Besides reading an image from a file an image can be defined by a    
 two dimensional array of values. A palette defines the color of      
 each value.                                                          
                                                                      
 The image can be zoomed by defining a rectangle with the mouse.      
 The color palette can be modified with a GUI, just select            
 StartPaletteEditor() from the context menu.                          
                                                                      
                                                                      


void DestroyImage()
 helper class

void SetDefaults()
 set default parameters

TASImage()
 Default image ctor.

TASImage(UInt_t w, UInt_t h) : TImage(w, h)
 create an empty image

TASImage(const char *file, EImageFileTypes) : TImage(file)
 Create an image object and read from specified file.
 For more information see description of function ReadImage()
 which is called by this constructor.

TASImage(const char *name, const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette) : TImage(name)
 Creates an image depending on the values of imageData.
 For more information see function SetImage() which is called
 by this constructor.

TASImage(const char *name, const TArrayD &imageData, UInt_t width, TImagePalette *palette) : TImage(name)
 Creates an image depending on the values of imageData. The size
 of the image is width X (imageData.fN / width).
 For more information see function SetImage() which is called by
 this constructor.

TASImage(const char *name, const TVectorD &imageData, UInt_t width, TImagePalette *palette) : TImage(name)
 Creates an image depending on the values of imageData. The size
 of the image is width X (imageData.fN / width).
 For more information see function SetImage() which is called by
 this constructor.

TASImage(const TASImage &img) : TImage(img)
 Image copy ctor.

~TASImage()
 Image dtor, clean up image and visual.

void ReadImage(const char *filename, EImageFileTypes /*type*/)
 Read specified image file. The file type is determined by
 the file extension (the type argument is ignored). It will
 attempt to append .gz and then .Z to the filename and find such
 a file. If the filename ends with extension consisting of digits
 only, it will attempt to find the file with this extension stripped
 off. On success this extension will be used to load subimage from
 the file with that number. Subimage is supported only for GIF files.

 It is also possible to put XPM raw string (see also SetImageBuffer) as
 the first input parameter ("filename"), such string  is returned by
 GetImageBuffer method.

void WriteImage(const char *file, EImageFileTypes type)
 Write image to specified file. If there is no file extension or
 if the file extension is unknown, the type argument will be used
 to determine the file type. The quality and compression is derived from
 the TAttImage values.
 The size of the image in the file is independent of the actually
 displayed size and zooming factor on the screen. This function
 writes always the original image with its size in the file

TImage::EImageFileTypes GetFileType(const char *ext)
 Return file type depending on specified extension.
 Protected method.

void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas)
 Map file type to/from AfterImage types.
 Protected method.

void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas)
 Map quality to/from AfterImage quality.
 Protected method.

void SetImage(const Double_t *imageData, UInt_t width, UInt_t height, TImagePalette *palette)
 Deletes the old image and creates a new image depending on the values
 of imageData. The size of the image is width X height.
 The color of each pixel depends on the imageData of the corresponding
 pixel. The palette is used to convert an image value into its color.
 If palette is not defined (palette = 0) a default palette is used.
 Any previously defined zooming is reset.

void SetImage(const TArrayD &imageData, UInt_t width, TImagePalette *palette)
 Deletes the old image and creates a new image depending on the values
 of imageData. The size of the image is width X (imageData.fN / width).
 The color of each pixel depends on the imageData of the corresponding
 pixel. The palette is used to convert an image value into its color.
 If palette is not defined (palette = 0) a default palette is used.
 Any previously defined zooming is reset.

void SetImage(const TVectorD &imageData, UInt_t width, TImagePalette *palette)
 Deletes the old image and creates a new image depending on the values
 of imageData. The size of the image is width X (imageData.fN / width).
 The color of each pixel depends on the imageData of the corresponding
 pixel. The palette is used to convert an image value into its color.
 If palette is not defined (palette = 0) a default palette is used.
 Any previously defined zooming is reset.

void FromPad(TVirtualPad *pad, Int_t x, Int_t y, UInt_t w, UInt_t h)
 Create an image from the given pad, afterwards this image can be
 saved in any of the supported image formats.

void Draw(Option_t *option)
 Draw image. Support the following drawing options:
 "T[x,y[,tint]]" - tile image (use specified offset and tint),
                   e.g. "T100,100,#556655"
                   with this option the zooming is not possible
                   and disabled
 "N"             - display in new canvas (of original image size)
 "X"             - image is drawn expanded to pad size
 "Z"             - image is vectorized and image palette is drawn

 The default is to display the image in the current gPad.

void Image2Drawable(ASImage *im, Drawable_t wid, Int_t x, Int_t y)
 draw asimage on drawable

void PaintImage(Drawable_t wid, Int_t x, Int_t y)
 draw image on drawable wid (pixmap, window ) at x,y position

void Paint(Option_t *option)
 Paint image. Support the following drawing options:
 "T[x,y[,tint]]" - tile image (use specified offset and tint),
                   e.g. "T100,100,#556655"
                   with this option the zooming is not possible
                   and disabled
 "N"             - display in new canvas (of original image size)
 "X"             - image is drawn expanded to pad size
 "Z"             - image is vectorized and image palette is drawn

 The default is to display the image in the current gPad.

Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Is the mouse in the image?

void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute mouse events.

char* GetObjectInfo(Int_t px, Int_t py) const
 Get image pixel coordinates and the pixel value at the mouse pointer.

void SetPalette(const TImagePalette *palette)
 Set a new palette to an image. Only images that were created with the
 SetImage() functions can be modified with this function.
 The previously used palette is destroyed.

void Scale(UInt_t toWidth, UInt_t toHeight)
 Scales the original image. The size of the image on the screen does not
 change because it is defined by the size of the pad.
 This function can be used to change the size of an image before writing
 it into a file. The colors of the new pixels are interpolated.
 An image created with the SetImage() functions cannot be modified with
 the function SetPalette() any more after a call of this function!

void Tile(UInt_t toWidth, UInt_t toHeight)
 Tiles the original image.

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.
 Note: the size on the screen is defined by the size of the pad.
 The original image is not modified by this function.
 If width or height is larger than the original image they are reduced to
 the width and height of the image.
 If the off values are too large (off + width > image width) than the off
 values are decreased. For example: offX = image width - width
 Note: the parameters are always relative to the original image not to the
 size of an already zoomed image.

void UnZoom()
 Un-zooms the image to original size.

 UnZoom() - performs undo for Zoom,Crop,Scale actions

void Flip(Int_t flip)
 Flip image in place. Flip is either 90, 180, 270, 180 is default.
 This function manipulates the original image and destroys the
 scaled and zoomed image which will be recreated at the next call of
 the Draw function. If the image is zoomed the zoom - coordinates are
 now relative to the new image.
 This function cannot be used for images which were created with the
 SetImage() functions, because the original pixel values would be
 destroyed.

void Mirror(Bool_t vert)
 Mirror image in place. If vert is true mirror in vertical axis,
 horizontal otherwise. Vertical is default.
 This function manipulates the original image and destroys the
 scaled and zoomed image which will be recreated at the next call of
 the Draw function. If the image is zoomed the zoom - coordinates are
 now relative to the new image.
 This function cannot be used for images which were created with the
 SetImage() functions, because the original pixel values would be
 destroyed.

UInt_t GetWidth() const
 Return width of original image not of the displayed image.
 (Number of image pixels)

UInt_t GetHeight() const
 Return height of original image not of the displayed image.
 (Number of image pixels)

UInt_t GetScaledWidth() const
 Return width of the displayed image not of the original image.
 (Number of screen pixels)

UInt_t GetScaledHeight() const
 Return height of the displayed image not of the original image.
 (Number of screen pixels)

Bool_t InitVisual()
 Static function to initialize the ASVisual.

void StartPaletteEditor()
 Start palette editor.

Pixmap_t GetPixmap()
 returns image pixmap

Pixmap_t GetMask()
 returns image mask pixmap (alpha channel)

void SetImage(Pixmap_t pxm, Pixmap_t mask)
 create image from pixmap

TArrayL* GetPixels(Int_t x, Int_t y, UInt_t width, UInt_t height)
 returns 2D array of machine dependent pixel values

TArrayD* GetArray(UInt_t w, UInt_t h, TImagePalette *palette)
 Converts an image into 2D array of doubles according to palette.
 If palette is ZERO a color converted to double value [0, 1] according to formula
   Double_t((r << 16) + (g << 8) + b)/0xFFFFFF

void DrawText(Int_t x, Int_t y, const char *text, Int_t size, const char *color, const char *font_name, EText3DType type, const char *fore_file, Float_t angle)
 Draw text of size (in pixels for TrueType fonts)
 at position (x, y) with color  specified by hex string.
   font_name - TrueType font's filename or X font spec or alias.
   3D style of text is one of the following:
     0 - plain 2D text, 1 - embossed, 2 - sunken, 3 - shade above,
     4 - shade below, 5 - embossed thick, 6 - sunken thick.
     7 - ouline above, 8 - ouline below, 9 - full ouline.
  fore_file specifies foreground texture of text.

void Merge(const TImage *im, const char *op, Int_t x, Int_t y)
 Merge two images.

 op is string which specifies overlay operation. Supported operations are:
    add            - color addition with saturation
    alphablend     - alpha-blending
    allanon        - color values averaging
    colorize       - hue and saturate bottom image same as top image
    darken         - use lowest color value from both images
    diff           - use absolute value of the color difference between two images
    dissipate      - randomly alpha-blend images
    hue            - hue bottom image same as top image
    lighten        - use highest color value from both images
    overlay        - some wierd image overlaying(see GIMP)
    saturate       - saturate bottom image same as top image
    screen         - another wierd image overlaying(see GIMP)
    sub            - color substraction with saturation
    tint           - tinting image with image
    value          - value bottom image same as top image

void Blur(Double_t hr, Double_t vr)
 Performs Gaussian blurr of the image (usefull for drop shadows)
    hr         - horizontal radius of the blurr
    vr         - vertical radius of the blurr

TObject* Clone(const char *newname) const
 clone image

void Vectorize(UInt_t max_colors, UInt_t dither, Int_t opaque_threshold)
 Reduces colordepth of an image and fills vector of "scientific data" [0...1]

 Colors are reduced by allocating colorcells to most used colors first,
 and then approximating other colors with those allocated.
 max_colors       - maximum size of the colormap.
 dither           - number of bits to strip off the color data ( 0...7 )
 opaque_threshold - alpha channel threshold at which pixel should be
                    treated as opaque

void HSV(UInt_t hue, UInt_t radius, Int_t H, Int_t S, Int_t V, Int_t x, Int_t y, UInt_t width, UInt_t height)
 This function will tile original image to specified size with offsets
 requested, and then it will go though it and adjust hue, saturation and
 value of those pixels that have specific hue, set by affected_hue
 affected_radius parameters. When affected_radius is greater then 180
 entire image will be adjusted. Note that since grayscale colors have
 no hue - the will not get adjusted. Only saturation and value will be
 adjusted in gray pixels.
 Hue is measured as an angle on a 360 degree circle, The following is
 relationship of hue values to regular color names :
 red      - 0
 yellow   - 60
 green    - 120
 cyan     - 180
 blue     - 240
 magenta  - 300
 red      - 360

 All the hue values in parameters will be adjusted to fall withing 0-360 range.

void Gradient(UInt_t angle, const char *colors, const char *offsets, Int_t x, Int_t y, UInt_t width, UInt_t height)
 Render multipoint gradient inside rectangle of size (width, height)
 at position (x,y) within the existing image.

 angle    Given in degrees.  Default is 0.  This is the
          direction of the gradient.  Currently the only supported
          values are 0, 45, 90, 135, 180, 225, 270, 315.  0 means left
          to right, 90 means top to bottom, etc.

 colors   Whitespace-separated list of colors.  At least two
          colors are required.  Each color in this list will be visited
          in turn, at the intervals given by the offsets attribute.

 offsets  Whitespace-separated list of floating point values
          ranging from 0.0 to 1.0.  The colors from the colors attribute
          are given these offsets, and the final gradient is rendered
          from the combination of the two.  If both colors and offsets
          are given but the number of colors and offsets do not match,
          the minimum of the two will be used, and the other will be
          truncated to match.  If offsets are not given, a smooth
          stepping from 0.0 to 1.0 will be used.

void Bevel(Int_t x, Int_t y, UInt_t width, UInt_t height, const char *hi_color, const char *lo_color, UShort_t thick, Bool_t reverse)
  Bevel is used to create 3D effect while drawing buttons, or any other
 image that needs to be framed. Bevel is drawn using 2 primary colors:
 one for top and left sides - hi color, and another for bottom and
 right sides - low color. Bevel can be drawn over exisiting image or
 as newly created,  as it is shown in code below:

  TImage *img = TImage::Create();
  img->Bevel(0, 0, 400, 300, "#dddddd", "#000000", 3);


void Pad(const char *col, UInt_t l, UInt_t r, UInt_t t, UInt_t b)
 Enlarges image, padding it with specified color on each side in
 accordance with requested geometry.

void Crop(Int_t x, Int_t y, UInt_t width, UInt_t height)
 Crops an image

void Append(const TImage *im, const char *option, const char *color )
 Appends image

 option:
       "+" - appends to the right side
       "/" - appends to the bottom

void BeginPaint(Bool_t mode)
 BeginPaint initializes internal array[width x height] of ARGB32 pixel values
 That provides quick access to image during paint operations.
 To RLE compress image one needs to call EndPaint method when paintinig is over

void EndPaint()
 EndPaint does internal RLE compression of image data

UInt_t* GetArgbArray()
 Returns a pointer to internal array[width x height] of ARGB32 pixel values
 This array is directly acessible. That allows to manipulate/change the image

UInt_t* GetScanline(UInt_t y)
 return a pointer to scanline

void FillRectangleInternal(UInt_t col, Int_t x, Int_t y, UInt_t width, UInt_t height)
 Fills rectangle of size (width, height) at position (x,y)
 within the existing image with specified color.


void FillRectangle(const char *col, Int_t x, Int_t y, UInt_t width, UInt_t height)
 Fills rectangle of size (width, height) at position (x,y)
 within the existing image with specified color.

 To create new image with Fill method the following code can be used:

  TImage *img = TImage::Create();
  img->Fill("#FF00FF", 0, 0, 400, 300);

void DrawVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t col, UInt_t thick)
 vertical line

void DrawHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t col, UInt_t thick)
 horizontal line

void DrawLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, const char *col, UInt_t thick)
 draw line

void DrawLineInternal(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t col, UInt_t thick)
 internal drawing

void DrawRectangle(UInt_t x, UInt_t y, UInt_t w, UInt_t h, const char *col, UInt_t thick)
 draw rectangle

void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, const char *col, UInt_t thick, Int_t mode)
 draw box

void DrawDashHLine(UInt_t y, UInt_t x1, UInt_t x2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
 draw dashed horizontal line

void DrawDashVLine(UInt_t x, UInt_t y1, UInt_t y2, UInt_t nDash, const char *pDash, UInt_t col, UInt_t thick)
 draw dashed vertical line

void DrawDashZLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *tDash, UInt_t color)
 draw dashed line with 1 pixel width

void DrawDashLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t nDash, const char *pDash, const char *col, UInt_t thick)
 draw dashed line

void DrawPolyLine(UInt_t nn, TPoint *xy, const char *col, UInt_t thick, TImage::ECoordMode mode)
 draw polyline

void PutPixel(Int_t x, Int_t y, const char *col)
 draw point at specified position

void PolyPoint(UInt_t npt, TPoint *ppt, const char *col, TImage::ECoordMode mode)
 draw poly point

void DrawSegments(UInt_t nseg, Segment_t *seg, const char *col, UInt_t thick)
 draw segments

void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, const char *col, const char *stipple, UInt_t w, UInt_t h)
 fill spans with specified color or/and stipple

void FillSpans(UInt_t npt, TPoint *ppt, UInt_t *widths, TImage *tile)
 fille spans with tile image

void CropSpans(UInt_t npt, TPoint *ppt, UInt_t *widths)
  crop spans

void CopyArea(TImage *dst, Int_t xsrc, Int_t ysrc, UInt_t w, UInt_t h, Int_t xdst, Int_t ydst, Int_t gfunc, EColorChan)
 Copy source region to the destination image. Copy is done according
 to specified function:

 enum EGraphicsFunction {
    kGXclear = 0,               // 0
    kGXand,                     // src AND dst
    kGXandReverse,              // src AND NOT dst
    kGXcopy,                    // src (default)
    kGXandInverted,             // NOT src AND dst
    kGXnoop,                    // dst
    kGXxor,                     // src XOR dst
    kGXor,                      // src OR dst
    kGXnor,                     // NOT src AND NOT dst
    kGXequiv,                   // NOT src XOR dst
    kGXinvert,                  // NOT dst
    kGXorReverse,               // src OR NOT dst
    kGXcopyInverted,            // NOT src
    kGXorInverted,              // NOT src OR dst
    kGXnand,                    // NOT src OR NOT dst
    kGXset                      // 1
 };

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.
 x1,y1        : left down corner
 x2,y2        : right up corner
 nx,ny        : array size
 ic           : array of ARGB32 colors

 Draw a cell array. The drawing is done with the pixel presicion
 if (X2-X1)/NX (or Y) is not a exact pixel number the position of
 the top rigth corner may be wrong.

UInt_t AlphaBlend(UInt_t bot, UInt_t top)
 returns alphablended value computed from bottom and top pixel values

const ASVisual* GetVisual()
 return visual

Bool_t GetPolygonSpans(UInt_t npt, TPoint *ppt, UInt_t *nspans, TPoint **outPoint, UInt_t **outWidth)
 The code is taken on Xserver/mi/mipolycon.c
    "Copyright 1987, 1998  The Open Group"

void FillPolygon(UInt_t npt, TPoint *ppt, const char *col, const char *stipple, UInt_t w, UInt_t h)
 Fill a convex polygon with background color or bitmap
 For non convex polygon one must use DrawFillArea method

void FillPolygon(UInt_t npt, TPoint *ppt, TImage *tile)
 Fill a convex polygon with background image.
 For non convex polygon one must use DrawFillArea method

void CropPolygon(UInt_t npt, TPoint *ppt)
 Crop a convex polygon.

void DrawFillArea(UInt_t count, TPoint *ptsIn, const char *col, const char *stipple, UInt_t w, UInt_t h)
 fill a polygon (any type convex, non-convex)

void DrawFillArea(UInt_t count, TPoint *ptsIn, TImage *tile)
 fill a polygon (any type convex, non-convex)

void DrawWideLine(UInt_t x1, UInt_t y1, UInt_t x2, UInt_t y2, UInt_t color, UInt_t thick)
 draw wide line

void DrawGlyph(void *bitmap, UInt_t color, Int_t bx, Int_t by)
 Draw FT_Bitmap bitmap

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 GetImageBuffer(char **buffer, int *size, EImageFileTypes type)
 Returns in-memory buffer compressed according image type
 Buffer must be deallocated after usage.
 This method can be used for sending images over network.

Bool_t SetImageBuffer(char **buffer, EImageFileTypes type)
 create image from  compressed buffer
 Supported formats:

    PNG - by default
    XPM - two options exist:
      1.  xpm as a single string (raw buffer). Such string
          is returned by GetImageBuffer method.

    For example:
       char *buf;
       int sz;
       im1->GetImageBuffer(&buf, &int, TImage::kXpm); /*raw buffer*
       TImage *im2 = TImage::Create();
       im2->SetImageBuffer(&buf, TImage::kXpm);

      2.  xpm as an array of strigs (preparsed)

    For example:
       char *xpm[] = {
          "64 28 58 1",
          "  c #0A030C",
          ". c #1C171B"
             ...
    TImage *im = TImage::Create();
    im->SetImageBuffer(xpm, TImage::kXpm);

void CreateThumbnail()
 creates image thumbnail

void Streamer(TBuffer &b)
 streamer for ROOT I/O

void Browse(TBrowser *)
 browse image

const char* GetTitle() const
 title is used to keep 32x32 xpm image's thumbnail

void SetTitle(const char *title)
 set a title for an image

void DrawCubeBezier(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t x3, Int_t y3, const char *col, UInt_t thick)
 draws cubic bezier line

void DrawStraightEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, const char *col, UInt_t thick)
 draws straight ellips

void DrawCircle(Int_t x, Int_t y, Int_t r, const char *col, UInt_t thick)
 draws circle

void DrawEllips(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col, UInt_t thick)
 draws ellips

void DrawEllips2(Int_t x, Int_t y, Int_t rx, Int_t ry, Int_t angle, const char *col, UInt_t thick)
 draws allips

void FloodFill(Int_t /*x*/, Int_t /*y*/, const char * /*col*/, const char * /*minc*/, const char * /*maxc*/)
 flood fill

void Gray(Bool_t on)
 Converts RGB image to Gray image and vice versa.

void FromWindow(Drawable_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
 creates an image(screenshot) from  specified window

void SetPaletteEnabled(Bool_t on)
 switch on/off image palette. That also invokes calling vectorizasion of image

void SavePrimitive(ofstream &out, Option_t *)
 Save a primitive as a C++ statement(s) on output stream "out"



Inline Functions


               void GetFillAreaSpans(UInt_t npt, TPoint* ppt, UInt_t* nspans, TPoint** firstPoint, UInt_t** firstWidth)
          TASImage& operator=(const TASImage& img)
               void SetEditable(Bool_t on = kTRUE)
             Bool_t IsEditable() const
        const char* GetIconName() const
             Bool_t IsValid() const
             Bool_t IsGray() const
           ASImage* GetImage() const
            TImage* GetScaledImage() const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void StreamerNVirtual(TBuffer& b)


Author: Fons Rademakers, Reiner Rohlfs, Valeriy Onuchin 28/11/2001
Last update: root/asimage:$Name: $:$Id: TASImage.cxx,v 1.47 2005/09/04 15:41:19 rdm Exp $
Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.