Package org.lwjgl.stb

Class STBImageResize

java.lang.Object
org.lwjgl.stb.STBImageResize

public class STBImageResize extends 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:

  1. 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.)
  2. Artists should not edit premultiplied-alpha images; artists want non-premultiplied alpha images. Thus, art tools generally output non-premultiplied alpha images.
  3. You will get best results in most cases by converting images to premultiplied alpha before processing them mathematically.
  4. 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.
  5. 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 have alpha=0 do not contribute at all to output pixels unless all of the input pixels affecting that output pixel have alpha=0, in which case the result for that pixel is the same as it would be without FLAG_ALPHA_PREMULTIPLIED. However, this is only true for input images in integer formats. For input images in float format, input pixels with alpha=0 have no effect, and output pixels which have alpha=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.)
  6. 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
    Description
    static final int
    Set this flag if you have no alpha channel, or otherwise provide the index of the alpha channel.
    static final int
    Colorspace.
    static final int
    Colorspace.
    static final int
    Edge wrap mode.
    static final int
    Edge wrap mode.
    static final int
    Edge wrap mode.
    static final int
    Edge wrap mode.
    static final int
    Filters.
    static final int
    Filters.
    static final int
    Filters.
    static final int
    Filters.
    static final int
    Filters.
    static final int
    Filters.
    static final int
    Set this flag if your texture has premultiplied alpha.
    static final int
    The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations.
    static final int
    Data type.
    static final int
    Data type.
    static final int
    Data type.
    static final int
    Data type.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    nstbir_resize(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize
    static int
    nstbir_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)
    static int
    nstbir_resize_float(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
    Unsafe version of: resize_float
    static int
    nstbir_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)
    static int
    nstbir_resize_float_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_float_generic
    static int
    nstbir_resize_region(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_region
    static int
    nstbir_resize_subpixel(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_subpixel
    static int
    nstbir_resize_uint16_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_uint16_generic
    static int
    nstbir_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)
    static int
    nstbir_resize_uint8(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
    Unsafe version of: resize_uint8
    static int
    nstbir_resize_uint8_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_uint8_generic
    static int
    nstbir_resize_uint8_srgb(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags)
    Unsafe version of: resize_uint8_srgb
    static int
    nstbir_resize_uint8_srgb_edgemode(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
    Unsafe version of: resize_uint8_srgb_edgemode
    static boolean
    stbir_resize(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_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(FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
    Float version of resize_uint8.
    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(FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8_generic.
    static boolean
    stbir_resize_region(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize, using texture coordinates.
    static boolean
    stbir_resize_subpixel(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize.
    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(ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8_generic.
    static boolean
    stbir_resize_uint8(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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_uint8_generic(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8.
    static boolean
    stbir_resize_uint8_srgb(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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_srgb_edgemode(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 as resize_uint8_srgb, but adds the ability to specify how requests to sample off the edge of the image are handled.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • nstbir_resize_uint8

      public static int nstbir_resize_uint8(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Unsafe version of: resize_uint8
    • stbir_resize_uint8

      public static boolean stbir_resize_uint8(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 and input_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 data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_float

      public static int nstbir_resize_float(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Unsafe version of: resize_float
    • stbir_resize_float

      public static boolean stbir_resize_float(FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Float version of resize_uint8.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_uint8_srgb

      public static int nstbir_resize_uint8_srgb(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags)
      Unsafe version of: resize_uint8_srgb
    • stbir_resize_uint8_srgb

      public static boolean stbir_resize_uint8_srgb(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 and input_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 data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_uint8_srgb_edgemode

      public static int nstbir_resize_uint8_srgb_edgemode(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_uint8_srgb_edgemode
    • stbir_resize_uint8_srgb_edgemode

      public static boolean stbir_resize_uint8_srgb_edgemode(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 as resize_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 data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_wrap_mode - the edge wrap mode. One of:
      EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_uint8_generic

      public static int nstbir_resize_uint8_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_uint8_generic
    • stbir_resize_uint8_generic

      public static boolean stbir_resize_uint8_generic(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_wrap_mode - the edge wrap mode. One of:
      EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
      filter - the scale filter. One of:
      FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
      FILTER_MITCHELL
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_uint16_generic

      public static int nstbir_resize_uint16_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_uint16_generic
    • stbir_resize_uint16_generic

      public static boolean stbir_resize_uint16_generic(ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8_generic.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_wrap_mode - the edge wrap mode. One of:
      EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
      filter - the scale filter. One of:
      FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
      FILTER_MITCHELL
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_float_generic

      public static int nstbir_resize_float_generic(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_float_generic
    • stbir_resize_float_generic

      public static boolean stbir_resize_float_generic(FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8_generic.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_wrap_mode - the edge wrap mode. One of:
      EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
      filter - the scale filter. One of:
      FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
      FILTER_MITCHELL
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      Returns:
      1 on success, 0 on failure
    • nstbir_resize

      public static int nstbir_resize(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize
    • stbir_resize

      public static boolean stbir_resize(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize_uint8_generic.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      datatype - the image data type. One of:
      TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_mode_horizontal - the horizontal edge wrap mode
      edge_mode_vertical - the vertical edge wrap mode
      filter_horizontal - the horizontal scale filter
      filter_vertical - the vertical scale filter
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_subpixel

      public static int nstbir_resize_subpixel(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_subpixel
    • stbir_resize_subpixel

      public static boolean stbir_resize_subpixel(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      datatype - the image data type. One of:
      TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_mode_horizontal - the horizontal edge wrap mode
      edge_mode_vertical - the vertical edge wrap mode
      filter_horizontal - the horizontal scale filter
      filter_vertical - the vertical scale filter
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      x_scale - horizontal scale for subpixel correctness
      y_scale - vertical scale for subpixel correctness
      x_offset - horizontal offset for subpixel correctness
      y_offset - vertical offset for subpixel correctness
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_region

      public static int nstbir_resize_region(long input_pixels, int input_w, int input_h, int input_stride_in_bytes, long 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)
      Unsafe version of: resize_region
    • stbir_resize_region

      public static boolean stbir_resize_region(ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, 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 of resize, using texture coordinates.
      Parameters:
      input_pixels - the source image data
      input_w - the source image width
      input_h - the source image height
      input_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 memory
      output_pixels - returns the scaled image data
      output_w - the resized image width
      output_h - the resized image height
      output_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 memory
      datatype - the image data type. One of:
      TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
      num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
      alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
      flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
      FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
      edge_mode_horizontal - the horizontal edge wrap mode
      edge_mode_vertical - the vertical edge wrap mode
      filter_horizontal - the horizontal scale filter
      filter_vertical - the vertical scale filter
      space - the image colorspace. One of:
      COLORSPACE_LINEARCOLORSPACE_SRGB
      s0 - the left texture coordinate of the region to scale
      t0 - the top texture coordinate of the region to scale
      s1 - the right texture coordinate of the region to scale
      t1 - the bottom texture coordinate of the region to scale
      Returns:
      1 on success, 0 on failure
    • nstbir_resize_float

      public static int nstbir_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)
    • 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
    • nstbir_resize_uint16_generic

      public static int nstbir_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)
    • 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)
      Array version of: resize_uint16_generic
    • nstbir_resize_float_generic

      public static int nstbir_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)
    • 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)
      Array version of: resize_float_generic