Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VSImage Class Reference

#include <vsimage.h>

Public Types

enum  VSImageMode {
  _8BIT, _24BIT, _24BITRGBA, _DXT1,
  _DXT1RGBA, _DXT3, _DXT5
}
 

Public Member Functions

 VSImage ()
 
 VSImage (VSFileSystem::VSFile *f, textureTransform *t=NULL, bool strip=false, VSFileSystem::VSFile *f2=NULL)
 
 ~VSImage ()
 
 LOCALCONST_DECL (int, SIZEOF_BITMAPFILEHEADER, sizeof(WORD)+sizeof(DWORD)+sizeof(WORD)+sizeof(WORD)+sizeof(DWORD)) LOCALCONST_DECL(int
 
VSFileSystem::VSError WriteImage (VSFileSystem::VSFile *pf, unsigned char *data, VSImageType type, unsigned int width, unsigned int height, bool alpha=1, char bpp=16, bool flip=false)
 
int Depth () const
 
int Format () const
 
char Sides () const
 
bool isCube () const
 

Public Attributes

unsigned char * palette
 
enum VSImage::VSImageMode mode
 
unsigned long sizeX
 the dimensions of the texture More...
 
unsigned long sizeY
 
 SIZEOF_BITMAPINFOHEADER
 

Protected Types

enum  CubeSides {
  SIDE_SINGLE =0, SIDE_POS_X =0x01, SIDE_NEG_X =0x02, SIDE_POS_Y =0x04,
  SIDE_NEG_Y =0x08, SIDE_POS_Z =0x10, SIDE_NEG_Z =0x20
}
 

Protected Attributes

char img_sides
 
int img_nmips
 

Detailed Description

Definition at line 138 of file vsimage.h.

Member Enumeration Documentation

enum VSImage::CubeSides
protected
Enumerator
SIDE_SINGLE 
SIDE_POS_X 
SIDE_NEG_X 
SIDE_POS_Y 
SIDE_NEG_Y 
SIDE_POS_Z 
SIDE_NEG_Z 

Definition at line 154 of file vsimage.h.

155  {
156  SIDE_SINGLE=0,
157  SIDE_POS_X =0x01,
158  SIDE_NEG_X =0x02,
159  SIDE_POS_Y =0x04,
160  SIDE_NEG_Y =0x08,
161  SIDE_POS_Z =0x10,
162  SIDE_NEG_Z =0x20
163  };
Enumerator
_8BIT 
_24BIT 
_24BITRGBA 
_DXT1 
_DXT1RGBA 
_DXT3 
_DXT5 

Definition at line 212 of file vsimage.h.

Constructor & Destructor Documentation

VSImage::VSImage ( )
VSImage::VSImage ( VSFileSystem::VSFile f,
textureTransform t = NULL,
bool  strip = false,
VSFileSystem::VSFile f2 = NULL 
)
VSImage::~VSImage ( )

Definition at line 100 of file vsimage.cpp.

101 {
102  //img_file? and tt should not be deleted since they are passed as args to the class
103 }

Member Function Documentation

int VSImage::Depth ( ) const
inline

Definition at line 255 of file vsimage.h.

256  {
257  return this->img_depth;
258  }
int VSImage::Format ( ) const
inline

Definition at line 259 of file vsimage.h.

260  {
261  return this->img_color_type;
262  }
bool VSImage::isCube ( ) const
inline

Definition at line 267 of file vsimage.h.

References img_sides, and SIDE_SINGLE.

268  {
269  return this->img_sides != SIDE_SINGLE;
270  }
VSImage::LOCALCONST_DECL ( int  ,
SIZEOF_BITMAPFILEHEADER  ,
sizeof(WORD)+sizeof(DWORD)+sizeof(WORD)+sizeof(WORD)+sizeof(DWORD  
)
char VSImage::Sides ( ) const
inline

Definition at line 263 of file vsimage.h.

References img_sides.

264  {
265  return this->img_sides;
266  }
VSError VSImage::WriteImage ( VSFileSystem::VSFile pf,
unsigned char *  data,
VSImageType  type,
unsigned int  width,
unsigned int  height,
bool  alpha = 1,
char  bpp = 16,
bool  flip = false 
)

Definition at line 795 of file vsimage.cpp.

References VSFileSystem::VSFile::Close(), VSFileSystem::FileNotFound, VSFileSystem::Ok, VSFileSystem::VSFile::OpenCreateWrite(), and VSFileSystem::vs_dprintf().

804 {
805  this->img_type = type;
806  VSFile f;
807  VSError err = f.OpenCreateWrite( filename, ft );
808  if (err > Ok) {
809  vs_dprintf(1,"VSImage ERROR : failed to open %s for writing \n",filename);
810  vs_dprintf( 1, img_file->GetFilename().c_str() );
812  }
813  VSError ret = this->WriteImage( &f, data, type, width, height, alpha, bpp, flip );
814  f.Close();
815  return ret;
816 }

Member Data Documentation

int VSImage::img_nmips
protected

Definition at line 166 of file vsimage.h.

char VSImage::img_sides
protected

Definition at line 165 of file vsimage.h.

Referenced by isCube(), and Sides().

enum VSImage::VSImageMode VSImage::mode
unsigned char* VSImage::palette

Definition at line 206 of file vsimage.h.

VSImage::SIZEOF_BITMAPINFOHEADER

Definition at line 223 of file vsimage.h.

unsigned long VSImage::sizeX

the dimensions of the texture

Definition at line 215 of file vsimage.h.

unsigned long VSImage::sizeY

Definition at line 216 of file vsimage.h.


The documentation for this class was generated from the following files: