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.
Several examples showing how to use this class are available in the ROOT tutorials: $ROOTSYS/tutorials/image/
TASImage() | |
TASImage(const TASImage& img) | |
TASImage(UInt_t w, UInt_t h) | |
TASImage(const char* file, TImage::EImageFileTypes type = kUnknown) | |
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 char* name, const Double_t* imageData, UInt_t width, UInt_t height, TImagePalette* palette = 0) | |
virtual | ~TASImage() |
void | TObject::AbstractMethod(const char* method) const |
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 | TObject::AppendPad(Option_t* option = "") |
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)MENU |
virtual void | Browse(TBrowser*) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | Clone(const char* newname) const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) 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) |
static TImage* | TImage::Create() |
virtual void | Crop(Int_t x = 0, Int_t y = 0, UInt_t width = 0, UInt_t height = 0)MENU |
virtual void | CropPolygon(UInt_t npt, TPoint* ppt) |
virtual void | CropSpans(UInt_t npt, TPoint* ppt, UInt_t* widths) |
virtual void | TObject::Delete(Option_t* option = "")MENU |
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", Int_t thick = 1) |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
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", Int_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", Int_t thick = 1) |
virtual void | DrawFillArea(UInt_t npt, TPoint* ppt, TImage* tile) |
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 | 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", Int_t thick = 1) |
virtual void | DrawText(TText* text, Int_t x = 0, Int_t y = 0) |
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 | TObject::Dump() constMENU |
virtual void | TAttImage::EditorClosed() |
virtual void | EndPaint() |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual void | FillPolygon(UInt_t npt, TPoint* ppt, TImage* tile) |
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 | 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, TImage* tile) |
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 TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
virtual void | Flip(Int_t flip = 180)MENU |
virtual void | FloodFill(Int_t x, Int_t y, const char* col, const char* min_col, const char* max_col = 0) |
virtual void | FromGLBuffer(UChar_t* buf, UInt_t w, UInt_t h) |
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) |
Bool_t | TAttImage::GetConstRatio() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
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) |
UInt_t | TAttImage::GetImageCompression() const |
static TImage::EImageFileTypes | TImage::GetImageFileTypeFromFilename(const char* opt) |
TAttImage::EImageQuality | TAttImage::GetImageQuality() const |
virtual Pixmap_t | GetMask() |
virtual const char* | TNamed::GetName() const |
virtual char* | GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
virtual const TImagePalette& | TAttImage::GetPalette() const |
virtual TArrayL* | GetPixels(Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) |
virtual Pixmap_t | GetPixmap() |
virtual UInt_t* | GetRgbaArray() |
UInt_t | GetScaledHeight() const |
virtual TImage* | GetScaledImage() const |
UInt_t | GetScaledWidth() const |
virtual UInt_t* | GetScanline(UInt_t y) |
virtual const char* | GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Double_t* | GetVecArray() |
static const ASVisual* | GetVisual() |
virtual UInt_t | GetWidth() const |
void | GetZoomPosition(UInt_t& x, UInt_t& y, UInt_t& w, UInt_t& h) 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)TOGGLE GETTER |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
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, Int_t xsrc = 0, Int_t ysrc = 0, UInt_t wsrc = 0, UInt_t hsrc = 0, Option_t* opt = "") |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | IsEditable() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
virtual Bool_t | IsGray() const |
Bool_t | TObject::IsOnHeap() const |
Bool_t | TAttImage::IsPaletteEnabled() const |
virtual Bool_t | TNamed::IsSortable() const |
virtual Bool_t | IsValid() const |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) 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)MENU |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static TImage* | TImage::Open(char** data) |
static TImage* | TImage::Open(const char* file, TImage::EImageFileTypes type = kUnknown) |
static TImage* | TImage::Open(const char* name, const TArrayD& imageData, UInt_t width, TImagePalette* palette = 0) |
static TImage* | TImage::Open(const char* name, const TVectorD& imageData, UInt_t width, TImagePalette* palette = 0) |
static TImage* | TImage::Open(const char* name, const Double_t* imageData, UInt_t width, UInt_t height, TImagePalette* palette) |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
TImage& | TImage::operator+=(const TImage& i) |
TImage& | TImage::operator/=(const TImage& i) |
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)MENU |
virtual void | Paint(Option_t* option = "") |
virtual 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 = "") |
virtual void | PolyPoint(UInt_t npt, TPoint* ppt, const char* col = "#000000", TImage::ECoordMode mode = kCoordModeOrigin) |
virtual void | TObject::Pop() |
virtual void | TNamed::Print(Option_t* option = "") const |
virtual void | PutPixel(Int_t x, Int_t y, const char* col = "#000000") |
virtual Int_t | TObject::Read(const char* name) |
virtual void | ReadImage(const char* file, TImage::EImageFileTypes type = TImage::kUnknown) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
virtual void | TAttImage::ResetAttImage(Option_t* option = "") |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TAttImage::SaveImageAttributes(ostream& out, const char* name, TAttImage::EImageQuality qualdef = kImgDefault, UInt_t comprdef = 0, Bool_t constRatiodef = kTRUE) |
virtual void | SavePrimitive(ostream& out, Option_t* option = "") |
virtual void | Scale(UInt_t width, UInt_t height)MENU |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TAttImage::SetConstRatio(Bool_t constRatio = kTRUE)TOGGLE |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | SetEditable(Bool_t on = kTRUE)TOGGLE |
void | SetImage(ASImage* image) |
virtual void | SetImage(Pixmap_t pxm, Pixmap_t mask = 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(const Double_t* imageData, UInt_t width, UInt_t height, TImagePalette* palette = 0) |
virtual Bool_t | SetImageBuffer(char** buffer, TImage::EImageFileTypes type = TImage::kPng) |
virtual void | TAttImage::SetImageCompression(UInt_t lcompression)MENU |
virtual void | TAttImage::SetImageQuality(TAttImage::EImageQuality lquality) |
Bool_t | SetJpegDpi(const char* name, UInt_t dpi = 72) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | SetPalette(const TImagePalette* palette) |
virtual void | SetPaletteEnabled(Bool_t on = kTRUE)TOGGLE |
virtual void | SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector&) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Slice(UInt_t xStart, UInt_t xEnd, UInt_t yStart, UInt_t yEnd, UInt_t toWidth, UInt_t toHeight)MENU |
virtual void | StartPaletteEditor()MENU |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | Tile(UInt_t width, UInt_t height)MENU |
virtual void | UnZoom()MENU |
virtual void | TObject::UseCurrentStyle() |
virtual Double_t* | Vectorize(UInt_t max_colors = 256, UInt_t dither = 4, Int_t opaque_threshold = 1) |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
virtual void | WriteImage(const char* file, TImage::EImageFileTypes type = TImage::kUnknown)MENU |
virtual void | Zoom(UInt_t offX, UInt_t offY, UInt_t width, UInt_t height)MENU |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
TImage::EImageFileTypes | GetFileType(const char* ext) |
static Bool_t | InitVisual() |
void | TObject::MakeZombie() |
void | MapFileTypes(TImage::EImageFileTypes& type, UInt_t& astype, Bool_t toas = kTRUE) |
void | MapQuality(TAttImage::EImageQuality& quality, UInt_t& asquality, Bool_t toas = kTRUE) |
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 | 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) |
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() |
const char* | TypeFromMagicNumber(const char* file) |
enum { | kNoZoom | |
kZoom | ||
kZoomOps | ||
kReadWritePNG | ||
kReadWriteVector | ||
}; | ||
enum TImage::EImageFileTypes { | kXpm | |
kZCompressedXpm | ||
kGZCompressedXpm | ||
kPng | ||
kJpeg | ||
kXcf | ||
kPpm | ||
kPnm | ||
kBmp | ||
kIco | ||
kCur | ||
kGif | ||
kTiff | ||
kXbm | ||
kFits | ||
kTga | ||
kXml | ||
kUnknown | ||
kAnimGif | ||
}; | ||
enum TImage::EText3DType { | kPlain | |
kEmbossed | ||
kSunken | ||
kShadeAbove | ||
kShadeBelow | ||
kEmbossedThick | ||
kSunkenThick | ||
kOutlineAbove | ||
kOutlineBelow | ||
kOutlineFull | ||
k3DTypes | ||
}; | ||
enum TImage::ECharType { | kUTF8 | |
kChar | ||
kUnicode | ||
}; | ||
enum TImage::ETileType { | kStretch | |
kTile | ||
kStretchY | ||
kStretchX | ||
}; | ||
enum TImage::ECoordMode { | kCoordModeOrigin | |
kCoordModePrevious | ||
}; | ||
enum TImage::EColorChan { | kRedChan | |
kGreenChan | ||
kBlueChan | ||
kAlphaChan | ||
kAllChan | ||
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; | ||
enum TAttImage::EImageQuality { | kImgDefault | |
kImgPoor | ||
kImgFast | ||
kImgGood | ||
kImgBest | ||
}; |
Bool_t | TAttImage::fConstRatio | keep aspect ratio of image on the screen |
Bool_t | fEditable | ! kTRUE image can be resized, moved by resizing/moving gPad |
ASImage* | fGrayImage | ! gray image |
ASImage* | fImage | ! pointer to image structure of original image |
UInt_t | TAttImage::fImageCompression | compression [0 .. 100] 0: no compression |
TAttImage::EImageQuality | TAttImage::fImageQuality | *OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}* |
Bool_t | fIsGray | ! kTRUE if image is gray |
Double_t | fMaxValue | ! max value in image |
Double_t | fMinValue | ! min value in image |
TString | TNamed::fName | object identifier |
Int_t | fPaintMode | ! 1 - fast mode, 0 - low memory slow mode |
TImagePalette | TAttImage::fPalette | color palette for value -> color conversion |
TPaletteEditor* | TAttImage::fPaletteEditor | ! GUI to edit the color palette |
Bool_t | TAttImage::fPaletteEnabled | ! kTRUE - palette is drawn on the image |
TASImage* | fScaledImage | ! temporary scaled and zoomed image produced from original image |
TString | TNamed::fTitle | object title |
UInt_t | fZoomHeight | ! hight of zoomed image in image pixels |
UInt_t | fZoomOffX | ! X - offset for zooming in image pixels |
UInt_t | fZoomOffY | ! Y - offset for zooming im image pixels |
Int_t | fZoomUpdate | ! kZoom - new zooming required, kZoomOps - other ops in action, kNoZoom - no zooming or ops |
UInt_t | fZoomWidth | ! width of zoomed image in image pixels |
static Bool_t | fgInit | global flag to init afterimage only once |
static THashTable* | fgPlugList | ! hash table containing loaded plugins |
static ASVisual* | fgVisual | pointer to visual structure |
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 for GIF files (ICO, BMP, CUR, TIFF, XCF to be supported in future). For example, i1 = TImage::Open("anim.gif.0"); // read the first subimage i4 = TImage::Open("anim.gif.3"); // read the forth subimage 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.
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. It's possible to write image into an animated GIF file by specifying file name as "myfile.gif+" or "myfile.gif+NN", where NN is the delay of displaying subimages during animation in 10ms seconds units. NN is not restricted to two digits. If NN is ommitted the delay between subimages is zero. For an animation that stops after last subimage is reached, one has to write the last image as .gif+ (zero delay of last image) or .gif+NN (NN*10ms delay of last image). For repeated animation (looping), the last subimage must be specified as: (a) "myfile.gif++NN++" if you want an infinite looping gif with NN*10ms delay of the last image. (b) "myfile.gif++" for an infinite loop with zero delay of last image. (c) "myfile.gif+NN++RR" if you want a finite looping gif with NN*10ms delay of the last image and the animation to be stopped after RR repeats. RR is not restricted to two digits. A deprecated version for saving the last subimage of a looping gif animation is: (d) "myfile.gif++NN" for a finite loop where NN is number of repetitions and NN*10ms the delay of last image. (No separate control of repeats and delay). Note: If the file "myfile.gif" already exists, the new frames are appended at the end of the file. To avoid this, delete it first with gSystem->Unlink(myfile.gif); The following macro creates animated gif from jpeg images with names imageNN.jpg, where 1<= NN <= 10 The delays are set to 10*10ms. { TImage *img = 0; gSystem->Unlink("anim.gif"); // delete existing file for (int i = 1; i <= 10; i++) { delete img; // delete previous image // Read image data. Image can be in any format, e.g. png, gif, etc. img = TImage::Open(Form("image%d.jpg", i)); if (i < 10) { img->WriteImage("anim.gif+10"); // 10 centiseconds delay } else { // the last image written. "++" stands for infinit animation. img->WriteImage("anim.gif++10++"); // 10 centiseconds delay of last image } } }
Return file type depending on specified extension. Protected method.
Map file type to/from AfterImage types. Protected method.
Map quality to/from AfterImage quality. Protected method.
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.
Delete 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.
Delete 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.
Create an image from the given pad, afterwards this image can be saved in any of the supported image formats.
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.
Draw asimage on drawable.
Draw image on the drawable wid (pixmap, window) at x,y position. wid : Drawable (pixmap or window) on which image is drawn. x,y : Window coordinates where image is drawn. xsrc, ysrc : X and Y coordinates of an image area to be drawn. wsrc, hsrc : Widh and height image area to be drawn.
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.
Get image pixel coordinates and the pixel value at the mouse pointer.
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.
Scale 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!
Another method of enlarging images where corners remain unchanged, but middle part gets tiled.
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.
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.
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.
Return width of original image not of the displayed image. (Number of image pixels)
Return height of original image not of the displayed image. (Number of image pixels)
Return width of the displayed image not of the original image. (Number of screen pixels)
Return height of the displayed image not of the original image. (Number of screen pixels)
Return the zoom parameters. This is useful when the zoom has been done interactively using the mouse.
Return 2D array of machine dependent pixel values.
Return a pointer to internal array[width x height] of double values [0,1]. This array is directly accessible. That allows to manipulate/change the image.
In case of vectorized image return an associated array of doubles otherwise this method creates and returns a 2D array of doubles corresponding 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 The returned array must be deleted after usage.
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.
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 weird image overlaying(see GIMP) saturate - saturate bottom image same as top image screen - another weird image overlaying(see GIMP) sub - color substraction with saturation tint - tinting image with image value - value bottom image same as top image
Perform Gaussian blurr of the image (usefull for drop shadows). hr - horizontal radius of the blurr vr - vertical radius of the blurr
Reduce 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
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.
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.
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);
Enlarge image, padding it with specified color on each side in accordance with requested geometry.
Append image. option: "+" - appends to the right side "/" - appends to the bottom
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.
Return a pointer to internal array[width x height] of ARGB32 values This array is directly accessible. That allows to manipulate/change the image.
Return a pointer to an array[width x height] of RGBA32 values. This array is created from internal ARGB32 array, must be deleted after usage.
Fill rectangle of size (width, height) at position (x,y) within the existing image with specified color.
Draw a line.
Internal line drawing.
Draw a rectangle.
Draw a box.
Draw a dashed horizontal line.
Draw a dashed vertical line.
Draw a dashed line with one pixel width.
Draw a dashed line with thick pixel width.
Draw a dashed line.
Draw a polyline.
Draw a point at the specified position.
Draw a poly point.
Draw segments.
Fill spans with specified color or/and stipple.
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 };
Return alphablended value computed from bottom and top pixel values.
The code is based on Xserver/mi/mipolycon.c
"Copyright 1987, 1998 The Open Group"
Fill a convex polygon with background color or bitmap. For non convex polygon one must use DrawFillArea method
Fill a convex polygon with background image. For non convex polygon one must use DrawFillArea method
Fill a polygon (any type convex, non-convex).
Fill a polygon (any type convex, non-convex).
Draw wide line.
Draw text using TrueType fonts.
Return in-memory buffer compressed according image type. Buffer must be deallocated after usage. This method can be used for sending images over network.
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);
Draw a cubic bezier line.
Draw a straight ellipse. If thick < 0 - draw filled ellipse.
Draw a circle. If thick < 0 - draw filled circle
Draw an ellipse. If thick < 0 - draw filled ellips
Draw an ellipse. If thick < 0 - draw filled ellipse.
Flood fill.
Create an image (screenshot) from specified window.
Creates an image (screenshot) from a RGBA buffer.
Switch on/off the image palette. That also invokes calling vectorization of image.
Save a primitive as a C++ statement(s) on output stream "out".
Set an image printing resolution in Dots Per Inch units. name - the name of jpeg file. set - dpi resolution. Returns kFALSE in case of error.