simage  1.8.3
Coin3D texture image library
Loading...
Searching...
No Matches
resize.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <simage.h>

Data Structures

struct  CLIST
 
struct  CONTRIB
 
struct  Image
 

Macros

#define B   (1.0f / 3.0f)
 
#define B_spline_support   (2.0f)
 
#define bell_support   (1.5f)
 
#define box_support   (0.5f)
 
#define C   (1.0f / 3.0f)
 
#define filter_support   (1.0f)
 
#define Lanczos3_support   (3.0f)
 
#define M_PI   3.14159265358979323846
 
#define Mitchell_support   (2.0)
 
#define triangle_support   (1.0f)
 

Functions

static float B_spline_filter (float t)
 
static float bell_filter (float t)
 
static float box_filter (float t)
 
static float filter (float t)
 
static void get_column (unsigned char *column, Image *image, int x)
 
static void get_row (unsigned char *row, Image *image, int y)
 
static float Lanczos3_filter (float t)
 
static float Mitchell_filter (float t)
 
static Imagenew_image (int xsize, int ysize, int bpp, unsigned char *data)
 
static void put_pixel (Image *image, int x, int y, float *data)
 
unsigned char * simage_resize (unsigned char *src, int width, int height, int num_comp, int newwidth, int newheight)
 
static unsigned char * simage_resize_fast (unsigned char *src, int width, int height, int num_comp, int newwidth, int newheight)
 
static float sinc (float x)
 
static float triangle_filter (float t)
 
static void zoom (Image *dst, Image *src, float(*filterf)(float), float fwidth)
 

Macro Definition Documentation

◆ B

#define B   (1.0f / 3.0f)

◆ B_spline_support

#define B_spline_support   (2.0f)

◆ bell_support

#define bell_support   (1.5f)

◆ box_support

#define box_support   (0.5f)

◆ C

#define C   (1.0f / 3.0f)

◆ filter_support

#define filter_support   (1.0f)

◆ Lanczos3_support

#define Lanczos3_support   (3.0f)

◆ M_PI

#define M_PI   3.14159265358979323846

◆ Mitchell_support

#define Mitchell_support   (2.0)

◆ triangle_support

#define triangle_support   (1.0f)

Function Documentation

◆ B_spline_filter()

static float B_spline_filter ( float t)
static

◆ bell_filter()

static float bell_filter ( float t)
static

◆ box_filter()

static float box_filter ( float t)
static

◆ filter()

static float filter ( float t)
static

◆ get_column()

static void get_column ( unsigned char * column,
Image * image,
int x )
static

◆ get_row()

static void get_row ( unsigned char * row,
Image * image,
int y )
static

◆ Lanczos3_filter()

static float Lanczos3_filter ( float t)
static

◆ Mitchell_filter()

static float Mitchell_filter ( float t)
static

◆ new_image()

static Image * new_image ( int xsize,
int ysize,
int bpp,
unsigned char * data )
static

◆ put_pixel()

static void put_pixel ( Image * image,
int x,
int y,
float * data )
static

◆ simage_resize()

unsigned char * simage_resize ( unsigned char * imagedata,
int width,
int height,
int numcomponents,
int newwidth,
int newheight )

Since OpenGL textures must have width and height equal to 2^n, this is often needed. A pointer to the new image data is returned. imagedata is not freed. Uses the algorithm "Filtered Image Rescaling" by Dale Schumacher, from GGems III.

Scales the input imagedata and return a new image with the given dimensions returned image buffer must be freed by simage_free_image()

◆ simage_resize_fast()

static unsigned char * simage_resize_fast ( unsigned char * src,
int width,
int height,
int num_comp,
int newwidth,
int newheight )
static

◆ sinc()

static float sinc ( float x)
static

◆ triangle_filter()

static float triangle_filter ( float t)
static

◆ zoom()

static void zoom ( Image * dst,
Image * src,
float(*)(float) filterf,
float fwidth )
static