BlitzMax

BlitzMax

  • Downloads
  • Docs
  • API
  • Resources
  • About

›SDLRender

BlitzMax API

  • Introduction

BRL

    Audio

    • Introduction
    • TChannel
    • TSound

    AudioSample

    • Introduction
    • TAudioSample
    • TAudioSampleLoader

    Bank

    • Introduction
    • TBank

    BankStream

    • Introduction
    • TBankStream

    Base64

    • Introduction
    • TBase64

    Blitz

    • Introduction
    • TArrayBoundsException
    • TBlitzException
    • TIllegalArgumentException
    • TInvalidEnumException
    • TNullFunctionException
    • TNullMethodException
    • TNullObjectException
    • TOutOfDataException
    • TRuntimeException
    • IIterable
    • IIterator
    • ICloseable

    Clipboard

    • Introduction
    • TClipboard
    • TClipboardOpts
    • TWin32ClipboardOpts
    • TX11ClipboardOpts

    Color

    • Introduction
    • SColor8
  • BRL.D3D7Max2D
  • BRL.D3D9Max2D
  • BRL.DirectSoundAudio
  • BRL.EndianStream
  • Event

    • Introduction
    • TEvent
  • BRL.EventQueue
  • FileSystem

    • Introduction
    • IFileWalker
    • SFileAttributes
  • BRL.FreeAudioAudio
  • BRL.GLGraphics
  • BRL.GLMax2D
  • Glob

    • Introduction
    • EGlobOptions
    • TGlobIter
  • BRL.GNet
  • BRL.Graphics
  • BRL.Hook
  • IO

    • Introduction
    • MaxIO
  • BRL.KeyCodes
  • LinkedList

    • Introduction
    • TList
    • TListEnum
    • TLink

    Map

    • Introduction
    • TMap
  • BRL.Math
  • Max2D

    • Introduction
    • TImage

    MaxLua

    • Introduction
    • TLuaClass
    • TLuaObject

    MaxUnit

    • Introduction
    • TTest
    • TAssert
  • BRL.OGGLoader
  • BRL.OpenALAudio
  • Path

    • Introduction
    • TPath
    • IPathWalker
    • SPathAttributes
    • TPathDirIterator

    Pixmap

    • Introduction
    • TPixmap
    • TPixmapLoader
  • BRL.PolledInput
  • BRL.RamStream
  • Random

    • Introduction
    • TRandomDefault

    RectPacker

    • Introduction
    • EPackingMethod
    • SPackedRect
    • TPackedSheet
    • TRectPacker

    Reflection

    • Introduction
    • TTypeId
    • TMember
    • TConstant
    • TField
    • TGlobal
    • TFunction
    • TMethod
  • BRL.Retro
  • BRL.Socket
  • BRL.SocketStream
  • BRL.StandardIO
  • Stream

    • Introduction
    • TCStream
    • TIO
    • TStream
    • TStreamException
    • TStreamFactory
    • TStreamReadException
    • TStreamWrapper
    • TStreamWriteException

    StringBuilder

    • Introduction
    • TStringBuilder
    • TSplitBuffer
  • BRL.System
  • BRL.SystemDefault
  • BRL.TextStream
  • ThreadPool

    • Introduction
    • TRunnable
    • TThreadPoolExecutor

    Threads

    • Introduction
    • TThread
    • TThreadData
    • TMutex
    • TSemaphore
    • TCondVar

    Time

    • Introduction
    • ETimeUnit
    • TTimeoutException

    Timer

    • Introduction
    • TChrono
  • BRL.TimerDefault
  • Volumes

    • Introduction
    • TVolume
  • BRL.WAVLoader

Pub

  • Pub.FreeJoy
  • Pub.FreeProcess
  • Pub.Glad
  • Pub.Glew
  • Joystick

    • Introduction
    • TJoystickDriver
  • Pub.Lua
  • Pub.OpenAL
  • Pub.OpenGLES
  • StdC

    • Introduction
    • SDateTime
  • Pub.xmmintrin

Collections

    IntMap

    • Introduction
    • TIntMap

    ObjectList

    • Introduction
    • TObjectList
    • TObjectListEnumerator
    • TObjectListReverseEnumerator

    ObjectMap

    • Introduction
    • TObjectMap

    PtrMap

    • Introduction
    • TPtrMap

    StringMap

    • Introduction
    • TStringMap

