VedaLibImage/RGBAImage.h

Go to the documentation of this file.
00001 /*! \file 
00002     \author victorien ferry & www.m4nkind.com
00003     \brief This file applies the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 , read file COPYING.
00004 */
00005 #ifndef COM_M4NKIND_RGBAImage_H
00006 #define COM_M4NKIND_RGBAImage_H
00007 
00008 #include "VirtualImage.h"
00009 #include "PackObjectReference.h"
00010 #include "PackULong_Flags.h"
00011 #include "PackLong_WithLimits.h"
00012 #include "PackULong_Enums.h"
00013 #include "PackList.h"
00014 /*!
00015     \class  RGBAImage
00016     \ingroup BaseObjectInherited_VedaLibImage BaseObjectInheritedDocGroup
00017     \brief  Image that mix images of any size or color depth into a new RGBA one. 
00018             it uses a layer list by source image. Each layers can affect a color channel,
00019             it can use a HSV->RGB mixer and manages alpha channel. 
00020 */
00021 
00022 class RGBAImage : public VirtualImage
00023 {
00024 /*==================================================================
00025                                 PUBLIC
00026 ==================================================================*/
00027 public:
00028     /*!
00029         \brief  Constructor. There should only be members initialisation there.
00030     */
00031     RGBAImage(void);
00032     
00033     /*!
00034         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00035     */
00036     BASEOBJECT_DEFINE_CLASS(RGBAImage);
00037 
00038     /*!
00039         \brief  Return the number of byte component for one pixel.
00040             This one is no more a virtual method.
00041     */
00042     virtual unsigned int    GetByteDepth(){ return(4); };
00043     /*!
00044         \brief  Return the pixel width of the image
00045     */
00046     virtual unsigned int    GetPixelWidth();
00047     /*!
00048         \brief  Return the pixel height of the image
00049     */
00050     virtual unsigned int    GetPixelHeight();
00051     /*!
00052         \brief  Tool: make a conversion from HSV to RGB. 
00053         \param  t tint (hue) 0->255
00054         \param  s saturation 0->255 (grey->colorfull)
00055         \param  l luminance (Value) 0->255
00056         \param  R return written on 3 consecutive char.
00057     */
00058     static inline void TslToRgb(  unsigned int t,unsigned int  s,unsigned int  l, unsigned char *R );
00059     /*!
00060         \brief   Nested class that describes a reference to an object3D, used as element in the list.
00061     */
00062     class ImageLayer : public PackStruct
00063     {
00064     public:
00065 //!  true in mSer_Flags if the image use HSV->RGB mixer.
00066 #define LayerFlag_Red       1 
00067 #define LayerFlag_Green     2
00068 #define LayerFlag_Blue      4 
00069 #define LayerFlag_Alpha     8 
00070 #define LayerFlag_HSV       16 
00071 #define LayerFlag_AddMul    32      // true if mul, false if add. 
00072 #define LayerFlag_MulAlpha  64  
00073         //! the type of layer:
00074         PackULong_Flags     mSer_LayerFlag;
00075         //! the reference to an image:
00076         PackObjectReference mSerRef_ComponentImage;
00077         //! reference to a color-binding curve:
00078         PackObjectReference mSerRef_Curve;
00079         //! \brief constructor . 
00080         ImageLayer(void);  
00081     };
00082     /*!
00083         \brief  static method passed to the list to create new elements.
00084         \return a new object.
00085     */
00086     static BaseType *NewImageLayer(){ return new ImageLayer(); };
00087 
00088 /*==================================================================
00089                                 PROTECTED
00090 ==================================================================*/
00091 protected:
00092 
00093     //! the pixel size:
00094     PackLong_WithLimits     mSer_PixelWidth;
00095     //! the pixel size:
00096     PackLong_WithLimits     mSer_PixelHeight;
00097     //! list of the layers used to build the image:
00098     PackList        mSer_LayerList;
00099 
00100 /*!
00101     \brief  Method that really build the object using the serializable parameters.
00102             Close() should close everything opened by Create().
00103             Mix one or more GreyImage into a RGBA bitmap.
00104         \return false if creation failed.
00105 */
00106     virtual bool CreateInternal(void);
00107 
00108 };
00109 
00110 #endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/