Wiki Page Content

Differences between revisions 1 and 2
Revision 1 as of 2010-03-07 16:14:57
Size: 1970
Editor: SheenaSmith
Comment: create page, add content (Rev 5559)
Revision 2 as of 2010-08-09 00:14:04
Size: 3028
Editor: SheenaSmith
Comment: update content (old wiki)
Deletions are marked like this. Additions are marked like this.
Line 45: Line 45:
*<<BR>>No copy is made from the pixel data. A special undocumented [[SDL_Surface]] flag is set. The pixel data won't be deallocated automatically when [[SDL_FreeSurface]]() is invoked with the surface and it should not be freed until the surface has been freed. The data stored in '''pixels''' is assumed to have '''depth''' bits per pixel. '''pitch''' is the size of the scanline of the surface, in bytes (i.e. `widthInPixels*bytesPerPixel`). The scanline is the width of the image multiplied by bytes per pixel, plus any bytes added for alignment (that is if '''pixels''' points to the leftmost pixel on the first row of the surface, then '''pixels'''+'''pitch''' points to the leftmost pixel on the second row of the surface).

<<Color2(green,If the above text is to remain should words like scanline be formatted differently - like `scanline`?)>>

The pixel data is considered to be in software memory. If the pixel data lies in hardware memory (as pixel data from a hardware surface), the appropriate surface flag has to be set manually. <<BR>>*

DRAFT

SDL_CreateRGBSurfaceFrom

Use this function to allocate and free an RGB surface from pixels.

Syntax

SDL_Surface* SDL_CreateRGBSurfaceFrom (void*  pixels,
                                       int    width,
                                       int    height,
                                       int    depth,
                                       int    pitch,
                                       Uint32 Rmask,
                                       Uint32 Gmask,
                                       Uint32 Bmask,
                                       Uint32 Amask)

Function Parameters

pixels

a pointer to a set of pixels to use on the surface

width

the width of the surface

height

the height of the surface

depth

the depth of the surface in bits; see Remarks for details

pitch

the pitch of the pixels

Rmask

the red mask for the pixels

Gmask

the green mask for the pixels

Bmask

the blue mask for the pixels

Amask

the alpha mask for the pixels

Return Value

A pointer to an SDL_Surface to be created. If the function runs out of memory, it will return NULL.

Code Examples

You can add your code example here

Remarks

If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater than 8 bits, the pixel format is set using the flags '[RGB]mask'. green

*
No copy is made from the pixel data. A special undocumented SDL_Surface flag is set. The pixel data won't be deallocated automatically when SDL_FreeSurface() is invoked with the surface and it should not be freed until the surface has been freed. The data stored in pixels is assumed to have depth bits per pixel. pitch is the size of the scanline of the surface, in bytes (i.e. widthInPixels*bytesPerPixel). The scanline is the width of the image multiplied by bytes per pixel, plus any bytes added for alignment (that is if pixels points to the leftmost pixel on the first row of the surface, then pixels+pitch points to the leftmost pixel on the second row of the surface).

green

The pixel data is considered to be in software memory. If the pixel data lies in hardware memory (as pixel data from a hardware surface), the appropriate surface flag has to be set manually.
*


CategoryAPI, CategorySurface

None: SDL_CreateRGBSurfaceFrom (last edited 2016-10-20 20:40:54 by PhilippWiesemann)

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