Crypto

    Digest

    • Introduction
    • TMessageDigest
    • TDigestRegister

    Cipher

    • Introduction
    • TCipher
    • TCipherMode
    • Crypto.AESCipher
    • Crypto.AnubisCipher
    • Crypto.BlowfishCipher
    • Crypto.CamelliaCipher
    • Crypto.Cast5Cipher
    • Crypto.DESCipher
    • Crypto.IdeaCipher
    • Crypto.KasumiCipher
    • Crypto.KhazadCipher
    • Crypto.KSeedCipher
    • Crypto.NoekeonCipher
    • Crypto.SerpentCipher
    • Crypto.SkipjackCipher
    • Crypto.TwofishCipher
    • Crypto.XTeaCipher

    CBCMode

    • Introduction
    • TCBCCipherMode

    CFBMode

    • Introduction
    • TCFBCipherMode

    CTRMode

    • Introduction
    • TCTRCipherMode

    ECBMode

    • Introduction
    • TECBCipherMode

    F8Mode

    • Introduction
    • TF8CipherMode

    LRWMode

    • Introduction
    • TLRWCipherMode

    OFBMode

    • Introduction
    • TOFBCipherMode

    XTSMode

    • Introduction
    • TXTSCipherMode

    Blake2BDigest

    • Introduction
    • TBlake2B_512
    • TBlake2B_384
    • TBlake2B_256
    • TBlake2B_160

    CRC32

    • Introduction
    • TCRC32

    MD5Digest

    • Introduction
    • TMD5

    Ripemd320Digest

    • Introduction
    • TRipemd320

    Ripemd356Digest

    • Introduction
    • TRipemd256

    Ripemd160Digest

    • Introduction
    • TRipemd160

    Ripemd128Digest

    • Introduction
    • TRipemd128

    SHA1Digest

    • Introduction
    • TSHA1

    SHA256Digest

    • Introduction
    • TSHA256

    SHA512Digest

    • Introduction
    • TSHA512

    SHA3Digest

    • Introduction
    • TSHA3_512
    • TSHA3_384
    • TSHA3_256
    • TSHA3_224

    TigerDigest

    • Introduction
    • TTiger

    WhirlpoolDigest

    • Introduction
    • TWhirlpool

    Crypto

    • Introduction
    • TCryptoRandom
    • TCryptoSecretBox
    • TCryptoHash
    • TCryptoSign
    • TCryptoKeyExchange
    • TCryptoKey
    • TCryptoHashKey
    • TCryptoSecretBoxKey
    • TCryptoSignature
    • TCryptoExchangeKeyPair
    • TCryptoSessionKeyPair
    • TCryptoNPacket
    • TCryptoKK1Packet
    • TCryptoKK2Packet
    • TCryptoXX1Packet
    • TCryptoXX2Packet
    • TCryptoXX3Packet
    • TCryptoExchangeState
    • TCryptoPWHashMasterKey
    • TCryptoPWHashStoredKey
    • TCryptoPasswordHash

Math

    Matrix

    • Introduction
    • SMat2D
    • SMat2F
    • SMat2I
    • SMat3D
    • SMat3F
    • SMat3I
    • SMat4D
    • SMat4F
    • SMat4I

    Quaternion

    • Introduction
    • SQuatD
    • SQuatF
    • SQuatI

    Vector

    • Introduction
    • SVec2D
    • SVec2F
    • SVec2I
    • SVec3D
    • SVec3F
    • SVec3I
    • SVec4D
    • SVec4F
    • SVec4I

MaxGUI

  • MaxGUI.MaxGUI
  • MaxGUI.Drivers
  • MaxGUI.Localization
  • MaxGUI.ProxyGadgets
  • MaxGUI.CocoaMaxGUI
  • MaxGUI.Win32MaxGUIEx

Net

    Http

    • Introduction
    • THttpClient
    • THttpRequest
    • THttpResponse
    • THttpResult
    • TUrl
    • ICompleteListener
    • ICookie
    • THttpClientException
    • THttpCookie
    • THttpCookieBuilder
    • THttpField
    • THttpFields
    • TRetryPolicy
    • TUrlBuilder
    • TContent
    • TStringContent
    • TStreamContent
    • TBytePtrContent
    • TByteArrayContent
    • TBankContent
    • TCAStore
    • ECookieAttribute
    • EHttpAuthMethod
    • EHttpHeader
    • EHttpMethod
    • EUrlCode
    • EUrlPart

Random

    Core

    • Introduction
    • TRandom
  • Random.PRVHASH
  • Random.Secure
  • SFMT

    • Introduction
    • TSFMTRandom
  • Random.Squares
  • Random.Xoshiro

