Surface
Core class
Operations
- New
- Blit
- BlitScaled
- Convert
- ConvertFormat
- CreateTexture
- Duplicate
- FillRect
- Free
- GetAlphaMod
- GetBlendMode
- GetClipRect
- GetColorKey
- GetColorMod
- GetH
- GetPitch
- GetPixelFormat
- GetPixels
- GetW
- IsNull
- LoadBMP
- Lock
- LowerBlit
- LowerBlitScaled
- Rotate90Degrees
- RotoZoom
- RotoZoomSize
- RotoZoomSizeXY
- RotoZoomXY
- SaveBMP
- SetAlphaMod
- SetBlendMode
- SetClipRect
- SetColorKey
- SetColorMod
- SetRLE
- Shrink
- Unlock
- Zoom
- ZoomSize
Blit
Perform a fast surface copy to a destination surface
method : public : Blit(srcrect:Rect, dst:Surface, dstrect:Rect) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| srcrect | Rect | the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
| dst | Surface | the SDL_Surface structure that is the blit target |
| dstrect | Rect | the SDL_Rect structure representing the rectangle that is copied into |
Return
| Type | Description |
|---|---|
| Int | 0 if the blit is successful or a negative error code on failure |
BlitScaled
Scaled surface copy to a destination surface
method : public : BlitScaled(srcrect:Rect, dst:Surface, dstrect:Rect) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| srcrect | Rect | the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
| dst | Surface | the SDL_Surface structure that is the blit target |
| dstrect | Rect | the SDL_Rect structure representing the rectangle that is copied into |
Return
| Type | Description |
|---|---|
| Int | 0 if the blit is successful or a negative error code on failure |
Convert
Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format
method : public : Convert(fmt:PixelFormat, flags:Int) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| fmt | PixelFormat | PixelFormat structure that the new surface is optimized for |
| flags | Int | flags are unused and should be set to 0 |
Return
| Type | Description |
|---|---|
| Surface | new SDL_Surface structure that is created |
ConvertFormat
Copy an existing surface to a new surface of the specified format
method : public : ConvertFormat(format:Int, flags:Int) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| format | Int | one of the enumerated values in SDL_PixelFormatEnum; see Remarks for details |
| flags | Int | the flags are unused and should be set to 0 |
Return
| Type | Description |
|---|---|
| Surface | the new surface |
CreateTexture
Create a texture from an existing surface
method : public : CreateTexture(renderer:Renderer) ~ TextureParameters
| Name | Type | Description |
|---|---|---|
| renderer | Renderer | the rendering context |
Return
| Type | Description |
|---|---|
| Texture | newly created texture |
Duplicate
Creates a new surface identical to the existing surface
method : public : Duplicate() ~ SurfaceReturn
| Type | Description |
|---|---|
| Surface | a copy of the surface, or NULL on failure |
FillRect
perform a fast fill of a rectangle with a specific color
method : public : FillRect(rect:Rect, color:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| rect | Rect | Rect structure representing the rectangle to fill, or Nil to fill the entire surface |
| color | Int | color to fill with |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetAlphaMod
Get the additional alpha value used in blit operations
method : public : GetAlphaMod(alpha:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| alpha | IntRef | holder filled in with the current alpha value |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetBlendMode
get the blend mode used for blit operations
method : public : GetBlendMode(blendMode:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| blendMode | IntRef | pointer filled in with the current BlendMode |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetClipRect
Get the clipping rectangle for a surface
method : public : GetClipRect(rect:Rect) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rect | Rect | Rect filled in with the clipping rectangle for the surface |
GetColorKey
Get the color key (transparent pixel) for a surface
method : public : GetColorKey(key:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| key | IntRef | a holder filled in with the transparent pixel |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetColorMod
Get the additional color value multiplied into blit operations
method : public : GetColorMod(r:IntRef, g:IntRef, b:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| r | IntRef | pointer filled in with the current red color value |
| g | IntRef | pointer filled in with the current green color value |
| b | IntRef | pointer filled in with the current blue color value |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetPitch
Get length of a row of pixels in bytes
method : public : GetPitch() ~ IntReturn
| Type | Description |
|---|---|
| Int | pitch |
GetPixelFormat
Get pixel format
method : public : GetPixelFormat() ~ PixelFormatReturn
| Type | Description |
|---|---|
| PixelFormat | pixel format |
GetPixels
Get raw pixels
method : public : GetPixels() ~ PixelDataReturn
| Type | Description |
|---|---|
| PixelData | raw pixels |
IsNull
Determines if the underlying SDL C-struct is NULL
method : public : IsNull() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if NULL, false otherwise |
LoadBMP
Load a surface from a BMP file.
function : LoadBMP(file:String) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| file | String | the file containing a BMP image |
Return
| Type | Description |
|---|---|
| Surface | newly created texture |
LowerBlit
Perform low-level surface blitting only
method : public : LowerBlit(srcrect:Rect, dst:Surface, dstrect:Rect) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| srcrect | Rect | the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
| dst | Surface | the SDL_Surface structure that is the blit target |
| dstrect | Rect | the SDL_Rect structure representing the rectangle that is copied into |
Return
| Type | Description |
|---|---|
| Int | 0 if the blit is successful or a negative error code on failure |
LowerBlitScaled
Perform low-level surface scaled blitting only
method : public : LowerBlitScaled(srcrect:Rect, dst:Surface, dstrect:Rect) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| srcrect | Rect | the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surface |
| dst | Surface | the SDL_Surface structure that is the blit target |
| dstrect | Rect | the SDL_Rect structure representing the rectangle that is copied into |
Return
| Type | Description |
|---|---|
| Int | 0 if the blit is successful or a negative error code on failure |
New
Creates new RGB surface
New(flags:Int, width:Int, height:Int, depth:Int, Rmask:Int, Gmask:Int, Bmask:Int, Amask:Int)Parameters
| Name | Type | Description |
|---|---|---|
| flags | Int | the flags are unused and should be set to 0 |
| width | Int | the width of the surface |
| height | Int | the height of the surface |
| depth | Int | the depth of the surface in bits; see Remarks for details |
| Rmask | Int | the red mask for the pixels |
| Gmask | Int | the green mask for the pixels |
| Bmask | Int | the blue mask for the pixels |
| Amask | Int | the alpha mask for the pixels |
New
Creates new RGB surface
New(flags:Int, width:Int, height:Int, depth:Int, format:Int)Parameters
| Name | Type | Description |
|---|---|---|
| flags | Int | the flags are unused and should be set to 0 |
| width | Int | the width of the surface |
| height | Int | the height of the surface |
| depth | Int | the depth of the surface in bits; see Remarks for details |
| format | Int | the PixelFormatValue for the new surface's pixel format |
Rotate90Degrees
Rotates a 8/16/24/32 bit surface in increments of 90 degrees.
method : public : Rotate90Degrees(numClockwiseTurns:Int) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| numClockwiseTurns | Int | Number of clockwise 90 degree turns to apply to the source. |
Return
| Type | Description |
|---|---|
| Surface | newly modified surface |
RotoZoom
Rotates and zooms a surface and optional anti-aliasing.
method : public : RotoZoom(angle:Float, zoom:Float, smooth:Bool) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| angle | Float | The angle to rotate in degrees. |
| zoom | Float | The scaling factor. |
| smooth | Bool | Antialiasing flag; set to true to enable. |
Return
| Type | Description |
|---|---|
| Surface | newly modified surface |
RotoZoomSize
Returns the size of the resulting target surface for a RotoZoom() call.
function : RotoZoomSize(width:Int, height:Int, angle:Float, zoom:Float, dstwidth:IntRef, dstheight:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| width | Int | The source surface width. |
| height | Int | The source surface height. |
| angle | Float | The angle to rotate in degrees. |
| zoom | Float | The scaling factor. |
| dstwidth | IntRef | The calculated width of the rotozoomed destination surface. |
| dstheight | IntRef | The calculated height of the rotozoomed destination surface. |
RotoZoomSizeXY
Returns the size of the resulting target surface for a RotoZoomXY() call.
function : RotoZoomSizeXY(width:Int, height:Int, angle:Float, zoomx:Float, zoomy:Float, dstwidth:IntRef, dstheight:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| width | Int | The source surface width. |
| height | Int | The source surface height. |
| angle | Float | The angle to rotate in degrees. |
| zoomx | Float | The horizontal scaling factor. |
| zoomy | Float | The vertical scaling factor. |
| dstwidth | IntRef | The calculated width of the rotozoomed destination surface. |
| dstheight | IntRef | The calculated height of the rotozoomed destination surface. |
RotoZoomXY
Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
method : public : RotoZoomXY(angle:Float, zoomx:Float, zoomy:Float, smooth:Bool) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| angle | Float | The angle to rotate in degrees. |
| zoomx | Float | The horizontal scaling factor. |
| zoomy | Float | The vertical scaling factor. |
| smooth | Bool | Antialiasing flag; set to true to enable. |
Return
| Type | Description |
|---|---|
| Surface | newly modified surface |
SaveBMP
save a surface to a BMP file
function : SaveBMP(surface:Surface, file:String) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| surface | Surface | Surface instance containing the image to be saved |
| file | String | file to be saved to |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetAlphaMod
Set an additional alpha value used in blit operations
method : public : SetAlphaMod(alpha:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| alpha | Int | alpha value multiplied into blit operations |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetBlendMode
set the blend mode used for blit operations
method : public : SetBlendMode(blendMode:BlendMode) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| blendMode | BlendMode | BlendMode to use for blit blending |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetClipRect
Set the clipping rectangle for a surface
method : public : SetClipRect(rect:Rect) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| rect | Rect | Rect structure representing the clipping rectangle, or Nil to disable clipping |
Return
| Type | Description |
|---|---|
| Bool | Returns true if the rectangle intersects the surface, otherwise false and blits will be completely clipped |
SetColorKey
Set the color key (transparent pixel) in a surface
method : public : SetColorKey(flag:Bool, key:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| flag | Bool | true to enable color key, false to disable color key |
| key | Int | the transparent pixel |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetColorMod
Set an additional color value multiplied into blit operation
method : public : SetColorMod(r:Int, g:Int, b:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| r | Int | the red color value multiplied into blit operations |
| g | Int | the green color value multiplied into blit operations |
| b | Int | the blue color value multiplied into blit operations |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetRLE
Set the RLE acceleration hint for a surface
method : public : SetRLE(flag:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| flag | Int | 0 to disable, non-zero to enable RLE acceleration |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
Shrink
Shrink a surface by an integer ratio using averaging.
method : public : Shrink(factorx:Int, factory:Int) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| factorx | Int | The horizontal shrinking ratio. |
| factory | Int | The vertical shrinking ratio. |
Return
| Type | Description |
|---|---|
| Surface | newly modified surface |
Zoom
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
method : public : Zoom(zoomx:Float, zoomy:Float, smooth:Bool) ~ SurfaceParameters
| Name | Type | Description |
|---|---|---|
| zoomx | Float | The horizontal scaling factor. |
| zoomy | Float | The vertical scaling factor. |
| smooth | Bool | Antialiasing flag; set to true to enable. |
Return
| Type | Description |
|---|---|
| Surface | newly modified surface |
ZoomSize
Returns the size of the resulting target surface for a Zoom() call.
function : ZoomSize(width:Int, height:Int, zoomx:Float, zoomy:Float, dstwidth:IntRef, dstheight:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| width | Int | The source surface width. |
| height | Int | The source surface height. |
| zoomx | Float | The horizontal scaling factor. |
| zoomy | Float | The vertical scaling factor. |
| dstwidth | IntRef | The calculated width of the rotozoomed destination surface. |
| dstheight | IntRef | The calculated height of the rotozoomed destination surface. |