Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TAttImage.h

Go to the documentation of this file.
00001 // @(#)root/graf:$Name:  $:$Id: TAttImage.h,v 1.2 2002/08/09 16:43:30 rdm Exp $
00002 // Author: Reiner Rohlfs   24/03/02
00003 
00004 /*************************************************************************
00005  * Copyright (C) 2001-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TAttImage
00013 #define ROOT_TAttImage
00014 
00015 
00017 //                                                                      //
00018 //  TAttImage                                                           //
00019 //                                                                      //
00020 //  Image attributes are:                                               //
00021 //    Image Quality (see EImageQuality for the list of qualities)       //
00022 //    Compression defines the compression rate of the color data in the //
00023 //                internal image structure. Speed and memory depends    //
00024 //                on this rate, but not the image display itself        //
00025 //                0: no compression;  100: max compression              //
00026 //    Radio Flag: kTRUE  the x/y radio of the displayed image is always //
00027 //                       identical to the original image                //
00028 //                kFALSE the x and y size of the displayed image depends//
00029 //                       on the size of the pad                         //
00030 //    Palette:    Defines the conversion from a pixel value to the      //
00031 //                screen color                                          //
00032 //                                                                      //
00033 //  This class is used (in general by secondary inheritance)            //
00034 //  by some other classes (image display).                              //
00035 //                                                                      //
00036 //                                                                      //
00037 //  TImagePalette                                                       //
00038 //                                                                      //
00039 //  A class to define a conversion from pixel values to pixel color.    //
00040 //  A Palette is defined by some anchor points. Each anchor point has   //
00041 //  a value between 0 and 1 and a color. An image has to be normalized  //
00042 //  and the values between the anchor points are interpolated.          //
00043 //  All member variables are public and can be directly manipulated.    //
00044 //  In most cases the default operator will be used to create a         //
00045 //  TImagePalette. In this case the member arrays have to be allocated  //
00046 //  by an application and will be deleted in the destructor of this     //
00047 //  class.                                                              //
00048 //                                                                      //
00049 //                                                                      //
00050 //  TPaletteEditor                                                      //
00051 //                                                                      //
00052 //  This class provides a way to edit the palette via a GUI.            //
00053 //                                                                      //
00055 
00056 #ifndef ROOT_TObject
00057 #include "TObject.h"
00058 #endif
00059 
00060 #ifndef ROOT_Riosfwd
00061 #include "Riosfwd.h"
00062 #endif
00063 
00064 class TAttImage;
00065 
00066 
00067 class TPaletteEditor {
00068 
00069 protected:
00070    TAttImage    *fAttImage;    // image attributes to be edited
00071 
00072 public:
00073    TPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
00074 
00075    virtual void CloseWindow();
00076 
00077    ClassDef(TPaletteEditor, 0)  // Base class for palette editor
00078 };
00079 
00080 
00081 
00082 class TImagePalette : public TObject {
00083 
00084 public:
00085    UInt_t      fNumPoints;   // number of anchor points
00086    Double_t   *fPoints;      // [fNumPoints] value of each anchor point [0..1]
00087    UShort_t   *fColorRed;    // [fNumPoints] red color at each anchor point
00088    UShort_t   *fColorGreen;  // [fNumPoints] green color at each anchor point
00089    UShort_t   *fColorBlue;   // [fNumPoints] blue color at each anchor point
00090    UShort_t   *fColorAlpha;  // [fNumPoints] alpah at each anchor point
00091 
00092    TImagePalette();
00093    TImagePalette(const TImagePalette &palette);
00094    TImagePalette(UInt_t numPoints);
00095    virtual ~TImagePalette();
00096 
00097    TImagePalette &operator=(const TImagePalette &palette);
00098 
00099    ClassDef(TImagePalette,1)  // Color Palette for value -> color conversion
00100 };
00101 
00102 
00103 
00104 class TAttImage {
00105 
00106 public:
00107    // Defines level of output quality/speed ratio
00108    enum EImageQuality {
00109       kImgDefault = -1,
00110       kImgPoor    = 0,
00111       kImgFast    = 1,
00112       kImgGood    = 2,
00113       kImgBest    = 3
00114    };
00115 
00116 protected:
00117    EImageQuality    fImageQuality;       //quality of image
00118    UInt_t           fImageCompression;   //compression [0 .. 100] 0: no compression
00119    Bool_t           fConstRatio;         //keep aspect ratio of image on the screen
00120    TImagePalette    fPalette;            //color palette for value -> color conversion
00121    TPaletteEditor  *fPaletteEditor;      
00122 
00123 public:
00124    TAttImage();
00125    TAttImage(EImageQuality lquality, UInt_t lcompression, Bool_t constRatio);
00126    virtual ~TAttImage();
00127 
00128    void             Copy(TAttImage &attline) const;
00129    Bool_t           GetConstRatio() const { return fConstRatio; }
00130    UInt_t           GetImageCompression() const { return fImageCompression; }
00131    EImageQuality    GetImageQuality() const { return fImageQuality; }
00132    virtual const TImagePalette &GetPalette() const { return fPalette; }
00133 
00134    virtual void     ResetAttImage(Option_t *option="");
00135    virtual void     SaveImageAttributes(ofstream &out, const char *name,
00136                                         EImageQuality qualdef = kImgDefault,
00137                                         UInt_t comprdef = 0,
00138                                         Bool_t constRatiodef = kTRUE);
00139    virtual void     SetConstRatio(Bool_t constRatio = kTRUE); // *TOGGLE*
00140    virtual void     SetImageCompression(UInt_t lcompression)
00141                        { fImageCompression = (lcompression > 100) ? 100 : lcompression; } // *MENU*
00142    virtual void     SetImageQuality(EImageQuality lquality)
00143                        { fImageQuality = lquality;} // *MENU*
00144    virtual void     SetPalette(const TImagePalette *palette);
00145    virtual void     StartPaletteEditor(); // *MENU*
00146    virtual void     EditorClosed() { fPaletteEditor = 0; }
00147 
00148    ClassDef(TAttImage,1)  //Image attributes
00149 };
00150 
00151 #endif

Generated on Thu Dec 18 14:52:16 2003 for ROOT by doxygen1.2.16