SDL

    SDL

    • Introduction
    • TSDLStream

    SDLSystem

    • Introduction
    • TSDLMultiGesture

    SDLVideo

    • Introduction
    • TSDLDisplay
    • TSDLGLContext
    • TSDLWindow

    SDLRender

    • Introduction
    • TSDLRenderer
    • TSDLTexture

    SDLTimer

    • Introduction
    • TSDLTimer

    SDLHaptic

    • Introduction
    • TSDLHaptic
    • TSDLHapticCondition
    • TSDLHapticConstant
    • TSDLHapticCustom
    • TSDLHapticDirection
    • TSDLHapticEffect
    • TSDLHapticLeftRight
    • TSDLHapticPeriodic
    • TSDLHapticRamp

    SDLSensor

    • Introduction
    • TSDLSensor
  • SDL.SDLFreeAudio
  • SDL.GLSDLMax2D
  • SDL.GL2SDLMax2D
  • SDL.D3D9SDLMax2D
  • SDLVirtualJoystick

    • Introduction
    • TVirtualJoystick

Steam

    SteamSDK

    • Introduction
    • TSteamClient
    • TSteamUtils
    • TSteamUserStats
    • TSteamFriends
    • TSteamUGC
    • ISteamFriendsListener
    • ISteamUGCListener
    • ISteamUserStatsListener
    • ISteamUtilsListener
    • EItemPreviewType
    • EPersonaChange
    • EPersonaState
    • ERemoteStoragePublishedFileVisibility
    • EUGCMatchingUGCType
    • EUGCQuery
    • EUserRestriction
    • EUserUGCList
    • EWorkshopFileType

Text

    CP932Encoding

    • Text.CP932Encoding

    CSV

    • Introduction
    • TCsvParser
    • TCsvHeader
    • TCsvRow
    • TCsvOptions
    • SCsvColumn

    Encoding

    • Text.Encoding

    Format

    • Introduction
    • TFormatter

    Graphviz

    • Introduction
    • TGVGraphviz
    • TAGraph

    Ini

    • Introduction
    • TIni
    • TIniProperty
    • TIniSection

    JConv

    • Introduction
    • TJConv
    • TJConvBuilder
    • TJConvSerializer

    Json

    • Introduction
    • TJSON
    • TJSONObject
    • TJSONString
    • TJSONInteger
    • TJSONReal
    • TJSONBool
    • TJSONArray
    • TJSONNull
    • TJSONError
    • TJSONNumber

    Markdown

    • Introduction
    • TMarkdown
    • IMDRenderer

    Pikchr

    • Introduction
    • EPikChrFlags

    Regex

    • Introduction
    • TRegEx
    • TRegExMatch
    • TRegExOptions
    • TRegExException

    TOML

    • Introduction
    • ETomlNodeType
    • TToml
    • ITomlNode
    • STomlDate
    • STomlDateTime
    • STomlTime
    • TTomlArray
    • TTomlInteger
    • TTomlString
    • TTomlTable
    • TTomlBoolean

    Xml

    • Introduction
    • TxmlDoc
    • TxmlNode
    • TxmlAttribute
Edit

TSDLRenderer

A 2D rendering context.

Methods

Method GetWindow:TSDLWindow()

Get the window associated with the renderer.


Method CreateTexture:TSDLTexture(format:UInt, access:Int, width:Int, height:Int)

Creates a texture for a rendering context.


Method CreateTextureFromSurface:TSDLTexture(surface:TSDLSurface)

Creates a texture from an existing surface.


Method GetDrawBlendMode:Int(blendMode:Int Var)

Gets the blend mode used for drawing operations.


Method GetDrawColor:Int(r:Byte Var, g:Byte Var, b:Byte Var, a:Byte Var)

Gets the color used for drawing operations (Rect, Line and Clear).


Method GetTarget:TSDLTexture()

Gets the current render target.

The default render target is the window for which the renderer was created, and is reported as Null here.

Returns

The current render target or Null for the default render target.


Method GetOutputSize:Int(w:Int Var, h:Int Var)

Gets the output size in pixels of a rendering context.


Method Clear:Int()

Clears the current rendering target with the drawing color.


Method Copy:Int(texture:TSDLTexture, sx:Int = -1, sy:Int = -1, sw:Int = -1, sh:Int = -1, dx:Int = -1, dy:Int = -1, dw:Int = -1, dh:Int = -1)

Copies a portion of the texture to the current rendering target.


Method CopyEx:Int(texture:TSDLTexture, sx:Int = -1, sy:Int = -1, sw:Int = -1, sh:Int = -1, dx:Int = -1, dy:Int = -1, dw:Int = -1, dh:Int = -1, angle:Double = 0, cx:Int = -1, cy:Int = -1, flipMode:Int = SDL_FLIP_NONE)

Copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.


