Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_CANVAS_OPENGLCOMMON_GLSS_H__
00021 #define __CS_CANVAS_OPENGLCOMMON_GLSS_H__
00022
00027 #include "csextern_gl.h"
00028 #include "csutil/scf_implementation.h"
00029 #include "csgfx/imagebase.h"
00030
00031 class csGraphics2DGLCommon;
00032
00039 class CS_CSPLUGINCOMMON_GL_EXPORT csGLScreenShot :
00040 public scfImplementationExt1<csGLScreenShot, csImageBase, iDataBuffer>
00041 {
00042 csGraphics2DGLCommon* G2D;
00043 int Format;
00044 csRGBpixel* Data;
00045 size_t dataSize;
00046 int Width, Height;
00047
00048 public:
00049 csGLScreenShot* poolNext;
00050
00051 csGLScreenShot (csGraphics2DGLCommon*);
00052 virtual ~csGLScreenShot ();
00053
00054 virtual const void *GetImageData ()
00055 { return Data; }
00056 virtual int GetWidth () const
00057 { return Width; }
00058 virtual int GetHeight () const
00059 { return Height; }
00060 virtual int GetFormat () const
00061 { return Format; }
00062 void SetData (void*);
00063
00064 void IncRef ();
00065 void DecRef ();
00066
00067 const char* GetRawFormat() const
00068 {
00069 if ((Format & CS_IMGFMT_MASK) == CS_IMGFMT_TRUECOLOR)
00070 return "a8b8g8r8";
00071 else
00072 return 0;
00073 }
00074 csRef<iDataBuffer> GetRawData() const
00075 {
00076 return const_cast<csGLScreenShot*> (this);
00077 }
00078
00080
00081 size_t GetSize() const
00082 {
00083 if ((Format & CS_IMGFMT_MASK) == CS_IMGFMT_TRUECOLOR)
00084 return Width * Height * 4;
00085 else
00086 return Width * Height;
00087 }
00088 char* GetData() const
00089 {
00090 return (char*)Data;
00091 }
00093 };
00094
00097 #endif // __CS_CANVAS_OPENGLCOMMON_GLSS_H__
00098