ROOT » GRAF2D » GRAF » TAttImage

class TAttImage


TAttImage

Image attributes are:
Image Quality (see EImageQuality for the list of qualities)
Compression defines the compression rate of the color data in the
internal image structure. Speed and memory depends
on this rate, but not the image display itself
0: no compression;  100: max compression
Radio Flag: kTRUE  the x/y radio of the displayed image is always
identical to the original image
                kFALSE the x and y size of the displayed image depends
on the size of the pad
Palette:    Defines the conversion from a pixel value to the
screen color

This class is used (in general by secondary inheritance)
by some other classes (image display).


TImagePalette

A class to define a conversion from pixel values to pixel color.
A Palette is defined by some anchor points. Each anchor point has
a value between 0 and 1 and a color. An image has to be normalized
and the values between the anchor points are interpolated.
All member variables are public and can be directly manipulated.
In most cases the default operator will be used to create a
TImagePalette. In this case the member arrays have to be allocated
by an application and will be deleted in the destructor of this
class.

We provide few predifined palettes:

o gHistImagePalette - palette used in TH2::Draw("col")

o gWebImagePalette
The web palette is a set of 216 colors that will not dither or
shift on PCs or Macs. Browsers use this built-in palette when
they need to render colors on monitors with only 256 colors
(also called 8-bit color monitors).
The 6x6x6 web palette provides very quick color index lookup
and can be used for good quality convertion of images into
2-D histograms.

o  TImagePalette(Int_t ncolors, Int_t *colors)
if ncolors <= 0 a default palette (see below) of 50 colors
is defined.

if ncolors == 1 && colors == 0, then
a Pretty Palette with a Spectrum Violet->Red is created.

if ncolors > 50 and colors=0, the DeepSea palette is used.
(see TStyle::CreateGradientColorTable for more details)

if ncolors > 0 and colors = 0, the default palette is used
with a maximum of ncolors.

The default palette defines:
index 0->9   : grey colors from light to dark grey
index 10->19 : "brown" colors
index 20->29 : "blueish" colors
index 30->39 : "redish" colors
index 40->49 : basic colors


TPaletteEditor

This class provides a way to edit the palette via a GUI.


Function Members (Methods)

public:
virtual~TAttImage()
static TClass*Class()
voidCopy(TAttImage& attline) const
virtual voidEditorClosed()
Bool_tGetConstRatio() const
UInt_tGetImageCompression() const
TAttImage::EImageQualityGetImageQuality() const
virtual const TImagePalette&GetPalette() const
virtual TClass*IsA() const
Bool_tIsPaletteEnabled() const
TAttImage&operator=(const TAttImage&)
virtual voidResetAttImage(Option_t* option = "")
virtual voidSaveImageAttributes(ostream& out, const char* name, TAttImage::EImageQuality qualdef = kImgDefault, UInt_t comprdef = 0, Bool_t constRatiodef = kTRUE)
virtual voidSetConstRatio(Bool_t constRatio = kTRUE)TOGGLE
virtual voidSetImageCompression(UInt_t lcompression)MENU
virtual voidSetImageQuality(TAttImage::EImageQuality lquality)
virtual voidSetPalette(const TImagePalette* palette)
virtual voidSetPaletteEnabled(Bool_t on = kTRUE)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStartPaletteEditor()MENU
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TAttImage()
TAttImage(const TAttImage&)
TAttImage(TAttImage::EImageQuality lquality, UInt_t lcompression, Bool_t constRatio)

Data Members

public:
static TAttImage::EImageQualitykImgBest
static TAttImage::EImageQualitykImgDefault
static TAttImage::EImageQualitykImgFast
static TAttImage::EImageQualitykImgGood
static TAttImage::EImageQualitykImgPoor
protected:
Bool_tfConstRatiokeep aspect ratio of image on the screen
UInt_tfImageCompressioncompression [0 .. 100] 0: no compression
TAttImage::EImageQualityfImageQuality*OPTION={GetMethod="GetImageQuality";SetMethod="SetImageQuality";Items=(kImgDefault="Default",kImgPoor="Poor",kImgFast="Fast",kImgGood="Good",kImgBest="Best")}*
TImagePalettefPalettecolor palette for value -> color conversion
TPaletteEditor*fPaletteEditor! GUI to edit the color palette
Bool_tfPaletteEnabled! kTRUE - palette is drawn on the image

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TAttImage()
 TAttImage default constructor.
 Calls ResetAttImage to set the attributes to a default state.
TAttImage(TAttImage::EImageQuality lquality, UInt_t lcompression, Bool_t constRatio)
 TAttImage normal constructor.
 Image attributes are taken from the argument list
    qualtity     : must be one of EImageQuality (kImgDefault is same as
                   kImgGood in the current implementation)
    lcompression : defines the compression rate of the color data in the
                   image. Speed and memory depends on this rate, but not
                   the image display itself
                   0: no compression;  100: max compression
    constRatio   : keeps the aspect ratio of the image constant on the
                   screen (in pixel units)
~TAttImage()
 TAttImage destructor.
void Copy(TAttImage& attline) const
 Copy this image attributes to a new attimage.
void ResetAttImage(Option_t* option = "")
 Reset this image attributes to default values.
 Default values are:
    quality:     kImgPoor, (no smoothing while the image is zoomed)
    compression: 0 (no compression)
    constRatio:  kTRUE
    palette:     a default rainbow palette
void SaveImageAttributes(ostream& out, const char* name, TAttImage::EImageQuality qualdef = kImgDefault, UInt_t comprdef = 0, Bool_t constRatiodef = kTRUE)
 Save image attributes as C++ statement(s) on output stream, but
 not the palette.
void SetConstRatio(Bool_t constRatio = kTRUE)
 Set (constRatio = kTRUE) or unset (constRadio = kFALSE) the ratio flag.
 The aspect ratio of the image on the screen is constant if the ratio
 flag is set. That means one image pixel is allways a square on the screen
 independent of the pad size and of the size of the zoomed area.
void SetPalette(const TImagePalette* palette)
 Set a new palette for the image. If palette == 0 a default
 rainbow color palette is used.
void StartPaletteEditor()
 Opens a GUI to edit the color palette.
TImagePalette & operator=(const TAttImage& )
TAttImage()
Bool_t GetConstRatio() const
{ return fConstRatio; }
UInt_t GetImageCompression() const
{ return fImageCompression; }
EImageQuality GetImageQuality() const
{ return fImageQuality; }
const TImagePalette & GetPalette() const
{ return fPalette; }
void SetPaletteEnabled(Bool_t on = kTRUE)
{ fPaletteEnabled = on; }
void SetImageCompression(UInt_t lcompression)
{ fImageCompression = (lcompression > 100) ? 100 : lcompression; }
void SetImageQuality(TAttImage::EImageQuality lquality)
{ fImageQuality = lquality;}
void EditorClosed()
Bool_t IsPaletteEnabled() const
{ return fPaletteEnabled; }