Method DrawLine:Int(x1:Int, y1:Int, x2:Int, y2:Int)

Draws a line on the current rendering target.


Method DrawLines:Int(points:Int Ptr, count:Int)

Draws a series of connected lines on the current rendering target.

A point consists of a pair of Ints (x, y), where count is the count of pairs.


Method DrawPoint:Int(x:Int, y:Int)

Draws a point on the current rendering target.


Method DrawPoints:Int(points:Int Ptr, count:Int)

Draws multiple points on the current rendering target.


Method DrawRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)

Draws a rectangle on the current rendering target.


Method DrawRects:Int(rects:Int Ptr, count:Int)

Draws some number of rectangles on the current rendering target.


Method FillRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)

Fills a rectangle on the current rendering target with the drawing color.


Method FillRects:Int(rects:Int Ptr, count:Int)

Fills some number of rectangles on the current rendering target with the drawing color.

Returns

0 on success or a negative error code on failure; call SDLGetError for more information.


Method Geometry:Int(texture:TSDLTexture, vertices:SDLVertex Ptr, numVertices:Int, indices:Int Ptr, numIndices:Int)

Renders a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex.

Returns

0 on success, or -1 if the operation is not supported


Method GetInfo:SDLRendererInfo()

Gets information about the rendering context.


Method GetIntegerScale:Int()

Gets whether integer scales are forced for resolution-independent rendering.


Method GetLogicalSize(w:Int Var, h:Int Var)

Gets device independent resolution for rendering.


Method GetScale(x:Float Var, y:Float Var)

Gets the drawing scale for the current target.


Method GetViewport(x:Int Var, y:Int Var, w:Int Var, h:Int Var)

Gets the drawing area for the current target.


Method IsClipEnabled:Int()

Gets whether clipping is enabled on the given renderer.


Method Present()

Updates the screen with any rendering performed since the previous call.


Method ReadPixels:Int(format:UInt, pixels:Byte Ptr, pitch:Int, x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)

Reads pixels from the current rendering target.


Method SetClipRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)

Sets the clip rectangle for rendering on the specified target.


Method SetIntegerScale:Int(enable:Int)

Sets whether to force integer scales for resolution-independent rendering.

Restricts the logical viewport to integer values - that is, when a resolution is between two multiples of a logical size, the viewport size is rounded down to the lower multiple.


Method SetLogicalSize:Int(w:Int, h:Int)

Sets a device independent resolution for rendering.

Uses the viewport and scaling functionality to allow a fixed logical resolution for rendering, regardless of the actual output resolution. If the actual output resolution doesn't have the same aspect ratio the output rendering will be centered within the output display.

If the output display is a window, mouse and touch events in the window will be filtered and scaled so they seem to arrive within the logical resolution. The SDL_HINT_MOUSE_RELATIVE_SCALING hint controls whether relative motion events are also scaled.

If this method results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints.


Method SetScale:Int(scaleX:Float, scaleY:Float)

Sets the drawing scale for rendering on the current target.


Method SetViewport:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)

Sets the drawing area for rendering on the current target.

Use defaults (-1) to set viewport to entire target.


Method TargetSupported:Int()

Determines whether a window supports the use of render targets.


Method SetDrawBlendMode:Int(blendMode:Int)

Sets the blend mode used for drawing operations (Fill and Line).


Method SetDrawColor:Int(r:Byte, g:Byte, b:Byte, a:Byte)

Sets the color used for drawing operations (Rect, Line and Clear).


Method SetTarget:Int(texture:TSDLTexture)

Sets a texture as the current rendering target. The texture must have been created with the SDL_TEXTUREACCESS_TARGET flag.

Before using this method, you should check the SDL_RENDERER_TARGETTEXTURE bit in the flags of SDL_RendererInfo to see if render targets are supported.

The default render target is the window for which the renderer was created. To stop rendering to a texture and render to the window again, call this method with a Null texture.

Returns

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


Method WindowToLogical(windowX:Int, windowY:Int, logicalX:Float Var, logicalY:Float Var)

Gets logical coordinates of a point in the renderer when given real coordinates of point in the window.

Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set.


Method LogicalToWindow(logicalX:Float, logicalY:Float, windowX:Int Var, windowY:Int Var)

Gets real coordinates of a point in the window when given logical coordinates of point in the renderer.

Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set.


Method SetVSync:Int(vsync:Int)

Toggles VSync of the renderer.

vsync is 1 for on, 0 for off. All other values are reserved.

Returns

0 on success, or non-zero on failure.


Method Destroy()

Destroys the rendering context for a window and free associated textures.


Functions

