/*----------------------------------------------------------------- LOG GEM - Graphics Environment for Multimedia GemPixUtil.h - contains image functions for pix objects - part of GEM Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.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. -----------------------------------------------------------------*/ #ifndef _INCLUDE__GEM_GEM_IMAGE_H_ #define _INCLUDE__GEM_GEM_IMAGE_H_ #include #include #include "Gem/ExportDef.h" /////////////////////////////////////////////////////////////////////////////// // Color component defines // // These should be used to reference the various color channels /////////////////////////////////////////////////////////////////////////////// /* 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 */ #define GEM_GRAY 0x1909 const int chGray = 0; /* YUV422 */ #define GEM_YUV 0x85B9 const int chU = 0; const int chY0 = 1; const int chV = 2; const int chY1 = 3; /*----------------------------------------------------------------- ------------------------------------------------------------------- CLASS imageStruct The basic image structure -----------------------------------------------------------------*/ // we now have a class "imageStruct"; // since i need to compile some of the sources with an older version of Gem // there is a new define here: #define IMAGE_CLASS struct GEM_EXTERN imageStruct { imageStruct(void); imageStruct(const imageStruct&); virtual ~imageStruct(void); virtual void info(void); ////////// // columns virtual unsigned char* allocate(size_t size); virtual unsigned char* allocate(void); // if we have allocated some space already, only re-allocate when needed. virtual unsigned char* reallocate(size_t size); virtual unsigned char* reallocate(void); // delete the buffer (if it is ours) virtual void clear(void); ////////// // dimensions of the image int xsize; int ysize; ////////// // (average) width of 1 pixel (LUMINANCE = 1, RGBA = 4, YUV = 2) int csize; ////////// // data type - always GL_UNSIGNED_BYTE (except for OS X) unsigned int type; ////////// // the format - either GL_RGBA, GL_LUMINANCE // or GL_YCBCR_422_GEM (which is on mac-computers GL_YCBCR_422_APPLE) unsigned int format; ///////// // is this owned by us (? what about underscores ?) int notowned; ////////// // gets a pixel /* X,Y are the coordinates * C is the offset in the interleaved data (like chRed==0 for red) * you should use chRed instead of 0 (because it might not be 0) * * you must make sure that (0<=X