VedaLibImage/VirtualImage.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_VirtualImage_H
00006 #define COM_M4NKIND_VirtualImage_H
00007 
00008 #include "BaseObject.h"
00009 /*!
00010     \class  VirtualImage
00011     \ingroup BaseObjectInherited_VedaLibImage BaseObjectInheritedDocGroup
00012     \brief  virtual Class defining a generic Image usable by effects.
00013             To this level, VirtualImage manages a generic memory allocation for the bitmap.
00014 
00015 */
00016 class VirtualImage : public BaseObject
00017 {
00018 /*==================================================================
00019                                 PUBLIC
00020 ==================================================================*/
00021 public:
00022     /*!
00023         \brief  Constructor. There should only be members initialisation there.
00024     */
00025     VirtualImage(void);
00026 
00027     /*!
00028         \brief  Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp
00029     */
00030     BASEOBJECT_DEFINE_VIRTUALCLASS(VirtualImage);
00031 
00032     /*!
00033         \brief  Return the pixel width of the image
00034     */
00035     virtual unsigned int    GetPixelWidth()=0;
00036     /*!
00037         \brief  Return the pixel height of the image
00038     */
00039     virtual unsigned int    GetPixelHeight()=0;
00040     /*!
00041         \brief  Return the number of byte component for one pixel.  
00042     */
00043     virtual unsigned int    GetByteDepth()=0;
00044     /*!
00045         \brief  Return the bitmap buffer. never stock it elsewhere, redo a Get() and a GetBuffer().
00046                 The format of the bitmap vary according to the class.
00047     */
00048     inline const unsigned char  *GetBuffer(){ return(m_pBuffer); };
00049 
00050     /*!
00051         \brief  If this image can change with time, it will return true,
00052                 and UpdateToFrame() can have an effect. false by default.
00053         \return true if image can change with time.
00054     */
00055     inline  bool    IsTimeDynamic() const { return m_IsTimeDynamic; };
00056 
00057     /*!
00058         \brief  If IsTimeDynamic() is true, this image can change with time.
00059                 You have to use UpdateToFrame()to make the image change to a given date.
00060                 by default, UpdateToFrame() does nothing.
00061         \param  _framedate time in seconds.
00062     */
00063     virtual void    UpdateToFrame(float _framedate);
00064 
00065 #ifdef _ENGINE_EDITABLE_
00066     /*!
00067         \brief  a GUI could need to play, draw, print, or output from any way, a preview of a 
00068                 created object. This is done with this method. sub classes can implement it (or not) in
00069                 any way, to explicit current shape of an object.<br>
00070 
00071         \param  _frameDate a date, in second, which defines the effect cinematic.
00072         \param  _pPreviewViewPort the viewport to render. Can't be 0L.
00073         \param  _pPreviewConfiguration
00074     */
00075     virtual void ProcessPreview(double _frameDate,VirtualMachine::InternalViewPort *_pPreviewViewPort,const PreviewConfiguration *_pPreviewConfiguration);
00076 #endif
00077 /*==================================================================
00078                                 PROTECTED
00079 ==================================================================*/
00080 protected:
00081 
00082     //! the memory chunk that is the image:
00083     unsigned char   *m_pBuffer;
00084     //! true is image can change with UpdateToFrame() , false by default.
00085     bool        m_IsTimeDynamic;
00086     //! if TimeDynamic, m_LastFrameDate should note the current date shape.
00087     float   m_CurrentFrameDate;
00088 #ifdef _ENGINE_EDITABLE_
00089     //! for preview, we also alloc a RGBA buffer to watch the result:
00090     unsigned char   *m_pPeviewRGBABuffer;
00091 #endif
00092     /*!
00093         \brief  Method that really build the object using the serializable parameters.
00094                 For the virtual VirtualImage class, it allocs the bitmap memory.
00095                 Close() should close everything opened by CreateInternal().
00096     */
00097     virtual bool CreateInternal(void);
00098 
00099 #ifdef _ENGINE_EDITABLE_
00100     /*!
00101         \brief  that closes everything. Still, the object exist and can be rebuild the same using Create()
00102     */
00103     virtual void    CloseInternal(void);
00104 #endif
00105 };
00106 
00107 #endif

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