Function Create:TSDLRenderer(window:TSDLWindow, index:Int = -1, flags:UInt = 0)

Creates a 2D rendering context for a window.

Note that providing no flags gives priority to available SDL_RENDERER_ACCELERATED renderers flags can be one or more of the following values - |----------------------------|------------------------------------------------| | SDL_RENDERER_SOFTWARE | the renderer is a software fallback | | SDL_RENDERER_ACCELERATED | the renderer uses hardware acceleration | | SDL_RENDERER_PRESENTVSYNC | present is synchronized with the refresh rate |

SDL_RENDERER_TARGETTEXTUREthe renderer supports rendering to texture


Function CreateSoftwareRenderer:TSDLRenderer(surface:TSDLSurface)

Creates a 2D software rendering context for a surface.


Function GetRenderer:TSDLRenderer(window:TSDLWindow)

Gets the renderer associated with a window.


← IntroductionTSDLTexture →
  • Methods
    • Method GetWindow:TSDLWindow()
    • Method CreateTexture:TSDLTexture(format:UInt, access:Int, width:Int, height:Int)
    • Method CreateTextureFromSurface:TSDLTexture(surface:TSDLSurface)
    • Method GetDrawBlendMode:Int(blendMode:Int Var)
    • Method GetDrawColor:Int(r:Byte Var, g:Byte Var, b:Byte Var, a:Byte Var)
    • Method GetTarget:TSDLTexture()
    • Method GetOutputSize:Int(w:Int Var, h:Int Var)
    • Method Clear:Int()
    • Method Copy:Int(texture:TSDLTexture, sx:Int = -1, sy:Int = -1, sw:Int = -1, sh:Int = -1, dx:Int = -1, dy:Int = -1, dw:Int = -1, dh:Int = -1)
    • Method CopyEx:Int(texture:TSDLTexture, sx:Int = -1, sy:Int = -1, sw:Int = -1, sh:Int = -1, dx:Int = -1, dy:Int = -1, dw:Int = -1, dh:Int = -1, angle:Double = 0, cx:Int = -1, cy:Int = -1, flipMode:Int = SDL_FLIP_NONE)
    • Method DrawLine:Int(x1:Int, y1:Int, x2:Int, y2:Int)
    • Method DrawLines:Int(points:Int Ptr, count:Int)
    • Method DrawPoint:Int(x:Int, y:Int)
    • Method DrawPoints:Int(points:Int Ptr, count:Int)
    • Method DrawRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)
    • Method DrawRects:Int(rects:Int Ptr, count:Int)
    • Method FillRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)
    • Method FillRects:Int(rects:Int Ptr, count:Int)
    • Method Geometry:Int(texture:TSDLTexture, vertices:SDLVertex Ptr, numVertices:Int, indices:Int Ptr, numIndices:Int)
    • Method GetInfo:SDLRendererInfo()
    • Method GetIntegerScale:Int()
    • Method GetLogicalSize(w:Int Var, h:Int Var)
    • Method GetScale(x:Float Var, y:Float Var)
    • Method GetViewport(x:Int Var, y:Int Var, w:Int Var, h:Int Var)
    • Method IsClipEnabled:Int()
    • Method Present()
    • Method ReadPixels:Int(format:UInt, pixels:Byte Ptr, pitch:Int, x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)
    • Method SetClipRect:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)
    • Method SetIntegerScale:Int(enable:Int)
    • Method SetLogicalSize:Int(w:Int, h:Int)
    • Method SetScale:Int(scaleX:Float, scaleY:Float)
    • Method SetViewport:Int(x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1)
    • Method TargetSupported:Int()
    • Method SetDrawBlendMode:Int(blendMode:Int)
    • Method SetDrawColor:Int(r:Byte, g:Byte, b:Byte, a:Byte)
    • Method SetTarget:Int(texture:TSDLTexture)
    • Method WindowToLogical(windowX:Int, windowY:Int, logicalX:Float Var, logicalY:Float Var)
    • Method LogicalToWindow(logicalX:Float, logicalY:Float, windowX:Int Var, windowY:Int Var)
    • Method SetVSync:Int(vsync:Int)
    • Method Destroy()
  • Functions
    • Function Create:TSDLRenderer(window:TSDLWindow, index:Int = -1, flags:UInt = 0)
    • Function CreateSoftwareRenderer:TSDLRenderer(surface:TSDLSurface)
    • Function GetRenderer:TSDLRenderer(window:TSDLWindow)
BlitzMax
Docs
Getting StartedDownloadsAbout
Community
Resources
More
GitHubStarChat on Discord
Copyright © 2026 Bruce A Henderson