|
Size: 1171
Comment: create page, add content
|
Size: 1328
Comment: correct typo
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 18: | Line 18: |
| ||'''rect'''||a pointer to the [[SDL_Rect]] to read, or NULL for the entire render target|| ||'''format'''||the desired format of the pixel data, or 0 to use the format of the rendering target|| ||'''pixels'''||a pointer to be filled in with the pixel data|| ||'''pitch'''||the pitch of the pixels parameter|| |
||'''rect'''||an [[SDL_Rect]] structure representing the area to read, or NULL for the entire render target|| ||'''format'''||the desired format of the pixel data, or 0 to use the format of the rendering target; see [[#format|Remarks]] for details|| ||'''pixels'''||a pointer filled in with the pixel data|| ||'''pitch'''||the pitch of the '''pixels''' parameter|| |
| Line 24: | Line 24: |
| Returns 0 on success or -1 if pixel reading is not supported; call [[SDL_GetError]]() for more information. | Returns 0 on success or a negative error code on failure; call [[SDL_GetError]]() for more information. |
| Line 34: | Line 34: |
| == Related Functions == .[[SDL_RenderWritePixels]]??? |
<<Anchor(format)>> '''format''' can be one of these values: <<Include(SDL_PixelFormatEnum, , , from="=== Pixel Format Values ===", to="== Code Examples ==")>> |
SDL_RenderReadPixels
Use this function to read pixels from the current rendering target.
Syntax
int SDL_RenderReadPixels(const SDL_Rect* rect,
Uint32 format,
void* pixels,
int pitch)
Function Parameters
rect |
an SDL_Rect structure representing the area to read, or NULL for the entire render target |
format |
the desired format of the pixel data, or 0 to use the format of the rendering target; see Remarks for details |
pixels |
a pointer filled in with the pixel data |
pitch |
the pitch of the pixels parameter |
Return Value
Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.
Code Examples
You can add your code example here
Remarks
WARNING: This is a very slow operation, and should not be used frequently.
format can be one of these values:
SDL_PIXELFORMAT_UNKNOWN |
|
SDL_PIXELFORMAT_INDEX1LSB |
|
SDL_PIXELFORMAT_INDEX1MSB |
|
SDL_PIXELFORMAT_INDEX4LSB |
|
SDL_PIXELFORMAT_INDEX4MSB |
|
SDL_PIXELFORMAT_INDEX8 |
|
SDL_PIXELFORMAT_RGB332 |
|
SDL_PIXELFORMAT_RGB444 |
|
SDL_PIXELFORMAT_RGB555 |
|
SDL_PIXELFORMAT_BGR555 |
|
SDL_PIXELFORMAT_ARGB4444 |
|
SDL_PIXELFORMAT_RGBA4444 |
|
SDL_PIXELFORMAT_ABGR4444 |
|
SDL_PIXELFORMAT_BGRA4444 |
|
SDL_PIXELFORMAT_ARGB1555 |
|
SDL_PIXELFORMAT_RGBA5551 |
|
SDL_PIXELFORMAT_ABGR1555 |
|
SDL_PIXELFORMAT_BGRA5551 |
|
SDL_PIXELFORMAT_RGB565 |
|
SDL_PIXELFORMAT_BGR565 |
|
SDL_PIXELFORMAT_RGB24 |
|
SDL_PIXELFORMAT_BGR24 |
|
SDL_PIXELFORMAT_RGB888 |
|
SDL_PIXELFORMAT_RGBX8888 |
|
SDL_PIXELFORMAT_BGR888 |
|
SDL_PIXELFORMAT_BGRX8888 |
|
SDL_PIXELFORMAT_ARGB8888 |
|
SDL_PIXELFORMAT_RGBA8888 |
|
SDL_PIXELFORMAT_ABGR8888 |
|
SDL_PIXELFORMAT_BGRA8888 |
|
SDL_PIXELFORMAT_ARGB2101010 |
|
SDL_PIXELFORMAT_RGBA32 |
alias for RGBA byte array of color data, for the current platform (>= SDL 2.0.5) |
SDL_PIXELFORMAT_ARGB32 |
alias for ARGB byte array of color data, for the current platform (>= SDL 2.0.5) |
SDL_PIXELFORMAT_BGRA32 |
alias for BGRA byte array of color data, for the current platform (>= SDL 2.0.5) |
SDL_PIXELFORMAT_ABGR32 |
alias for ABGR byte array of color data, for the current platform (>= SDL 2.0.5) |
SDL_PIXELFORMAT_YV12 |
planar mode: Y + V + U (3 planes) |
SDL_PIXELFORMAT_IYUV |
planar mode: Y + U + V (3 planes) |
SDL_PIXELFORMAT_YUY2 |
packed mode: Y0+U0+Y1+V0 (1 plane) |
SDL_PIXELFORMAT_UYVY |
packed mode: U0+Y0+V0+Y1 (1 plane) |
SDL_PIXELFORMAT_YVYU |
packed mode: Y0+V0+Y1+U0 (1 plane) |
SDL_PIXELFORMAT_NV12 |
planar mode: Y + U/V interleaved (2 planes) (>= SDL 2.0.4) |
SDL_PIXELFORMAT_NV21 |
planar mode: Y + V/U interleaved (2 planes) (>= SDL 2.0.4) |
