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

Texture modifiers mainly applied on load. More...

#include <SDL.h>
#include <SDL_opengl.h>
#include <algorithm>
#include "SDL_pixels.h"
#include "SDL_surface.h"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_types.hpp"

Go to the source code of this file.

Classes

struct  ImageData
 Structure holding the Raw Pixel Data and minimum image info. More...
 

Functions

void scaletexture (uchar *src, uint sw, uint sh, uint bpp, uint pitch, uchar *dst, uint dw, uint dh)
 
void resizetexture (int w, int h, bool mipmap, bool canreduce, GLenum target, int compress, int &tw, int &th)
 
void scaleimage (ImageData &s, int w, int h)
 
void texoffset (ImageData &s, int xoffset, int yoffset)
 
void texrotate (ImageData &s, int numrots, bool isnormalmap=false)
 
void texreorient (ImageData &s, bool flipx, bool flipy, bool swapxy, bool isnormalmap=false)
 
void texflip (ImageData &s)
 
void texmad (ImageData &s, const vec &mul, const vec &add)
 
void texcolorify (ImageData &s, const vec &color, vec weights)
 
void texcolormask (ImageData &s, const vec &color1, const vec &color2)
 
void texdup (ImageData &s, int srcchan, int dstchan)
 
void texmix (ImageData &s, int c1, int c2, int c3, int c4)
 
void texgrey (ImageData &s)
 
void texpremul (ImageData &s)
 
void texagrad (ImageData &s, float x2, float y2, float x1, float y1)
 
void texnormal (ImageData &s, int emphasis)
 
void texblur (ImageData &s, int n, int r)
 
void forcergbimage (ImageData &s)
 
void blurtexture (int n, int bpp, int w, int h, uchar *dst, const uchar *src, int margin=0)
 
void blurnormals (int n, int w, int h, bvec *dst, const bvec *src, int margin=0)
 

Detailed Description

Texture modifiers mainly applied on load.

Function Documentation

void blurnormals ( int  n,
int  w,
int  h,
bvec dst,
const bvec src,
int  margin = 0 
)
void blurtexture ( int  n,
int  bpp,
int  w,
int  h,
uchar dst,
const uchar src,
int  margin = 0 
)
void forcergbimage ( ImageData s)
void resizetexture ( int  w,
int  h,
bool  mipmap,
bool  canreduce,
GLenum  target,
int  compress,
int &  tw,
int &  th 
)
void scaleimage ( ImageData s,
int  w,
int  h 
)
void scaletexture ( uchar src,
uint  sw,
uint  sh,
uint  bpp,
uint  pitch,
uchar dst,
uint  dw,
uint  dh 
)
void texagrad ( ImageData s,
float  x2,
float  y2,
float  x1,
float  y1 
)
void texblur ( ImageData s,
int  n,
int  r 
)
void texcolorify ( ImageData s,
const vec color,
vec  weights 
)

References ImageData::bpp, f(), vec::iszero(), loopk, and writetex.

Referenced by texturedata().

void texcolormask ( ImageData s,
const vec color1,
const vec color2 
)
void texdup ( ImageData s,
int  srcchan,
int  dstchan 
)

References ImageData::bpp, inexor::rpc::max(), and writetex.

Referenced by texturedata().

void texflip ( ImageData s)
void texgrey ( ImageData s)
void texmad ( ImageData s,
const vec mul,
const vec add 
)
void texmix ( ImageData s,
int  c1,
int  c2,
int  c3,
int  c4 
)
void texnormal ( ImageData s,
int  emphasis 
)
void texoffset ( ImageData s,
int  xoffset,
int  yoffset 
)
void texpremul ( ImageData s)

References ImageData::bpp, and writetex.

Referenced by texturedata().

void texreorient ( ImageData s,
bool  flipx,
bool  flipy,
bool  swapxy,
bool  isnormalmap = false 
)
Parameters
sThe texture/image which you want to orientate
flipxFlip from x axis
flipyFlip from y axis
swapxySwap on both x and y
isnormalmapspecifies whether you pass in a normal map and hence need to shift the blue/red channels accordingly.

References ImageData::align, ImageData::bpp, ImageData::calclevelsize(), ImageData::compressed, hmap::d, ImageData::data, ImageData::h, ImageData::levels, loopi(), inexor::rpc::max(), ImageData::pitch, reorients3tc(), reorienttexture(), ImageData::replace(), and ImageData::w.

Referenced by cubemaploadwildcard(), texrotate(), and texturedata().

void texrotate ( ImageData s,
int  numrots,
bool  isnormalmap 
)
Parameters
sThe texture/image which you want to apply rotation operations to
numrotsSpecifies what type of rotation on what axis to implement 1..3 rotate through 90..270 degrees, 4 flips X, 5 flips Y
isnormalmapspecifies whether you pass in a normal map and hence need to shift the blue/red channels accordingly.
isnormalmapspecifies whether you pass in a normal map and hence need to shift the blue/red channels accordingly.

References texreorient().

Referenced by texturedata().