Package org.lwjgl.stb
Class STBImageResize
- java.lang.Object
-
- org.lwjgl.stb.STBImageResize
-
public class STBImageResize extends java.lang.Object
Native bindings to stb_image_resize.h from the stb library.Written with emphasis on usability, portability, and efficiency. (No SIMD or threads, so it be easily outperformed by libs that use those.) Only scaling and translation is supported, no rotations or shears. Easy API downsamples w/Mitchell filter, upsamples w/cubic interpolation.
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
ALPHA CHANNEL
Most of the resizing functions provide the ability to control how the alpha channel of an image is processed. The important things to know about this:
- The best mathematically-behaved version of alpha to use is called "premultiplied alpha", in which the other color channels have had the alpha value multiplied in. If you use premultiplied alpha, linear filtering (such as image resampling done by this library, or performed in texture units on GPUs) does the "right thing". While premultiplied alpha is standard in the movie CGI industry, it is still uncommon in the videogame/real-time world. If you linearly filter non-premultiplied alpha, strange effects occur. (For example, the average of 1% opaque bright green and 99% opaque black produces 50% transparent dark green when non-premultiplied, whereas premultiplied it produces 50% transparent near-black. The former introduces green energy that doesn't exist in the source image.)
- Artists should not edit premultiplied-alpha images; artists want non-premultiplied alpha images. Thus, art tools generally output non-premultiplied alpha images.
- You will get best results in most cases by converting images to premultiplied alpha before processing them mathematically.
- If you pass the flag
FLAG_ALPHA_PREMULTIPLIED
, the resizer does not do anything special for the alpha channel; it is resampled identically to other channels. This produces the correct results for premultiplied-alpha images, but produces less-than-ideal results for non-premultiplied-alpha images. - If you do not pass the flag
FLAG_ALPHA_PREMULTIPLIED
, then the resizer weights the contribution of input pixels based on their alpha values, or, equivalently, it multiplies the alpha value into the color channels, resamples, then divides by the resultant alpha value. Input pixels which havealpha=0
do not contribute at all to output pixels unless all of the input pixels affecting that output pixel havealpha=0
, in which case the result for that pixel is the same as it would be withoutFLAG_ALPHA_PREMULTIPLIED
. However, this is only true for input images in integer formats. For input images in float format, input pixels withalpha=0
have no effect, and output pixels which havealpha=0
will be 0 in all channels. (For float images, you can manually achieve the same result by adding a tiny epsilon value to the alpha channel of every image, and then subtracting or clamping it at the end.) - You can separately control whether the alpha channel is interpreted as linear or affected by the colorspace. By default it is linear; you almost never want to apply the colorspace. (For example, graphics hardware does not apply sRGB conversion to the alpha channel.)
-
-
Field Summary
Fields Modifier and Type Field and Description static int
STBIR_ALPHA_CHANNEL_NONE
Set this flag if you have no alpha channel, or otherwise provide the index of the alpha channel.static int
STBIR_COLORSPACE_LINEAR
STBIR_COLORSPACE_SRGBColorspace.static int
STBIR_EDGE_CLAMP
STBIR_EDGE_REFLECT
STBIR_EDGE_WRAP
STBIR_EDGE_ZEROEdge wrap mode.static int
STBIR_FILTER_BOX
STBIR_FILTER_CATMULLROM
STBIR_FILTER_CUBICBSPLINE
STBIR_FILTER_DEFAULT
STBIR_FILTER_MITCHELL
STBIR_FILTER_TRIANGLEFilters.static int
STBIR_FLAG_ALPHA_PREMULTIPLIED
Set this flag if your texture has premultiplied alpha.static int
STBIR_FLAG_ALPHA_USES_COLORSPACE
The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations.static int
STBIR_TYPE_FLOAT
STBIR_TYPE_UINT16
STBIR_TYPE_UINT32
STBIR_TYPE_UINT8Data type.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static boolean
stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Array version of:resize_float_generic
static boolean
stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Array version of:resize_float_generic
static boolean
stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Float version ofresize_uint8_generic
.static boolean
stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Float version ofresize_uint8_generic
.static boolean
stbir_resize_float(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Array version of:resize_float
static boolean
stbir_resize_float(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Float version ofresize_uint8
.static boolean
stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float s0, float t0, float s1, float t1)
Region version ofresize
, using texture coordinates.static boolean
stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float s0, float t0, float s1, float t1)
Region version ofresize
, using texture coordinates.static boolean
stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float x_scale, float y_scale, float x_offset, float y_offset)
Subpixel version ofresize
.static boolean
stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float x_scale, float y_scale, float x_offset, float y_offset)
Subpixel version ofresize
.static boolean
stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Array version of:resize_uint16_generic
static boolean
stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Array version of:resize_uint16_generic
static boolean
stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Short version ofresize_uint8_generic
.static boolean
stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Short version ofresize_uint8_generic
.static boolean
stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Medium-complexity version ofresize_uint8
.static boolean
stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Medium-complexity version ofresize_uint8
.static boolean
stbir_resize_uint8_srgb_edgemode(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode)
Same asresize_uint8_srgb
, but adds the ability to specify how requests to sample off the edge of the image are handled.static boolean
stbir_resize_uint8_srgb(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags)
Easy-to-use API for resizing images.static boolean
stbir_resize_uint8(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Easy-to-use API for resizing images.static boolean
stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space)
Full-complexity version ofresize_uint8_generic
.static boolean
stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context)
Full-complexity version ofresize_uint8_generic
.
-
-
-
Field Detail
-
STBIR_ALPHA_CHANNEL_NONE
Set this flag if you have no alpha channel, or otherwise provide the index of the alpha channel.
-
STBIR_FLAG_ALPHA_PREMULTIPLIED
Set this flag if your texture has premultiplied alpha. Otherwise, stbir will use alpha-weighted resampling (effectively premultiplying, resampling, then unpremultiplying).
-
STBIR_FLAG_ALPHA_USES_COLORSPACE
The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations.
-
STBIR_EDGE_CLAMP, STBIR_EDGE_REFLECT, STBIR_EDGE_WRAP, STBIR_EDGE_ZERO
Edge wrap mode.Enum values:
-
STBIR_FILTER_DEFAULT, STBIR_FILTER_BOX, STBIR_FILTER_TRIANGLE, STBIR_FILTER_CUBICBSPLINE, STBIR_FILTER_CATMULLROM, STBIR_FILTER_MITCHELL
Filters.Enum values:
FILTER_DEFAULT
- Use same filter type that easy-to-use API chooses.FILTER_BOX
- A trapezoid w/1-pixel wide ramps, same result as box for integer scale ratios.FILTER_TRIANGLE
- On upsampling, produces same results as bilinear texture filtering.FILTER_CUBICBSPLINE
- The cubic b-spline (aka Mitchell-Netrevalli with B=1,C=0), gaussian-esque.FILTER_CATMULLROM
- An interpolating cubic spline.FILTER_MITCHELL
- Mitchell-Netrevalli filter with B=1/3, C=1/3.
-
STBIR_COLORSPACE_LINEAR, STBIR_COLORSPACE_SRGB
Colorspace.Enum values:
-
STBIR_TYPE_UINT8, STBIR_TYPE_UINT16, STBIR_TYPE_UINT32, STBIR_TYPE_FLOAT
Data type.Enum values:
-
-
Method Detail
-
stbir_resize_uint8
public static boolean stbir_resize_uint8(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Easy-to-use API for resizing images.- The colorspace is linear.
- The alpha channel is treated identically to other channels.
- Memory required grows approximately linearly with input and output size, but with discontinuities at
input_w == output_w
andinput_h == output_h
.
This function uses the default resampling filter defined at compile time. For a different filter, use the medium-complexity API.
- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)- Returns:
- 1 on success, 0 on failure
-
stbir_resize_float
public static boolean stbir_resize_float(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Float version ofresize_uint8
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint8_srgb
public static boolean stbir_resize_uint8_srgb(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags)
Easy-to-use API for resizing images.- The image data is interpreted as gamma-corrected sRGB.
- Memory required grows approximately linearly with input and output size, but with discontinuities at
input_w == output_w
andinput_h == output_h
.
This function uses the default resampling filter defined at compile time. For a different filter, use the medium-complexity API.
- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint8_srgb_edgemode
public static boolean stbir_resize_uint8_srgb_edgemode(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode)
Same asresize_uint8_srgb
, but adds the ability to specify how requests to sample off the edge of the image are handled.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint8_generic
public static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Medium-complexity version ofresize_uint8
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation context- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint8_generic
public static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Medium-complexity version ofresize_uint8
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint16_generic
public static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Short version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation context- Returns:
- 1 on success, 0 on failure
-
stbir_resize_uint16_generic
public static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Short version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
- Returns:
- 1 on success, 0 on failure
-
stbir_resize_float_generic
public static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
Float version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation context- Returns:
- 1 on success, 0 on failure
-
stbir_resize_float_generic
public static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Float version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorynum_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_wrap_mode
- the edge wrap mode. One of:EDGE_CLAMP
EDGE_REFLECT
EDGE_WRAP
EDGE_ZERO
filter
- the scale filter. One of:FILTER_DEFAULT
FILTER_BOX
FILTER_TRIANGLE
FILTER_CUBICBSPLINE
FILTER_CATMULLROM
FILTER_MITCHELL
space
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
- Returns:
- 1 on success, 0 on failure
-
stbir_resize
public static boolean stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context)
Full-complexity version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation context- Returns:
- 1 on success, 0 on failure
-
stbir_resize
public static boolean stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space)
Full-complexity version ofresize_uint8_generic
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
- Returns:
- 1 on success, 0 on failure
-
stbir_resize_subpixel
public static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float x_scale, float y_scale, float x_offset, float y_offset)
Subpixel version ofresize
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation contextx_scale
- horizontal scale for subpixel correctnessy_scale
- vertical scale for subpixel correctnessx_offset
- horizontal offset for subpixel correctnessy_offset
- vertical offset for subpixel correctness- Returns:
- 1 on success, 0 on failure
-
stbir_resize_subpixel
public static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float x_scale, float y_scale, float x_offset, float y_offset)
Subpixel version ofresize
.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
x_scale
- horizontal scale for subpixel correctnessy_scale
- vertical scale for subpixel correctnessx_offset
- horizontal offset for subpixel correctnessy_offset
- vertical offset for subpixel correctness- Returns:
- 1 on success, 0 on failure
-
stbir_resize_region
public static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float s0, float t0, float s1, float t1)
Region version ofresize
, using texture coordinates.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
alloc_context
- pointer to the allocation contexts0
- the left texture coordinate of the region to scalet0
- the top texture coordinate of the region to scales1
- the right texture coordinate of the region to scalet1
- the bottom texture coordinate of the region to scale- Returns:
- 1 on success, 0 on failure
-
stbir_resize_region
public static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float s0, float t0, float s1, float t1)
Region version ofresize
, using texture coordinates.- Parameters:
input_pixels
- the source image datainput_w
- the source image widthinput_h
- the source image heightinput_stride_in_bytes
- the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memoryoutput_pixels
- returns the scaled image dataoutput_w
- the resized image widthoutput_h
- the resized image heightoutput_stride_in_bytes
- the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memorydatatype
- the image data type. One of:TYPE_UINT8
TYPE_UINT16
TYPE_UINT32
TYPE_FLOAT
num_channels
- the number of channels in the image (e.g. RGB=3, RGBA=4)alpha_channel
- the alpha channel index, orALPHA_CHANNEL_NONE
if there is no alpha channelflags
- the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:FLAG_ALPHA_PREMULTIPLIED
FLAG_ALPHA_USES_COLORSPACE
edge_mode_horizontal
- the horizontal edge wrap modeedge_mode_vertical
- the vertical edge wrap modefilter_horizontal
- the horizontal scale filterfilter_vertical
- the vertical scale filterspace
- the image colorspace. One of:COLORSPACE_LINEAR
COLORSPACE_SRGB
s0
- the left texture coordinate of the region to scalet0
- the top texture coordinate of the region to scales1
- the right texture coordinate of the region to scalet1
- the bottom texture coordinate of the region to scale- Returns:
- 1 on success, 0 on failure
-
stbir_resize_float
public static boolean stbir_resize_float(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
Array version of:resize_float
-
stbir_resize_uint16_generic
public static boolean stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context) public static boolean stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Array version of:resize_uint16_generic
-
stbir_resize_float_generic
public static boolean stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context) public static boolean stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
Array version of:resize_float_generic
-
-