00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __UT_Raster__
00023 #define __UT_Raster__
00024
00025 #include "UT_API.h"
00026 #include <SYS/SYS_Types.h>
00027 #include "UT_Pixel.h"
00028
00029 class UT_API UT_Raster
00030 {
00031 public:
00032 enum UT_RasterDepth { UT_RASTER_8, UT_RASTER_16 };
00033 enum UT_ColorModel { UT_MODEL_RGBA, UT_MODEL_ABGR };
00034
00035 UT_Raster();
00036 virtual ~UT_Raster();
00037
00038 short Xres() const { return xres; }
00039 short Yres() const { return yres; }
00040
00041 void clear(const UT_RGBA &pixel);
00042 void clear(const UT_BIG_RGBA &pixel);
00043 void clear(const UT_Color &color, fpreal alpha = 1.0f);
00044 void clear(int x1, int y1, int x2, int y2,
00045 const UT_RGBA &color);
00046
00047 void clear(int x1, int y1, int x2, int y2,
00048 const UT_BIG_RGBA &color);
00049
00050 UT_RasterDepth getRasterDepth( void ) const { return( pixelDepth ); }
00051 void setRasterDepth( UT_RasterDepth depth );
00052
00053 UT_ColorModel getColorModel(void) const { return myModel; }
00054 void setColorModel( UT_ColorModel model );
00055 void byteSwapRaster();
00056
00057 UT_RGBA *getRaster() const;
00058 UT_BIG_RGBA *getDeepRaster() const;
00059 void *getVoidRaster() const;
00060 int getBytesPerPixel( void );
00061
00062 void setNewRaster(UT_RGBA *r);
00063 void setNewRaster(UT_BIG_RGBA *r);
00064
00065
00066
00067
00068
00069 void setPhantom( short b, short t) { pBot = b; pTop = t; }
00070 short getPbot( void ) { return( pBot); }
00071 short getPtop( void ) { return( pTop ); }
00072
00073 static UT_RGBA zeroPixel;
00074 static UT_RGBA onePixel;
00075
00076 protected:
00077 UT_BIG_RGBA *raster16;
00078 UT_RGBA *raster;
00079 UT_RGBA **scanlines;
00080 UT_RasterDepth pixelDepth;
00081 UT_ColorModel myModel;
00082
00083 void setBaseSize(short width, short height,
00084 void *newRaster=0);
00085
00086 void *allocateMemory(int size);
00087 void *reAllocateMemory(void *mem, int size);
00088 void freeMemory(void *mem);
00089
00090 short xres;
00091 short yres;
00092 short pBot;
00093 short pTop;
00094
00095 void init();
00096 };
00097
00098 #endif