Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

stretch.cpp File Reference

#include "pgdraw.h"
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

Include dependency graph for stretch.cpp:

Go to the source code of this file.

Defines

#define sign(x)   ((x)>0 ? 1:-1)
#define WHITE_PIXEL   (255)
#define BLACK_PIXEL   (0)
#define filter_support   (1.0)
#define box_support   (0.5)
#define triangle_support   (1.0)
#define bell_support   (1.5)
#define B_spline_support   (2.0)
#define Lanczos3_support   (3.0)
#define Mitchell_support   (2.0)
#define B   (1.0 / 3.0)
#define C   (1.0 / 3.0)
#define CLAMP(v, l, h)   ((Uint32)v & 0xFF)
#define FLTIDX(v)   (int)(v*1000 + 2000)
#define SCALE   1024
#define HALFSCALE   512

Typedefs

typedef Uint8 Pixel
typedef double(* filterfunc )(double)

Functions

void LockSurface (SDL_Surface *s)
void UnlockSurface (SDL_Surface *s)
template<class ST, class DT>
void StretchTemplateLUT (int x1, int x2, int y1, int y2, int yr, int yw, ST src_pixels, DT dst_pixels, Uint32 *lut)
template<class ST, class DT>
void StretchTemplate (int x1, int x2, int y1, int y2, int yr, int yw, ST src_pixels, DT dst_pixels)
template<class ST, class DT>
void RectStretchTemplate (SDL_Surface *src_surface, ST src, int xs1, int ys1, int xs2, int ys2, SDL_Surface *dst_surface, DT dst, int xd1, int yd1, int xd2, int yd2, Uint32 *lutVOI)
void StretchTemplate24to32 (int x1, int x2, int y1, int y2, int yr, int yw, Uint8 *src_pixels, Uint32 *dst_pixels, Uint32 *lut)
void RectStretch24to32 (SDL_Surface *src_surface, Uint8 *src, int xs1, int ys1, int xs2, int ys2, SDL_Surface *dst_surface, Uint32 *dst, int xd1, int yd1, int xd2, int yd2, Uint32 *lutVOI)
void PG_Draw::RectStretch (SDL_Surface *src_surface, int xs1, int ys1, int xs2, int ys2, SDL_Surface *dst_surface, int xd1, int yd1, int xd2, int yd2, Uint32 *lutVOI)
SDL_Surface * new_image (int xsize, int ysize)
void free_image (SDL_Surface *image)
void get_row (Pixel *row, SDL_Surface *image, int y)
void get_column (Pixel *column, SDL_Surface *image, int x)
double filter (double t)
double box_filter (double t)
double triangle_filter (double t)
double bell_filter (double t)
double B_spline_filter (double t)
double sinc (double x)
double Lanczos3_filter (double t)
double Mitchell_filter (double t)
void PG_Draw::CreateFilterLUT ()
void zoom (SDL_Surface *dst, SDL_Surface *src, double fwidth)
void PG_Draw::PG_SmoothFast (SDL_Surface *src, SDL_Surface *dst)
SDL_Surface * PG_CopyRect (SDL_Surface *s, int x, int y, int w, int h)
void PG_Draw::InterpolatePixel (SDL_Surface *src, SDL_Surface *dest)

Variables

CLISTcontrib
static double filterLUT [4001]


Define Documentation

#define B   (1.0 / 3.0)
 

Definition at line 442 of file stretch.cpp.

Referenced by Mitchell_filter().

#define B_spline_support   (2.0)
 

Definition at line 404 of file stretch.cpp.

Referenced by PG_Draw::PG_SmoothFast().

#define bell_support   (1.5)
 

Definition at line 389 of file stretch.cpp.

#define BLACK_PIXEL   (0)
 

Definition at line 323 of file stretch.cpp.

Referenced by zoom().

#define box_support   (0.5)
 

Definition at line 371 of file stretch.cpp.

#define C   (1.0 / 3.0)
 

Definition at line 443 of file stretch.cpp.

Referenced by Mitchell_filter().

#define CLAMP v,
l,
 )     ((Uint32)v & 0xFF)
 

Definition at line 502 of file stretch.cpp.

Referenced by zoom().

#define filter_support   (1.0)
 

Definition at line 360 of file stretch.cpp.

#define FLTIDX  )     (int)(v*1000 + 2000)
 

Definition at line 503 of file stretch.cpp.

Referenced by zoom().

#define HALFSCALE   512
 

Definition at line 736 of file stretch.cpp.

Referenced by PG_Draw::InterpolatePixel().

#define Lanczos3_support   (3.0)
 

Definition at line 430 of file stretch.cpp.

#define Mitchell_support   (2.0)
 

Definition at line 440 of file stretch.cpp.

#define SCALE   1024
 

Definition at line 735 of file stretch.cpp.

Referenced by PG_Draw::InterpolatePixel().

#define sign  )     ((x)>0 ? 1:-1)
 

Definition at line 43 of file stretch.cpp.

Referenced by RectStretch24to32(), and RectStretchTemplate().

#define triangle_support   (1.0)
 

Definition at line 379 of file stretch.cpp.

#define WHITE_PIXEL   (255)
 

Definition at line 322 of file stretch.cpp.

Referenced by zoom().


Typedef Documentation

typedef double(* filterfunc)(double)
 

Definition at line 499 of file stretch.cpp.

typedef Uint8 Pixel
 

Definition at line 320 of file stretch.cpp.


Function Documentation

double B_spline_filter double  t  )  [inline]
 

Definition at line 406 of file stretch.cpp.

Referenced by PG_Draw::CreateFilterLUT().

