ivideo/texture.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

ivideo/texture.h
Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 1998, 2000 by Jorrit Tyberghein
    00003                         2004 by Marten Svanfeldt
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public
    00016     License along with this library; if not, write to the Free
    00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00018 */
    00019
    00020 #ifndef __CS_IVIDEO_TEXTURE_H__
    00021 #define __CS_IVIDEO_TEXTURE_H__
    00022
    00031 #include "csgfx/textureformatstrings.h"
    00032 #include "csutil/scf_interface.h"
    00033 #include "cstypes.h"
    00034 #include "ivideo/graph3d.h"
    00035
    00036 struct iDataBuffer;
    00037 struct iGraphics2D;
    00038 struct iGraphics3D;
    00039
    00040
    00053 struct iTextureHandle : public virtual iBase
    00054 {
    00055   SCF_INTERFACE(iTextureHandle, 5,0,0);
    00057   virtual int GetFlags () const = 0;
    00058
    00060   virtual void SetKeyColor (bool Enable) = 0;
    00061
    00063   virtual void SetKeyColor (uint8 red, uint8 green, uint8 blue) = 0;
    00064
    00066   virtual bool GetKeyColor () const = 0;
    00067
    00069   virtual void GetKeyColor (uint8 &red, uint8 &green, uint8 &blue) const = 0;
    00070
    00080   virtual bool GetRendererDimensions (int &mw, int &mh) = 0;
    00081
    00089   virtual void GetOriginalDimensions (int& mw, int& mh) = 0;
    00090
    00094   enum { CS_TEXTURE_CUBE_POS_X = 0, CS_TEXTURE_CUBE_NEG_X,
    00095          CS_TEXTURE_CUBE_POS_Y, CS_TEXTURE_CUBE_NEG_Y,
    00096          CS_TEXTURE_CUBE_POS_Z, CS_TEXTURE_CUBE_NEG_Z };
    00097
    00098
    00108   virtual bool GetRendererDimensions (int &mw, int &mh, int &md) = 0;
    00109
    00117   virtual void GetOriginalDimensions (int& mw, int& mh, int &md) = 0;
    00118
    00120   enum TextureBlitDataFormat
    00121   {
    00123     RGBA8888 = 0,
    00125     BGRA8888
    00126   };
    00127
    00135   virtual void Blit (int x, int y, int width, int height,
    00136     unsigned char const* data, TextureBlitDataFormat format = RGBA8888) = 0;
    00137
    00141   virtual const char* GetImageName () const = 0;
    00142
    00144   virtual csAlphaMode::AlphaType GetAlphaType () const = 0;
    00145
    00150   virtual void Precache () = 0;
    00151
    00155   virtual bool IsPrecached () = 0;
    00156
    00167   virtual void SetTextureClass (const char* className) = 0;
    00172   virtual const char* GetTextureClass () = 0;
    00173
    00180   virtual void SetAlphaType (csAlphaMode::AlphaType alphaType) = 0;
    00181
    00183   enum TextureType
    00184   {
    00186     texType1D = 0,
    00188     texType2D,
    00190     texType3D,
    00192     texTypeCube,
    00194     texTypeRect
    00195   };
    00196
    00202   virtual TextureType GetTextureType() const = 0;
    00203
    00204   enum
    00205   {
    00207     blitbufReadable = 1,
    00214     blitbufRetainArea = 2
    00215   };
    00216
    00237   virtual uint8* QueryBlitBuffer (int x, int y, int width, int height,
    00238     size_t& pitch, TextureBlitDataFormat format = RGBA8888,
    00239     uint bufFlags = 0) = 0;
    00241   virtual void ApplyBlitBuffer (uint8* buf) = 0;
    00243   enum BlitBufferNature
    00244   {
    00253     natureIndirect = 0,
    00258     natureDirect = 1
    00259   };
    00260   virtual BlitBufferNature GetBufferNature (uint8* buf) = 0;
    00261
    00263   virtual void SetMipmapLimits (int maxMip, int minMip = 0) = 0;
    00265   virtual void GetMipmapLimits (int& maxMip, int& minMip) = 0;
    00266
    00281   virtual csPtr<iDataBuffer> Readback (
    00282     const CS::StructuredTextureFormat& format, int mip = 0) = 0;
    00283 };
    00284
    00287 #endif // __CS_IVIDEO_TEXTURE_H__