LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.75k stars 635 forks source link

Flags in STBImageResize are incorrect #857

Closed theagentd closed 1 year ago

theagentd commented 1 year ago

Version

3.3.2 (nightly)

Platform

Linux x64, Linux arm64, Linux arm32, macOS x64, macOS arm64, Windows x64, Windows x86, Windows arm64

JDK

Zulu 17, but irrelevant

Module

stb

Bug description

The flags defined in STBImageResize are incorrect.

    /**
     * Set this flag if your texture has premultiplied alpha. Otherwise, stbir will use alpha-weighted resampling (effectively premultiplying, resampling,
     * then unpremultiplying).
     */
    public static final int STBIR_FLAG_ALPHA_PREMULTIPLIED = -1;

    /** The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations. */
    public static final int STBIR_FLAG_ALPHA_USES_COLORSPACE = -1;

Flags in stb_image_resize.h:

// Set this flag if your texture has premultiplied alpha. Otherwise, stbir will
// use alpha-weighted resampling (effectively premultiplying, resampling,
// then unpremultiplying).
#define STBIR_FLAG_ALPHA_PREMULTIPLIED    (1 << 0)
// The specified alpha channel should be handled as gamma-corrected value even
// when doing sRGB operations.
#define STBIR_FLAG_ALPHA_USES_COLORSPACE  (1 << 1)

Stacktrace or crash log output

No response

Spasi commented 1 year ago

Hey @theagentd,

LWJGL 3.2.2-snapshot+9 is now available and includes this fix.

theagentd commented 1 year ago

Thank you very much! :)