sdlConvertPixelsAndColorspace function

bool sdlConvertPixelsAndColorspace(
  1. int width,
  2. int height,
  3. int srcFormat,
  4. int srcColorspace,
  5. int srcProperties,
  6. Pointer<NativeType> src,
  7. int srcPitch,
  8. int dstFormat,
  9. int dstColorspace,
  10. int dstProperties,
  11. Pointer<NativeType> dst,
  12. int dstPitch,
)

Copy a block of pixels of one format and colorspace to another format and colorspace.

\param width the width of the block to copy, in pixels. \param height the height of the block to copy, in pixels. \param src_format an SDL_PixelFormat value of the src pixels format. \param src_colorspace an SDL_Colorspace value describing the colorspace of the src pixels. \param src_properties an SDL_PropertiesID with additional source color properties, or 0. \param src a pointer to the source pixels. \param src_pitch the pitch of the source pixels, in bytes. \param dst_format an SDL_PixelFormat value of the dst pixels format. \param dst_colorspace an SDL_Colorspace value describing the colorspace of the dst pixels. \param dst_properties an SDL_PropertiesID with additional destination color properties, or 0. \param dst a pointer to be filled in with new pixel data. \param dst_pitch the pitch of the destination pixels, in bytes. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_ConvertPixels

extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch)

Implementation

bool sdlConvertPixelsAndColorspace(
    int width,
    int height,
    int srcFormat,
    int srcColorspace,
    int srcProperties,
    Pointer<NativeType> src,
    int srcPitch,
    int dstFormat,
    int dstColorspace,
    int dstProperties,
    Pointer<NativeType> dst,
    int dstPitch) {
  final sdlConvertPixelsAndColorspaceLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Int32 width,
          Int32 height,
          Int32 srcFormat,
          Int32 srcColorspace,
          Uint32 srcProperties,
          Pointer<NativeType> src,
          Int32 srcPitch,
          Int32 dstFormat,
          Int32 dstColorspace,
          Uint32 dstProperties,
          Pointer<NativeType> dst,
          Int32 dstPitch),
      int Function(
          int width,
          int height,
          int srcFormat,
          int srcColorspace,
          int srcProperties,
          Pointer<NativeType> src,
          int srcPitch,
          int dstFormat,
          int dstColorspace,
          int dstProperties,
          Pointer<NativeType> dst,
          int dstPitch)>('SDL_ConvertPixelsAndColorspace');
  return sdlConvertPixelsAndColorspaceLookupFunction(
          width,
          height,
          srcFormat,
          srcColorspace,
          srcProperties,
          src,
          srcPitch,
          dstFormat,
          dstColorspace,
          dstProperties,
          dst,
          dstPitch) ==
      1;
}