HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 "UT_NonCopyable.h"
19 #include "UT_Pixel.h"
20 #include <SYS/SYS_Types.h>
21 
23 {
24 public:
25  enum UT_RasterDepth { UT_RASTER_8, UT_RASTER_16 };
26  enum UT_ColorModel { UT_MODEL_RGBA, UT_MODEL_ABGR };
27 
28  UT_Raster();
29  virtual ~UT_Raster();
30 
32 
33  short Xres() const { return xres; }
34  short Yres() const { return yres; }
35 
36  void clear(const UT_RGBA &pixel);
37  void clear(const UT_BIG_RGBA &pixel);
38  void clear(const UT_Color &color, fpreal alpha = 1.0f);
39  void clear(int x1, int y1, int x2, int y2,
40  const UT_RGBA &color);
41 
42  void clear(int x1, int y1, int x2, int y2,
43  const UT_BIG_RGBA &color);
44 
45  UT_RasterDepth getRasterDepth() const { return( pixelDepth ); }
46  void setRasterDepth( UT_RasterDepth depth );
47 
48  UT_ColorModel getColorModel() const { return myModel; }
49  void setColorModel( UT_ColorModel model );
50  void byteSwapRaster(); // Swap bytes in the raster
51 
52  UT_RGBA *getRaster() const;
53  UT_BIG_RGBA *getDeepRaster() const;
54  void *getVoidRaster() const;
55  int getBytesPerPixel();
56 
57  void setNewRaster(UT_RGBA *r);
58  void setNewRaster(UT_BIG_RGBA *r);
59 
60  // Phantom scanlines (bottom, top)
61  // No functional value (currently) but can be used to remember when the
62  // raster is really part of a larger raster
63 
64  void setPhantom( short b, short t) { pBot = b; pTop = t; }
65  short getPbot() { return( pBot); }
66  short getPtop() { return( pTop ); }
67 
69  static UT_RGBA onePixel;
70 
71 protected:
76  UT_ColorModel myModel; // My color model
77 
78  void setBaseSize(short width, short height,
79  void *newRaster=0);
80 
81  void *allocateMemory(int size);
82  void *reAllocateMemory(void *mem, int size);
83  void freeMemory(void *mem);
84 
85  short xres;
86  short yres;
87  short pBot;
88  short pTop;
89 
90  void init();
91 };
92 
93 #endif
UT_RasterDepth
Definition: UT_Raster.h:25
short xres
Definition: UT_Raster.h:85
short Yres() const
Definition: UT_Raster.h:34
short pBot
Definition: UT_Raster.h:87
#define UT_API
Definition: UT_API.h:14
UT_ColorModel getColorModel() const
Definition: UT_Raster.h:48
GLdouble GLdouble x2
Definition: glad.h:2349
short yres
Definition: UT_Raster.h:86
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
static UT_RGBA zeroPixel
Definition: UT_Raster.h:68
GLfloat f
Definition: glcorearb.h:1926
UT_RasterDepth getRasterDepth() const
Definition: UT_Raster.h:45
UT_RGBA * raster
Definition: UT_Raster.h:73
GLdouble y1
Definition: glad.h:2349
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
short getPtop()
Definition: UT_Raster.h:66
UT_RasterDepth pixelDepth
Definition: UT_Raster.h:75
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLdouble t
Definition: glad.h:2397
UT_ColorModel myModel
Definition: UT_Raster.h:76
void setPhantom(short b, short t)
Definition: UT_Raster.h:64
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476
GLsizeiptr size
Definition: glcorearb.h:664
GLuint color
Definition: glcorearb.h:1261
fpreal64 fpreal
Definition: SYS_Types.h:277
short getPbot()
Definition: UT_Raster.h:65
static UT_RGBA onePixel
Definition: UT_Raster.h:69
GLint GLsizei width
Definition: glcorearb.h:103
GLboolean r
Definition: glcorearb.h:1222
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
UT_BIG_RGBA * raster16
Definition: UT_Raster.h:72
short pTop
Definition: UT_Raster.h:88
UT_RGBA ** scanlines
Definition: UT_Raster.h:74