sdlPremultiplyAlpha function

int sdlPremultiplyAlpha(
  1. int width,
  2. int height,
  3. int srcFormat,
  4. Pointer<NativeType> src,
  5. int srcPitch,
  6. int dstFormat,
  7. Pointer<NativeType> dst,
  8. int dstPitch,
)

Premultiply the alpha on a block of pixels.

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

This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.

\param width the width of the block to convert, in pixels \param height the height of the block to convert, in pixels \param src_format an SDL_PixelFormatEnum value of the src pixels format \param src a pointer to the source pixels \param src_pitch the pitch of the source pixels, in bytes \param dst_format an SDL_PixelFormatEnum value of the dst pixels format \param dst a pointer to be filled in with premultiplied pixel data \param dst_pitch the pitch of the destination pixels, in bytes \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.18.

extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, Uint32 src_format, const void * src, int src_pitch, Uint32 dst_format, void * dst, int dst_pitch)

Implementation

int sdlPremultiplyAlpha(
    int width,
    int height,
    int srcFormat,
    Pointer<NativeType> src,
    int srcPitch,
    int dstFormat,
    Pointer<NativeType> dst,
    int dstPitch) {
  final sdlPremultiplyAlphaLookupFunction = libSdl2.lookupFunction<
      Int32 Function(
          Int32 width,
          Int32 height,
          Uint32 srcFormat,
          Pointer<NativeType> src,
          Int32 srcPitch,
          Uint32 dstFormat,
          Pointer<NativeType> dst,
          Int32 dstPitch),
      int Function(
          int width,
          int height,
          int srcFormat,
          Pointer<NativeType> src,
          int srcPitch,
          int dstFormat,
          Pointer<NativeType> dst,
          int dstPitch)>('SDL_PremultiplyAlpha');
  return sdlPremultiplyAlphaLookupFunction(
      width, height, srcFormat, src, srcPitch, dstFormat, dst, dstPitch);
}