|
|
|
@ -2,23 +2,33 @@ |
|
|
|
|
by Jorge L Rodriguez (@VinoBS) - 2014 |
|
|
|
|
http://github.com/nothings/stb
|
|
|
|
|
|
|
|
|
|
Written with emphasis on usage and speed. Only scaling is |
|
|
|
|
currently supported, no rotations or translations. |
|
|
|
|
|
|
|
|
|
DOCUMENTATION |
|
|
|
|
Written with emphasis on usability, portability, and efficiency. (No |
|
|
|
|
SIMD or threads, so it will not be the fastest implementation around.) |
|
|
|
|
Only scaling is supported, no rotations or translations. |
|
|
|
|
|
|
|
|
|
COMPILING & LINKING |
|
|
|
|
In one C/C++ file that #includes this file, do this: |
|
|
|
|
#define STB_IMAGE_RESIZE_IMPLEMENTATION |
|
|
|
|
before the #include. That will create the implementation in that file. |
|
|
|
|
|
|
|
|
|
VERY QUICK GUIDE |
|
|
|
|
A typical resize of a in_w by in_h image to out_w by out_h with 4 channels where channel #3 is the alpha channel might look like: |
|
|
|
|
int success = stbir_resize_uint8_srgb_edgemode(input_pixels, in_w, in_h, 0, output_pixels, out_w, out_h, 0, 4, 3, 0, STBIR_EDGE_CLAMP); |
|
|
|
|
QUICKSTART |
|
|
|
|
stbir_resize_uint8( input_pixels , in_w , in_h , 0, |
|
|
|
|
output_pixels, out_w, out_h, 0, num_channels) |
|
|
|
|
stbir_resize_float(...) |
|
|
|
|
stbir_resize_uint8_srgb( input_pixels , in_w , in_h , 0, |
|
|
|
|
output_pixels, out_w, out_h, 0, |
|
|
|
|
num_channels , alpha_ chan , 0) |
|
|
|
|
stbir_resize_uint8_srgb_edgemode( |
|
|
|
|
input_pixels , in_w , in_h , 0,
|
|
|
|
|
output_pixels, out_w, out_h, 0,
|
|
|
|
|
num_channels , alpha_chan , 0, STBIR_EDGE_CLAMP) |
|
|
|
|
WRAP/REFLECT/ZERO |
|
|
|
|
|
|
|
|
|
FULL API |
|
|
|
|
See the "header file" section of the source for API documentation. |
|
|
|
|
|
|
|
|
|
ADDITIONAL DOCUMENTATION |
|
|
|
|
|
|
|
|
|
MEMORY ALLOCATION |
|
|
|
|
The resize functions here perform a single memory allocation using |
|
|
|
|
malloc. To control the memory allocation, before the #include that |
|
|
|
@ -149,13 +159,13 @@ |
|
|
|
|
#ifndef STBIR_INCLUDE_STB_IMAGE_RESIZE_H |
|
|
|
|
#define STBIR_INCLUDE_STB_IMAGE_RESIZE_H |
|
|
|
|
|
|
|
|
|
typedef unsigned char stbir_uint8; |
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
|
|
|
typedef unsigned char stbir_uint8; |
|
|
|
|
typedef unsigned short stbir_uint16; |
|
|
|
|
typedef unsigned int stbir_uint32; |
|
|
|
|
#else |
|
|
|
|
#include <stdint.h> |
|
|
|
|
typedef uint8_t stbir_uint8; |
|
|
|
|
typedef uint16_t stbir_uint16; |
|
|
|
|
typedef uint32_t stbir_uint32; |
|
|
|
|
#endif |
|
|
|
|