double bell_filter double  t  )  [inline]
 

Definition at line 391 of file stretch.cpp.

double box_filter double  t  )  [inline]
 

Definition at line 373 of file stretch.cpp.

double filter double  t  )  [inline]
 

Definition at line 362 of file stretch.cpp.

Referenced by selectunitsetfilter().

void free_image SDL_Surface *  image  )  [inline]
 

Definition at line 336 of file stretch.cpp.

Referenced by zoom().

void get_column Pixel column,
SDL_Surface *  image,
int  x
[inline]
 

Definition at line 344 of file stretch.cpp.

Referenced by zoom().

void get_row Pixel row,
SDL_Surface *  image,
int  y
[inline]
 

Definition at line 340 of file stretch.cpp.

double Lanczos3_filter double  t  )  [inline]
 

Definition at line 432 of file stretch.cpp.

References sinc().

void LockSurface SDL_Surface *  s  )  [inline]
 

Definition at line 56 of file stretch.cpp.

Referenced by zoom().

double Mitchell_filter double  t  )  [inline]
 

Definition at line 445 of file stretch.cpp.

References B, and C.

SDL_Surface* new_image int  xsize,
int  ysize
[inline]
 

Definition at line 326 of file stretch.cpp.

Referenced by PG_CopyRect(), and zoom().

SDL_Surface* PG_CopyRect SDL_Surface *  s,
int  x,
int  y,
int  w,
int  h
 

Definition at line 721 of file stretch.cpp.

References new_image().

void PG_Draw::CreateFilterLUT  ) 
 

Definition at line 483 of file stretch.cpp.

References B_spline_filter(), and filterLUT.

void PG_Draw::InterpolatePixel SDL_Surface *  src,
SDL_Surface *  dest
 

Definition at line 742 of file stretch.cpp.

References HALFSCALE, and SCALE.

void PG_Draw::PG_SmoothFast SDL_Surface *  src,
SDL_Surface *  dst
 

Definition at line 717 of file stretch.cpp.

References B_spline_support, and zoom().

void PG_Draw::RectStretch SDL_Surface *  src_surface,
int  xs1,
int  ys1,
int  xs2,
int  ys2,
SDL_Surface *  dst_surface,
int  xd1,
int  yd1,
int  xd2,
int  yd2,
Uint32 *  lutVOI
 

Definition at line 261 of file stretch.cpp.

References RectStretch24to32(), and RectStretchTemplate().

void RectStretch24to32 SDL_Surface *  src_surface,
Uint8 *  src,
int  xs1,
int  ys1,
int  xs2,
int  ys2,
SDL_Surface *  dst_surface,
Uint32 *  dst,
int  xd1,
int  yd1,
int  xd2,
int  yd2,
Uint32 *  lutVOI
[inline]
 

Definition at line 222 of file stretch.cpp.

References sign, and StretchTemplate24to32().

Referenced by PG_Draw::RectStretch().

template<class ST, class DT>
void RectStretchTemplate SDL_Surface *  src_surface,
ST  src,
int  xs1,
int  ys1,
int  xs2,
int  ys2,
SDL_Surface *  dst_surface,
DT  dst,
int  xd1,
int  yd1,
int  xd2,
int  yd2,
Uint32 *  lutVOI
[inline]
 

Definition at line 131 of file stretch.cpp.

References sign, StretchTemplate(), and StretchTemplateLUT().

Referenced by PG_Draw::RectStretch(), and SDL_StretchSurface().

double sinc double  x  )  [inline]
 

Definition at line 422 of file stretch.cpp.

References M_PI.

Referenced by Lanczos3_filter().

template<class ST, class DT>
void StretchTemplate int  x1,
int  x2,
int  y1,
int  y2,
int  yr,
int  yw,
ST  src_pixels,
DT  dst_pixels
[inline]
 

Definition at line 97 of file stretch.cpp.

Referenced by RectStretchTemplate().

void StretchTemplate24to32 int  x1,
int  x2,
int  y1,
int  y2,
int  yr,
int  yw,
Uint8 *  src_pixels,
Uint32 *  dst_pixels,
Uint32 *  lut
[inline]
 

Definition at line 190 of file stretch.cpp.

Referenced by RectStretch24to32().

template<class ST, class DT>
void StretchTemplateLUT int  x1,
int  x2,
int  y1,
int  y2,
int  yr,
int  yw,
ST  src_pixels,
DT  dst_pixels,
Uint32 *  lut
[inline]
 

Definition at line 71 of file stretch.cpp.

Referenced by RectStretchTemplate().

double triangle_filter double  t  )  [inline]
 

Definition at line 381 of file stretch.cpp.

void UnlockSurface SDL_Surface *  s  )  [inline]
 

Definition at line 63 of file stretch.cpp.

Referenced by zoom().

void zoom SDL_Surface *  dst,
SDL_Surface *  src,
double  fwidth
 

Definition at line 505 of file stretch.cpp.

References BLACK_PIXEL, CLAMP, filterLUT, FLTIDX, free_image(), get_column(), LockSurface(), CLIST::n, new_image(), CLIST::p, CONTRIB::pixel, UnlockSurface(), CONTRIB::weight, and WHITE_PIXEL.

Referenced by PG_Draw::PG_SmoothFast().


Variable Documentation

CLIST* contrib
 

Definition at line 480 of file stretch.cpp.

double filterLUT[4001] [static]
 

Definition at line 481 of file stretch.cpp.

Referenced by PG_Draw::CreateFilterLUT(), and zoom().


Generated on Tue Jun 24 02:10:12 2008 for Advanced Strategic Command by  doxygen 1.4.2