pub unsafe extern "C" fn SDL_UpdateYUVTexture(
    texture: *mut SDL_Texture,
    rect: *const SDL_Rect,
    Yplane: *const u8,
    Ypitch: c_int,
    Uplane: *const u8,
    Upitch: c_int,
    Vplane: *const u8,
    Vpitch: c_int
) -> c_int
Expand description

Update a rectangle within a planar YV12 or IYUV texture with new pixel data.

  • texture The texture to update
  • rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  • Yplane The raw pixel data for the Y plane.
  • Ypitch The number of bytes between rows of pixel data for the Y plane.
  • Uplane The raw pixel data for the U plane.
  • Upitch The number of bytes between rows of pixel data for the U plane.
  • Vplane The raw pixel data for the V plane.
  • Vpitch The number of bytes between rows of pixel data for the V plane.

Returns: 0 on success, or -1 if the texture is not valid.

You can use SDL_UpdateTexture as long as your pixel data is a contiguous block of Y and U/V planes in the proper order, but this function is available if your pixel data is not contiguous.