Class Surface
Surfaces are a rectangular collection of pixels
Surfaces are easy to work with and edit and can be blitted on to another surface
Surfaces can also be converted to textures which are more efficient but less flexible
Surfaces are handled in software as opposed to textures which are handled in hardware
Surfaces can be used, but when used repeatedly and stored, textures should be preferred
Surface draw methods do not respect alpha, but surface blitting does; to draw with alpha, draw to another surface, and blit to desired surface
Constructors
Name | Description |
this
|
Creates an RGB surface given at least a width and a height
|
this
|
Creates an RGB surface given at least a width, height, and an SDL_PixelFormatEnum
|
this
|
Creates a surface from another surface but with a different pixel format
|
this
|
Creates a surface from a BMP file path; for other image formats, use loadImage
|
this
|
Creates a surface from an already existing SDL_Surface
|
Properties
Name | Type | Description |
alphaMod [set]
|
ubyte | Sets the alpha modifier for the surface
Alpha modification works by multiplying the alphaMultiplier / 255 into the surface pixels
|
alphaMod [get]
|
ubyte | Gets the alpha modifier for the surface
Alpha modification works by multiplying the alphaMultiplier / 255 into the surface pixels
|
blendMode [set]
|
derelict.sdl2.internal.sdl_types.SDL_BlendMode | Sets the surface's blend mode
|
blendMode [get]
|
derelict.sdl2.internal.sdl_types.SDL_BlendMode | Gets the surface's blend mode
|
clipRect [set]
|
AxisAlignedBoundingBox!(int,2) | Sets the clip boundaries for the surface
Anything put on the surface outside of the clip boundaries gets discarded
|
clipRect [get]
|
AxisAlignedBoundingBox!(int,2) | Gets the clip boundaries for the surface
Anything put on the surface outside of the clip boundaries gets discarded
|
colorMod [set]
|
Color | Sets the color modifier for the surface
Color modification works by multiplying the colorMultiplier / 255 into the surface pixels
|
colorMod [get]
|
Color | Gets the color modifier for the surface
Color modification works by multiplying the colorMultiplier / 255 into the surface pixels
|
dimensions [get]
|
Vector!(int,2) | Gets the surfaces dimensions as a vector with width as the x component and height as the y component
|
drawColor [set]
|
Color | Sets the drawcolor for this surface; what color things will be drawn with
|
drawColor [get]
|
Color | Gets the drawcolor for this surface; what color things will be drawn with
|
handle [get]
|
derelict.sdl2.internal.sdl_types.SDL_Surface* | Returns the raw SDL data of this object
|
Methods
Name | Description |
blit
|
Blits another surface onto this surface
Takes the surface to blit, the slice of the surface to blit, and where on this surface to blit to
Is faster than a scaled blit to a rectangle
|
blit
|
Does a scaled blit from another surface onto this surface
Takes the surface to blit, the slice of the surface to blit, and the slice on this surface of where to blit to
Is slower than the blit to a location
|
drawPoint
|
Defines how the shape drawer draws points on a surface
Used for all other shape drawer functions
|
fillRect
|
Fills in a rectangle
Uses the SDL functionality for better performance
|
saveBMP
|
Saves the surface as a BMP with the given file name
|
draw
|
Draws a point to the screen
Just calls the basic draw point method
|
draw
|
Draws a point to the screen
|
draw
|
Draws a point given by a vector
|
draw
|
Draws a line given by two points
|
draw
|
Draws a line given by a segment
|
draw
|
Draws the given rectangle
|
draw
|
Draws the given bezier curve with numPoints number of points on the curve
More points is smoother but slower
|
draw
|
Draws a polygon
|
draw
|
Draws the ellipse bounded by the given box between the given angles in radians
More points generally means a slower but more well drawn ellipse
|
drawLine
|
Draws a line
Can be overridden
|
drawPointRotated
|
Draws a point rotated about the given "pointOfRotation" and rotated clockwise by the the amount of radians specified in "rotation"
|
drawRect
|
Draws the outlines of a rectangle
Can be overridden
|
drawRotated
|
Performs a draw function but rotates each point by the specified rotation given in radians clockwise around the specified point
|
fill
|
Fills the given rectangle
|
fill
|
Fills a polygon
Uses scanlining
|
fill
|
Fills the ellipse bounded by the given box between the given angles in radians
Fills the ellipse between the arc endpoints: fills ellipse as arc rather than filling as ellipse (not a pizza slice)
More points generally means a slower but more well drawn ellipse
|