HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Raster.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Raster.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  * UT_Raster is the utility class for containing a 2D raster.
10  * This is intended as a base class for IMG_Raster (see the IMG library)
11  * It's almost useless without it...
12  */
13 
14 #ifndef __UT_Raster__
15 #define __UT_Raster__
16 
17 #include "UT_API.h"
18 #include <SYS/SYS_Types.h>
19 #include "UT_Pixel.h"
20 
22 {
23 public:
24  enum UT_RasterDepth { UT_RASTER_8, UT_RASTER_16 };
25  enum UT_ColorModel { UT_MODEL_RGBA, UT_MODEL_ABGR };
26 
27  UT_Raster();
28  virtual ~UT_Raster();
29 
30  short Xres() const { return xres; }
31  short Yres() const { return yres; }
32 
33  void clear(const UT_RGBA &pixel);
34  void clear(const UT_BIG_RGBA &pixel);
35  void clear(const UT_Color &color, fpreal alpha = 1.0f);
36  void clear(int x1, int y1, int x2, int y2,
37  const UT_RGBA &color);
38 
39  void clear(int x1, int y1, int x2, int y2,
40  const UT_BIG_RGBA &color);
41 
42  UT_RasterDepth getRasterDepth( void ) const { return( pixelDepth ); }
43  void setRasterDepth( UT_RasterDepth depth );
44 
45  UT_ColorModel getColorModel(void) const { return myModel; }
46  void setColorModel( UT_ColorModel model );
47  void byteSwapRaster(); // Swap bytes in the raster
48 
49  UT_RGBA *getRaster() const;
50  UT_BIG_RGBA *getDeepRaster() const;
51  void *getVoidRaster() const;
52  int getBytesPerPixel( void );
53 
54  void setNewRaster(UT_RGBA *r);
55  void setNewRaster(UT_BIG_RGBA *r);
56 
57  // Phantom scanlines (bottom, top)
58  // No functional value (currently) but can be used to remember when the
59  // raster is really part of a larger raster
60 
61  void setPhantom( short b, short t) { pBot = b; pTop = t; }
62  short getPbot( void ) { return( pBot); }
63  short getPtop( void ) { return( pTop ); }
64 
66  static UT_RGBA onePixel;
67 
68 protected:
73  UT_ColorModel myModel; // My color model
74 
75  void setBaseSize(short width, short height,
76  void *newRaster=0);
77 
78  void *allocateMemory(int size);
79  void *reAllocateMemory(void *mem, int size);
80  void freeMemory(void *mem);
81 
82  short xres;
83  short yres;
84  short pBot;
85  short pTop;
86 
87  void init();
88 };
89 
90 #endif
UT_RasterDepth
Definition: UT_Raster.h:24
short xres
Definition: UT_Raster.h:82
short Yres() const
Definition: UT_Raster.h:31
UT_ColorModel getColorModel(void) const
Definition: UT_Raster.h:45
short pBot
Definition: UT_Raster.h:84
GLuint color
Definition: glcorearb.h:1260
#define UT_API
Definition: UT_API.h:12
GLsizeiptr size
Definition: glcorearb.h:663
GLint GLsizei width
Definition: glcorearb.h:102
short yres
Definition: UT_Raster.h:83
static UT_RGBA zeroPixel
Definition: UT_Raster.h:65
GLfloat f
Definition: glcorearb.h:1925
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:475
UT_RGBA * raster
Definition: UT_Raster.h:70
short getPtop(void)
Definition: UT_Raster.h:63
UT_RasterDepth pixelDepth
Definition: UT_Raster.h:72
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:111
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
UT_ColorModel myModel
Definition: UT_Raster.h:73
void setPhantom(short b, short t)
Definition: UT_Raster.h:61
short getPbot(void)
Definition: UT_Raster.h:62
GLint GLsizei GLsizei height
Definition: glcorearb.h:102
double fpreal
Definition: SYS_Types.h:263
static UT_RGBA onePixel
Definition: UT_Raster.h:66
short Xres() const
Definition: UT_Raster.h:30
GLboolean r
Definition: glcorearb.h:1221
UT_BIG_RGBA * raster16
Definition: UT_Raster.h:69
UT_RasterDepth getRasterDepth(void) const
Definition: UT_Raster.h:42
short pTop
Definition: UT_Raster.h:85
UT_RGBA ** scanlines
Definition: UT_Raster.h:71