Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Functions | Variables
savetexture.cpp File Reference

everything to save images of various formats. More...

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <memory>
#include "SDL_opengl.h"
#include "SDL_surface.h"
#include "inexor/fpsgame/fps.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/io/legacy/stream.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_endian.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_unicode.hpp"
#include "inexor/shared/tools.hpp"
#include "inexor/texture/SDL_loading.hpp"
#include "inexor/texture/image.hpp"
#include "inexor/texture/savetexture.hpp"
#include "inexor/texture/texture.hpp"
#include "inexor/ui/screen/ScreenManager.hpp"
#include "inexor/util/legacy_time.hpp"
#include "zconf.h"
#include "zlib.h"

Classes

struct  tgaheader
 

Macros

#define FLUSHZ
 

Functions

void writepngchunk (stream *f, const char *type, uchar *data=nullptr, uint len=0)
 
 VARP (compresspng, 0, 9, 9)
 
void savepng (const char *filename, ImageData &image, bool flip)
 
 VARP (compresstga, 0, 1, 1)
 
void savetga (const char *filename, ImageData &image, bool flip)
 
 VARP (screenshotformat, 0, IMG_PNG, NUMIMG-1)
 
int guessimageformat (const char *filename, int format)
 
void saveimage (const char *filename, int format, ImageData &image, bool flip)
 
 SVARP (screenshotdir,"screenshot")
 
void screenshot (char *filename)
 
 COMMAND (screenshot,"s")
 

Variables

const char * imageexts [NUMIMG] = { ".bmp", ".tga", ".png" }
 

Detailed Description

everything to save images of various formats.


Class Documentation

struct tgaheader
Class Members
uchar cmapentrysize
uchar cmaporigin[2]
uchar cmapsize[2]
uchar cmaptype
uchar descbyte
uchar height[2]
uchar identsize
uchar imagetype
uchar pixelsize
uchar width[2]
uchar xorigin[2]
uchar yorigin[2]

Macro Definition Documentation

#define FLUSHZ
Value:
do { \
int flush = sizeof(buf) - z.avail_out; \
crc = crc32(crc, buf, flush); \
len += flush; \
f->write(buf, flush); \
z.next_out = (Bytef *)buf; \
z.avail_out = sizeof(buf); \
} while(0)
ICOMMAND * f(float *a, float *b), floatret(*a **b)

Referenced by savepng().

Function Documentation

COMMAND ( screenshot  ,
"s"   
)
int guessimageformat ( const char *  filename,
int  format 
)
void saveimage ( const char *  filename,
int  format,
ImageData image,
bool  flip 
)
void savepng ( const char *  filename,
ImageData image,
bool  flip 
)
void savetga ( const char *  filename,
ImageData image,
bool  flip 
)
void screenshot ( char *  filename)
SVARP ( screenshotdir  ,
"screenshot"   
)
VARP ( compresspng  ,
,
,
 
)
VARP ( compresstga  ,
,
,
 
)
VARP ( screenshotformat  ,
,
IMG_PNG  ,
NUMIMG 1 
)
void writepngchunk ( stream f,
const char *  type,
uchar data = nullptr,
uint  len = 0 
)

References stream::putbig(), and stream::write().

Referenced by savepng().

Variable Documentation

const char* imageexts[NUMIMG] = { ".bmp", ".tga", ".png" }

Referenced by guessimageformat(), and screenshot().