Wiki Page Content

Differences between revisions 13 and 14
Revision 13 as of 2013-09-01 19:13:58
Size: 1479
Comment: Changed code example to be more C.
Revision 14 as of 2014-07-04 10:07:18
Size: 1447
Comment: Removed link to SDL_QueryTexturePixels which is not in SDL 2.
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
                     Uint32* format,                       Uint32* format,
Line 14: Line 14:
                     int* w,                       int* w,
Line 46: Line 46:
 .[[SDL_QueryTexturePixels]]

SDL_QueryTexture

Use this function to query the attributes of a texture.

Syntax

int SDL_QueryTexture(SDL_Texture* texture,
                     Uint32*      format,
                     int*         access,
                     int*         w,
                     int*         h)

Function Parameters

texture

the texture to query

format

a pointer filled in with the raw format of the texture; the actual format may differ, but pixel transfers will use this format; see Remarks for details

access

a pointer filled in with the actual access to the texture

w

a pointer filled in with the width of the texture in pixels

h

a pointer filled in with the height of the texture in pixels

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

Code Examples

SDL_Texture* source;

// loading etc ...

int w, h;
SDL_QueryTexture(source, NULL, NULL, &w, &h);

Remarks

format may be one of the following:

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)


CategoryAPI, CategoryRender

None: SDL_QueryTexture (last edited 2014-09-22 17:22:05 by PhilippWiesemann)

Feedback
Please include your contact information if you'd like to receive a reply.
Submit