aboutsummaryrefslogtreecommitdiff
path: root/Gem/develop/include/Gem/Gem/Image.h
diff options
context:
space:
mode:
Diffstat (limited to 'Gem/develop/include/Gem/Gem/Image.h')
-rw-r--r--Gem/develop/include/Gem/Gem/Image.h127
1 files changed, 65 insertions, 62 deletions
diff --git a/Gem/develop/include/Gem/Gem/Image.h b/Gem/develop/include/Gem/Gem/Image.h
index bf61aef..c0b6eda 100644
--- a/Gem/develop/include/Gem/Gem/Image.h
+++ b/Gem/develop/include/Gem/Gem/Image.h
@@ -8,7 +8,7 @@ LOG
Copyright (c) 1997-1999 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
- Copyright (c) 2001-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
+ Copyright (c) 2001-2019 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
@@ -17,10 +17,9 @@ LOG
#ifndef _INCLUDE__GEM_GEM_IMAGE_H_
#define _INCLUDE__GEM_GEM_IMAGE_H_
-#include "Gem/GemGL.h"
-
#include <string.h>
#include <stdlib.h>
+#include "Gem/ExportDef.h"
///////////////////////////////////////////////////////////////////////////////
// Color component defines
@@ -28,29 +27,33 @@ LOG
// These should be used to reference the various color channels
///////////////////////////////////////////////////////////////////////////////
-/* RGBA */
-
-#if GL_RGBA_GEM == GL_RGBA
-const int chRed = 0;
-const int chGreen = 1;
-const int chBlue = 2;
-const int chAlpha = 3;
-#else
-const int chAlpha = 0;
-const int chRed = 1;
-const int chGreen = 2;
-const int chBlue = 3;
+/* RGBA: on Apple this is really BGRA_EXT */
+#ifndef __APPLE__
+# define GEM_RGBA 0x1908
+const int chRed = 0;
+const int chGreen = 1;
+const int chBlue = 2;
+const int chAlpha = 3;
+#else /* APPLE */
+# define GEM_RGBA 0x80E1
+const int chAlpha = 0;
+const int chRed = 1;
+const int chGreen = 2;
+const int chBlue = 3;
#endif
+#define GEM_RGB 0x1907
/* Gray */
-const int chGray = 0;
+#define GEM_GRAY 0x1909
+const int chGray = 0;
/* YUV422 */
-const int chU = 0;
-const int chY0 = 1;
-const int chV = 2;
-const int chY1 = 3;
+#define GEM_YUV 0x85B9
+const int chU = 0;
+const int chY0 = 1;
+const int chV = 2;
+const int chY1 = 3;
/*-----------------------------------------------------------------
-------------------------------------------------------------------
@@ -86,23 +89,23 @@ struct GEM_EXTERN imageStruct {
//////////
// dimensions of the image
- GLint xsize;
- GLint ysize;
+ int xsize;
+ int ysize;
//////////
// (average) width of 1 pixel (LUMINANCE = 1, RGBA = 4, YUV = 2)
- GLint csize;
+ int csize;
//////////
// data type - always GL_UNSIGNED_BYTE (except for OS X)
- GLenum type;
+ unsigned int type;
//////////
// the format - either GL_RGBA, GL_LUMINANCE
// or GL_YCBCR_422_GEM (which is on mac-computers GL_YCBCR_422_APPLE)
- GLenum format;
+ unsigned int format;
- //////////
+ /////////
// is this owned by us (? what about underscores ?)
int notowned;
@@ -136,10 +139,10 @@ struct GEM_EXTERN imageStruct {
/////////
// gets the color of a pixel
- virtual void getRGB(int X, int Y, unsigned char*r, unsigned char*g,
+ virtual bool getRGB(int X, int Y, unsigned char*r, unsigned char*g,
unsigned char*b, unsigned char*a=NULL) const;
- virtual void getGrey(int X, int Y, unsigned char*g) const;
- virtual void getYUV(int X, int Y, unsigned char*y, unsigned char*u,
+ virtual bool getGrey(int X, int Y, unsigned char*g) const;
+ virtual bool getYUV(int X, int Y, unsigned char*y, unsigned char*u,
unsigned char*v) const;
/* following will set the whole image-data to either black or white
@@ -192,64 +195,64 @@ struct GEM_EXTERN imageStruct {
* this is maybe not really clean (the meta-data is stored in the destination,
* while the source has no meta-data of its own)
*/
- virtual void convertTo (imageStruct*to, GLenum dest_format=0) const;
- virtual void convertFrom(const imageStruct*from, GLenum dest_format=0);
-
- virtual void fromRGB (const unsigned char* orgdata);
- virtual void fromRGBA (const unsigned char* orgdata);
- virtual void fromBGR (const unsigned char* orgdata);
- virtual void fromBGRA (const unsigned char* orgdata);
- virtual void fromRGB16 (const unsigned char* orgdata);
- virtual void fromABGR (const unsigned char* orgdata);
- virtual void fromARGB (const unsigned char* orgdata);
- virtual void fromGray (const unsigned char* orgdata);
- virtual void fromGray (short* orgdata);
- virtual void fromUYVY (const unsigned char* orgdata);
- virtual void fromYUY2 (const unsigned char* orgdata); // YUYV
- virtual void fromYVYU (const unsigned char* orgdata);
+ virtual bool convertTo (imageStruct*to, unsigned int dest_format=0) const;
+ virtual bool convertFrom(const imageStruct*from, unsigned int dest_format=0);
+
+ virtual bool fromRGB (const unsigned char* orgdata);
+ virtual bool fromRGBA (const unsigned char* orgdata);
+ virtual bool fromBGR (const unsigned char* orgdata);
+ virtual bool fromBGRA (const unsigned char* orgdata);
+ virtual bool fromRGB16 (const unsigned char* orgdata);
+ virtual bool fromABGR (const unsigned char* orgdata);
+ virtual bool fromARGB (const unsigned char* orgdata);
+ virtual bool fromGray (const unsigned char* orgdata);
+ virtual bool fromGray (const short* orgdata);
+ virtual bool fromUYVY (const unsigned char* orgdata);
+ virtual bool fromYUY2 (const unsigned char* orgdata); // YUYV
+ virtual bool fromYVYU (const unsigned char* orgdata);
/* planar YUV420: this is rather generic and not really YV12 only */
- virtual void fromYV12 (const unsigned char* Y, const unsigned char*U,
+ virtual bool fromYV12 (const unsigned char* Y, const unsigned char*U,
const unsigned char*V);
/* assume that the planes are near each other: YVU */
- virtual void fromYV12 (const unsigned char* orgdata);
+ virtual bool fromYV12 (const unsigned char* orgdata);
/* assume that the planes are near each other: YVU */
- virtual void fromYU12 (const unsigned char* orgdata);
+ virtual bool fromYU12 (const unsigned char* orgdata);
/* overloading the above two in order to accept pdp YV12 packets */
- virtual void fromYV12 (const short* Y, const short*U, const short*V);
- virtual void fromYV12 (const short* orgdata);
+ virtual bool fromYV12 (const short* Y, const short*U, const short*V);
+ virtual bool fromYV12 (const short* orgdata);
/* aliases */
- virtual void fromYUV422 (const unsigned char* orgdata)
+ virtual bool fromYUV422 (const unsigned char* orgdata)
{
- fromUYVY(orgdata);
+ return fromUYVY(orgdata);
}
- virtual void fromYUV420P(const unsigned char* orgdata)
+ virtual bool fromYUV420P(const unsigned char* orgdata)
{
- fromYV12(orgdata);
+ return fromYV12(orgdata);
}
- virtual void fromYUV420P(const unsigned char*Y,const unsigned char*U,
+ virtual bool fromYUV420P(const unsigned char*Y,const unsigned char*U,
const unsigned char*V)
{
- fromYV12(Y,U,V);
+ return fromYV12(Y,U,V);
}
// "data" points to the image.
// the memory could(!) be reserved by this class or someone else
// "notowned" should be set to "1", if "data" points to foreign memory
// "data" is not freed directly, when the destructor is called
- unsigned char *data; // the pointer to the data
+ unsigned char *data; // the pointer to the data
private:
// "pdata" is the private data, and is the memory reserved by this class
// this data is freed when the destructor is called
- unsigned char *pdata;
+ unsigned char *pdata;
// "datasize" is the size of data reserved at "pdata"
- size_t datasize;
+ size_t datasize;
public:
//////////
// true if the image is flipped horizontally (origin is upper-left)
// false if the image is openGL-conformant (origin is lower-left)
- GLboolean upsidedown;
+ bool upsidedown;
/* make the image orientation openGL-conformant */
virtual void fixUpDown(void);
@@ -270,17 +273,17 @@ struct GEM_EXTERN pixBlock {
//////////
// the block's image
- imageStruct image;
+ imageStruct image;
//////////
// is this a newimage since last time?
// ie, has it been refreshed
- bool newimage;
+ bool newimage;
//////////
// keeps track of when new films are loaded
// useful for rectangle_textures on OSX
- bool newfilm;
+ bool newfilm;
};
///////////////////////////////////////////////////////////////////////////////