00001
00033 #ifndef INC_RVC_STYLEPATTERNBITMAP_H
00034 #define INC_RVC_STYLEPATTERNBITMAP_H
00035
00036 #ifndef INC_RVC_STYLEPATTERNBASE_H
00037 #include <rvc/stylepatternbase.h>
00038 #endif
00039
00040 namespace SPATMOD {
00041 namespace IMAGE {
00042 class STAGE;
00043 }
00044 }
00045
00046 namespace RVC {
00047
00049 class STYLEPATTERN_BITMAP : public STYLEPATTERN_BASE {
00050 public:
00051
00053 STYLEPATTERN_BITMAP (
00054 ) : STYLEPATTERN_BASE(PATTERNTYPE_Bitmap, sizeof(PATTERNHEADER_BITMAP)) {}
00055
00057 STYLEPATTERN_BITMAP (
00058 const void* buf,
00059 INT32 NumBytes
00060 ) : STYLEPATTERN_BASE(PATTERNTYPE_Bitmap, sizeof(PATTERNHEADER_BITMAP)) {
00061 SetPattern(buf, NumBytes, sizeof(PATTERNHEADER_BITMAP));
00062 }
00063
00065 STYLEPATTERN_BITMAP (
00066 const STYLEPATTERN_BITMAP& rhs
00067 ) : STYLEPATTERN_BASE(rhs) {}
00068
00070 virtual ~STYLEPATTERN_BITMAP (
00071 ) { }
00072
00074 STYLEPATTERN_BITMAP& operator= (
00075 const STYLEPATTERN_BITMAP& rhs
00076 ) { if (this != &rhs) { STYLEPATTERN_BASE::operator=(rhs); } return (*this); }
00077
00081 ERRVALUE Create (
00082 INT16 xsize,
00083 INT16 ysize,
00084 bool bRGBA = false
00085 );
00086
00087
00090 UINT8 GetCell (
00091 INT16 x,
00092 INT16 y
00093 ) const { return (GetFirstElemPtr()[y*GetSizeX()+x]); }
00094
00097 void GetCell (
00098 INT16 x,
00099 INT16 y,
00100 COLOR& color
00101 ) const { color.SetByColorSpace(COLORSPACE_R8_G8_B8_A8, GetFirstElemPtr() + (y*GetSizeX()+x)*4); }
00102
00106 const UINT8* GetRowData (
00107 INT16 y
00108 ) const { return (GetFirstElemPtr() + y*GetSizeX()*(IsRGBA()?4:1)); }
00109
00113 UINT8* GetRowData (
00114 INT16 y
00115 ) { return (GetFirstElemPtr() + y*GetSizeX()*(IsRGBA()?4:1)); }
00116
00117
00118 INT16 GetHotSpotX (
00119 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->xhot); }
00120
00121 INT16 GetHotSpotY (
00122 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->yhot); }
00123
00124 INT16 GetIntervalX (
00125 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->xspace); }
00126
00127 INT16 GetIntervalY (
00128 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->yspace); }
00129
00130 INT16 GetSizeX (
00131 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->xsize); }
00132
00133 INT16 GetSizeY (
00134 ) const { return (reinterpret_cast<const PATTERNHEADER_BITMAP*>(m_PattBuff)->ysize); }
00135
00141 ERRVALUE Import (
00142 SPATMOD::IMAGE::STAGE& Source
00143 );
00144
00147 bool IsRGBA (
00148 ) const { return (GetNumColors() == -1); }
00149
00152 void SetCell (
00153 INT16 x,
00154 INT16 y,
00155 UINT8 value
00156 ) { GetFirstElemPtr()[y*GetSizeX()+x] = value; }
00157
00160 void SetCell (
00161 INT16 x,
00162 INT16 y,
00163 const COLOR& value
00164 ) { value.GetByColorSpace(COLORSPACE_R8_G8_B8_A8, GetFirstElemPtr() + (y*GetSizeX()+x)*4); }
00165
00166 void SetHotSpotX (
00167 INT16 hotspotx
00168 ) { reinterpret_cast<PATTERNHEADER_BITMAP*>(m_PattBuff)->xhot = hotspotx; }
00169
00170 void SetHotSpotY (
00171 INT16 hotspoty
00172 ) { reinterpret_cast<PATTERNHEADER_BITMAP*>(m_PattBuff)->yhot = hotspoty; }
00173
00174 void SetIntervalX (
00175 INT16 intervalx
00176 ) { reinterpret_cast<PATTERNHEADER_BITMAP*>(m_PattBuff)->xspace = intervalx; }
00177
00178 void SetIntervalY (
00179 INT16 intervaly
00180 ) { reinterpret_cast<PATTERNHEADER_BITMAP*>(m_PattBuff)->yspace = intervaly; }
00181
00182 private:
00183 #ifndef GENERATING_DOXYGEN_OUTPUT
00185 struct PATTERNHEADER_BITMAP : public STYLEPATTERN_BASE::PATTERNHEADER {
00186 INT16 xsize;
00187 INT16 ysize;
00188 INT16 xhot;
00189 INT16 yhot;
00190 INT16 xspace;
00191 INT16 yspace;
00192 };
00193
00194 virtual bool v_IsEmpty () const;
00195 #endif // GENERATING_DOXYGEN_OUTPUT
00196 };
00197
00198 }
00199
00200 #endif
00201