sdlUpdateNvTexture function

bool sdlUpdateNvTexture(
  1. Pointer<SdlTexture> texture,
  2. Pointer<SdlRect> rect,
  3. Pointer<Uint8> yplane,
  4. int ypitch,
  5. Pointer<Uint8> uVplane,
  6. int uVpitch,
)

Update a rectangle within a planar NV12 or NV21 texture with new pixels.

You can use SDL_UpdateTexture() as long as your pixel data is a contiguous block of NV12/21 planes in the proper order, but this function is available if your pixel data is not contiguous.

\param texture the texture to update. \param rect a pointer to the rectangle of pixels to update, or NULL to update the entire texture. \param Yplane the raw pixel data for the Y plane. \param Ypitch the number of bytes between rows of pixel data for the Y plane. \param UVplane the raw pixel data for the UV plane. \param UVpitch the number of bytes between rows of pixel data for the UV plane. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_UpdateTexture \sa SDL_UpdateYUVTexture

extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)

Implementation

bool sdlUpdateNvTexture(Pointer<SdlTexture> texture, Pointer<SdlRect> rect,
    Pointer<Uint8> yplane, int ypitch, Pointer<Uint8> uVplane, int uVpitch) {
  final sdlUpdateNvTextureLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlTexture> texture,
          Pointer<SdlRect> rect,
          Pointer<Uint8> yplane,
          Int32 ypitch,
          Pointer<Uint8> uVplane,
          Int32 uVpitch),
      int Function(
          Pointer<SdlTexture> texture,
          Pointer<SdlRect> rect,
          Pointer<Uint8> yplane,
          int ypitch,
          Pointer<Uint8> uVplane,
          int uVpitch)>('SDL_UpdateNVTexture');
  return sdlUpdateNvTextureLookupFunction(
          texture, rect, yplane, ypitch, uVplane, uVpitch) ==
      1;
}