logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_PremultiplyAlpha - Premultiply the alpha on a block of pixels.

Availability

       This function is available since SDL 3.2.0.

Simple Directmedia Layer                           SDL 3.2.20                            SDL_PremultiplyAlpha(3)

Description

       This is safe to use with src == dst, but not for other overlapping areas.

Function Parameters

width  the width of the block to convert, in pixels.

       height the height of the block to convert, in pixels.

       src_format
              an SDL_PixelFormat value of the src pixels format.

       src    a pointer to the source pixels.

       src_pitch
              the pitch of the source pixels, in bytes.

       dst_format
              an SDL_PixelFormat value of the dst pixels format.

       dst    a pointer to be filled in with premultiplied pixel data.

       dst_pitch
              the pitch of the destination pixels, in bytes.

       linear true to convert from sRGB to linear space for the alpha multiplication, false to do multiplication
              in sRGB space.

Name

       SDL_PremultiplyAlpha - Premultiply the alpha on a block of pixels.

Return Value

       for more information.

Synopsis

#include<SDL3/SDL_surface.h>boolSDL_PremultiplyAlpha(intwidth,intheight,SDL_PixelFormatsrc_format,constvoid*src,intsrc_pitch,SDL_PixelFormatdst_format,void*dst,intdst_pitch,boollinear);

Thread Safety

       The  same  destination  pixels  should  not  be used from two threads at once. It is safe to use the same
       source pixels from multiple threads.

See Also