sdl2-2.5.5.0: Both high- and low-level bindings to the SDL library (version 2.0.6+).
Safe HaskellSafe-Inferred
LanguageHaskell2010

SDL.Video.Renderer

Description

SDL.Video.Renderer provides a high-level interface to SDL's accelerated 2D rendering library.

Synopsis

Documentation

data Renderer Source #

An SDL rendering device. This can be created with createRenderer.

Instances

Instances details
Data Renderer Source # 
Instance details

Defined in SDL.Internal.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Renderer -> c Renderer Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Renderer Source #

toConstr :: Renderer -> Constr Source #

dataTypeOf :: Renderer -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Renderer) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Renderer) Source #

gmapT :: (forall b. Data b => b -> b) -> Renderer -> Renderer Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Renderer -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Renderer -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Renderer -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Renderer -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Renderer -> m Renderer Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Renderer -> m Renderer Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Renderer -> m Renderer Source #

Generic Renderer Source # 
Instance details

Defined in SDL.Internal.Types

Associated Types

type Rep Renderer :: Type -> Type Source #

Show Renderer Source # 
Instance details

Defined in SDL.Internal.Types

Eq Renderer Source # 
Instance details

Defined in SDL.Internal.Types

Ord Renderer Source # 
Instance details

Defined in SDL.Internal.Types

type Rep Renderer Source # 
Instance details

Defined in SDL.Internal.Types

type Rep Renderer = D1 ('MetaData "Renderer" "SDL.Internal.Types" "sdl2-2.5.5.0-inplace" 'True) (C1 ('MetaCons "Renderer" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Renderer)))

Renderer Configuration

These configuration options can be used with createRenderer to create Renderers.

data RendererConfig Source #

The configuration data used when creating windows.

Constructors

RendererConfig 

Fields

Instances

Instances details
Data RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RendererConfig -> c RendererConfig Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RendererConfig Source #

toConstr :: RendererConfig -> Constr Source #

dataTypeOf :: RendererConfig -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RendererConfig) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RendererConfig) Source #

gmapT :: (forall b. Data b => b -> b) -> RendererConfig -> RendererConfig Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RendererConfig -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RendererConfig -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RendererConfig -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RendererConfig -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RendererConfig -> m RendererConfig Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RendererConfig -> m RendererConfig Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RendererConfig -> m RendererConfig Source #

Generic RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep RendererConfig :: Type -> Type Source #

Read RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

Show RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

Eq RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

Ord RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

FromNumber RendererConfig Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

ToNumber RendererConfig Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererConfig Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererConfig = D1 ('MetaData "RendererConfig" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (C1 ('MetaCons "RendererConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "rendererType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RendererType) :*: S1 ('MetaSel ('Just "rendererTargetTexture") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

data RendererType Source #

Renderer acceleration mode

Constructors

UnacceleratedRenderer

The renderer does not use hardware acceleration

AcceleratedRenderer

The renderer uses hardware acceleration and refresh rate is ignored

AcceleratedVSyncRenderer

The renderer uses hardware acceleration and present is synchronized with the refresh rate

SoftwareRenderer

The renderer is a software fallback

Instances

Instances details
Data RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RendererType -> c RendererType Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RendererType Source #

toConstr :: RendererType -> Constr Source #

dataTypeOf :: RendererType -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RendererType) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RendererType) Source #

gmapT :: (forall b. Data b => b -> b) -> RendererType -> RendererType Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RendererType -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RendererType -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RendererType -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RendererType -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RendererType -> m RendererType Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RendererType -> m RendererType Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RendererType -> m RendererType Source #

Bounded RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Enum RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Generic RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep RendererType :: Type -> Type Source #

Read RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Show RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Eq RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

Ord RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererType Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererType = D1 ('MetaData "RendererType" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) ((C1 ('MetaCons "UnacceleratedRenderer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AcceleratedRenderer" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AcceleratedVSyncRenderer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SoftwareRenderer" 'PrefixI 'False) (U1 :: Type -> Type)))

Drawing Primitives

clear :: (Functor m, MonadIO m) => Renderer -> m () Source #

Clear the current rendering target with the drawing color.

See SDL_RenderClear for C documentation.

copy Source #

Arguments

:: MonadIO m 
=> Renderer

The rendering context

-> Texture

The source texture

-> Maybe (Rectangle CInt)

The source rectangle to copy, or Nothing for the whole texture

-> Maybe (Rectangle CInt)

The destination rectangle to copy to, or Nothing for the whole rendering target. The texture will be stretched to fill the given rectangle.

-> m () 

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

See SDL_RenderCopy for C documentation.

copyEx Source #

Arguments

:: MonadIO m 
=> Renderer

The rendering context

-> Texture

The source texture

-> Maybe (Rectangle CInt)

The source rectangle to copy, or Nothing for the whole texture

-> Maybe (Rectangle CInt)

The destination rectangle to copy to, or Nothing for the whole rendering target. The texture will be stretched to fill the given rectangle.

-> CDouble

The angle of rotation in degrees. The rotation will be performed clockwise.

-> Maybe (Point V2 CInt)

The point indicating the center of the rotation, or Nothing to rotate around the center of the destination rectangle

-> V2 Bool

Whether to flip the texture on the X and/or Y axis

-> m () 

Copy 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.

See SDL_RenderCopyEx for C documentation.

drawLine Source #

Arguments

:: (Functor m, MonadIO m) 
=> Renderer 
-> Point V2 CInt

The start point of the line

-> Point V2 CInt

The end point of the line

-> m () 

Draw a line on the current rendering target.

See SDL_RenderDrawLine for C documentation.

drawLines Source #

Arguments

:: MonadIO m 
=> Renderer 
-> Vector (Point V2 CInt)

A Vector of points along the line. SDL will draw lines between these points.

-> m () 

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

See SDL_RenderDrawLines for C documentation.

drawPoint :: (Functor m, MonadIO m) => Renderer -> Point V2 CInt -> m () Source #

Draw a point on the current rendering target.

See SDL_RenderDrawPoint for C documentation.

drawPoints :: MonadIO m => Renderer -> Vector (Point V2 CInt) -> m () Source #

Draw multiple points on the current rendering target.

See SDL_RenderDrawPoints for C documentation.

drawRect Source #

Arguments

:: MonadIO m 
=> Renderer 
-> Maybe (Rectangle CInt)

The rectangle outline to draw. Nothing for the entire rendering context.

-> m () 

Draw a rectangle outline on the current rendering target.

See SDL_RenderDrawRect for C documentation.

drawRects :: MonadIO m => Renderer -> Vector (Rectangle CInt) -> m () Source #

Draw some number of rectangles on the current rendering target.

See SDL_RenderDrawRects for C documentation.

fillRect Source #

Arguments

:: MonadIO m 
=> Renderer 
-> Maybe (Rectangle CInt)

The rectangle to fill.

-> m () 

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

See SDL_RenderFillRect for C documentation.

fillRects :: MonadIO m => Renderer -> Vector (Rectangle CInt) -> m () Source #

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

See SDL_RenderFillRects for C documentation.

copyF :: MonadIO m => Renderer -> Texture -> Maybe (Rectangle CInt) -> Maybe (Rectangle CFloat) -> m () Source #

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

copyExF Source #

Arguments

:: MonadIO m 
=> Renderer

The rendering context

-> Texture

The source texture

-> Maybe (Rectangle CInt)

The source rectangle to copy, or Nothing for the whole texture

-> Maybe (Rectangle CFloat)

The destination rectangle to copy to, or Nothing for the whole rendering target. The texture will be stretched to fill the given rectangle.

-> CDouble

The angle of rotation in degrees. The rotation will be performed clockwise.

-> Maybe (Point V2 CFloat)

The point indicating the center of the rotation, or Nothing to rotate around the center of the destination rectangle

-> V2 Bool

Whether to flip the texture on the X and/or Y axis

-> m () 

Copy 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.

drawLineF :: MonadIO m => Renderer -> Point V2 CFloat -> Point V2 CFloat -> m () Source #

Draw a line between two points on the current rendering target.

drawLinesF :: MonadIO m => Renderer -> Vector (Point V2 CFloat) -> m () Source #

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

drawPointF :: MonadIO m => Renderer -> Point V2 CFloat -> m () Source #

Draw a point on the current rendering target.

drawPointsF :: MonadIO m => Renderer -> Vector (Point V2 CFloat) -> m () Source #

Draw a collection of points on the current rendering target.

drawRectF :: MonadIO m => Renderer -> Rectangle CFloat -> m () Source #

Draw the outline of a rectangle on the current rendering target.

drawRectsF :: MonadIO m => Renderer -> Vector (Rectangle CFloat) -> m () Source #

Draw a series of rectangle outlines on the current rendering target.

fillRectF :: MonadIO m => Renderer -> Rectangle CFloat -> m () Source #

Draw a filled rectangle on the current rendering target.

fillRectsF :: MonadIO m => Renderer -> Vector (Rectangle CFloat) -> m () Source #

Draw a series of filled rectangles on the current rendering target.

renderGeometry :: MonadIO m => Renderer -> Maybe Texture -> Vector Vertex -> Vector CInt -> m () Source #

Render a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).

data Vertex Source #

Instances

Instances details
Storable Vertex Source # 
Instance details

Defined in SDL.Raw.Types

Show Vertex Source # 
Instance details

Defined in SDL.Raw.Types

Eq Vertex Source # 
Instance details

Defined in SDL.Raw.Types

renderGeometryRaw :: forall ix m. (Storable ix, MonadIO m) => Renderer -> Maybe Texture -> Ptr FPoint -> CInt -> Ptr Color -> CInt -> Ptr FPoint -> CInt -> CInt -> Vector ix -> m () Source #

Render a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).

This version allows storeing vertex data in arbitrary types, but you have to provide pointers and strides yourself.

present :: MonadIO m => Renderer -> m () Source #

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

SDL's rendering functions operate on a backbuffer; that is, calling a rendering function such as drawLine does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.

Therefore, when using SDL's rendering API, one does all drawing intended for the frame, and then calls this function once per frame to present the final drawing to the user.

The backbuffer should be considered invalidated after each present; do not assume that previous contents will exist between frames. You are strongly encouraged to call clear to initialize the backbuffer before starting each new frame's drawing, even if you plan to overwrite every pixel.

See SDL_RenderPresent for C documentation.

Renderer State

SDL exposes a stateful interface to Renderers - the above primitives drawing routines will change their output depending on the value of these state variables.

rendererDrawBlendMode :: Renderer -> StateVar BlendMode Source #

Get or set the blend mode used for drawing operations (fill and line).

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetRenderDrawBlendMode and SDL_GetRenderDrawBlendMode for C documentation.

rendererDrawColor :: Renderer -> StateVar (V4 Word8) Source #

Get or set the color used for drawing operations (rect, line and clear).

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetRenderDrawColor and SDL_GetRenderDrawColor for C documentation.

rendererRenderTarget :: Renderer -> StateVar (Maybe Texture) Source #

Get or set the current render target. Nothing corresponds to the default render target.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetRenderTarget and SDL_GetRenderTarget for C documentation.

rendererClipRect :: Renderer -> StateVar (Maybe (Rectangle CInt)) Source #

Get or set the clip rectangle for rendering on the specified target.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_RenderSetClipRect and SDL_RenderGetClipRect for C documentation.

rendererLogicalSize :: Renderer -> StateVar (Maybe (V2 CInt)) Source #

Get or set the device independent resolution for rendering.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_RenderSetLogicalSize and SDL_RenderGetLogicalSize for C documentation.

rendererScale :: Renderer -> StateVar (V2 CFloat) Source #

Get or set the drawing scale for rendering on the current target.

The drawing coordinates are scaled by the x/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.

If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.

See SDL_RenderSetScale and SDL_RenderGetScale for C documentation.

rendererViewport :: Renderer -> StateVar (Maybe (Rectangle CInt)) Source #

Get or set the drawing area for rendering on the current target.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_RenderSetViewport and SDL_RenderGetViewport for C documentation.

renderTargetSupported :: MonadIO m => Renderer -> m Bool Source #

Determine whether a window supports the use of render targets.

See SDL_RenderTargetSupported for C documentation.

Surfaces

updateWindowSurface :: (Functor m, MonadIO m) => Window -> m () Source #

Copy the window surface to the screen.

This is the function you use to reflect any changes to the surface on the screen.

See SDL_UpdateWindowSurface for C documentation.

surfaceBlit Source #

Arguments

:: MonadIO m 
=> Surface

The Surface to be copied from

-> Maybe (Rectangle CInt)

The rectangle to be copied, or Nothing to copy the entire surface

-> Surface

The Surface that is the blit target

-> Maybe (Point V2 CInt)

The position to blit to

-> m (Maybe (Rectangle CInt)) 

Perform a fast surface copy to a destination surface.

See SDL_BlitSurface for C documentation.

surfaceBlitScaled Source #

Arguments

:: MonadIO m 
=> Surface

The Surface to be copied from

-> Maybe (Rectangle CInt)

The rectangle to be copied, or Nothing to copy the entire surface

-> Surface

The Surface that is the blit target

-> Maybe (Rectangle CInt)

The rectangle that is copied into, or Nothing to copy into the entire surface

-> m () 

Perform a scaled surface copy to a destination surface.

See SDL_BlitScaled for C documentation.

surfaceFillRect Source #

Arguments

:: MonadIO m 
=> Surface

The Surface that is the drawing target.

-> Maybe (Rectangle CInt)

The rectangle to fill, or Nothing to fill the entire surface.

-> V4 Word8

The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.

-> m () 

Perform a fast fill of a rectangle with a specific color.

If there is a clip rectangle set on the destination (set via clipRect), then this function will fill based on the intersection of the clip rectangle and the given Rectangle.

See SDL_FillRect for C documentation.

surfaceFillRects Source #

Arguments

:: MonadIO m 
=> Surface

The Surface that is the drawing target.

-> Vector (Rectangle CInt)

A Vector of Rectangles to be filled.

-> V4 Word8

The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.

-> m () 

Perform a fast fill of a set of rectangles with a specific color.

If there is a clip rectangle set on any of the destinations (set via clipRect), then this function will fill based on the intersection of the clip rectangle and the given Rectangles.

See SDL_FillRects for C documentation.

Creating and Destroying Surfaces

convertSurface Source #

Arguments

:: (Functor m, MonadIO m) 
=> Surface

The Surface to convert

-> SurfacePixelFormat

The pixel format that the new surface is optimized for

-> m Surface 

Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format.

This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.

See SDL_ConvertSurface for C documentation.

createRGBSurface Source #

Arguments

:: (Functor m, MonadIO m) 
=> V2 CInt

The size of the surface

-> PixelFormat

The bit depth, red, green, blue and alpha mask for the pixels

-> m Surface 

Allocate a new RGB surface.

See SDL_CreateRGBSurface for C documentation.

createRGBSurfaceFrom Source #

Arguments

:: (Functor m, MonadIO m) 
=> IOVector Word8

The existing pixel data

-> V2 CInt

The size of the surface

-> CInt

The pitch - the length of a row of pixels in bytes

-> PixelFormat

The bit depth, red, green, blue and alpha mask for the pixels

-> m Surface 

Allocate a new RGB surface with existing pixel data.

See SDL_CreateRGBSurfaceFrom for C documentation.

freeSurface :: MonadIO m => Surface -> m () Source #

Free an RGB surface.

If the surface was created using createRGBSurfaceFrom then the pixel data is not freed.

See SDL_FreeSurface for the C documentation.

getWindowSurface :: (Functor m, MonadIO m) => Window -> m Surface Source #

Get the SDL surface associated with the window.

See SDL_GetWindowSurface for C documentation.

loadBMP :: MonadIO m => FilePath -> m Surface Source #

Load a surface from a BMP file.

See SDL_LoadBMP for C documentation.

Surface state

surfaceColorKey :: Surface -> StateVar (Maybe (V4 Word8)) Source #

Get or set the color key (transparent pixel color) for a surface.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetColorKey and SDL_GetColorKey for C documentation.

surfaceBlendMode :: Surface -> StateVar BlendMode Source #

Get or set the blend mode used for blit operations.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetSurfaceBlendMode and SDL_GetSurfaceBlendMode for C documentation.

surfaceDimensions :: MonadIO m => Surface -> m (V2 CInt) Source #

Retrive the width and height of a Surface.

surfaceFormat :: MonadIO m => Surface -> m SurfacePixelFormat Source #

Inspect the pixel format under a surface.

surfacePixels :: MonadIO m => Surface -> m (Ptr ()) Source #

Obtain the pointer to the underlying pixels in a surface. You should bracket this call with lockSurface and unlockSurface, respectively.

Accessing Surface Data

lockSurface :: MonadIO m => Surface -> m () Source #

Set up a surface for directly accessing the pixels.

See SDL_LockSurface for C documentation.

unlockSurface :: MonadIO m => Surface -> m () Source #

Release a surface after directly accessing the pixels.

See SDL_UnlockSurface for C documentation.

Palettes and pixel formats

data Palette Source #

Instances

Instances details
Eq Palette Source # 
Instance details

Defined in SDL.Video.Renderer

data PixelFormat Source #

Instances

Instances details
Data PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PixelFormat -> c PixelFormat Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PixelFormat Source #

toConstr :: PixelFormat -> Constr Source #

dataTypeOf :: PixelFormat -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PixelFormat) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PixelFormat) Source #

gmapT :: (forall b. Data b => b -> b) -> PixelFormat -> PixelFormat Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PixelFormat -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PixelFormat -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

Generic PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep PixelFormat :: Type -> Type Source #

Read PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

Show PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

Eq PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

Ord PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

FromNumber PixelFormat Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

ToNumber PixelFormat Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep PixelFormat Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep PixelFormat = D1 ('MetaData "PixelFormat" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (((((C1 ('MetaCons "Unknown" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: C1 ('MetaCons "Index1LSB" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Index1MSB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Index4LSB" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Index4MSB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Index8" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RGB332" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RGB444" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RGB555" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "BGR555" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARGB4444" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RGBA4444" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ABGR4444" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BGRA4444" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARGB1555" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RGBA5551" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ABGR1555" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BGRA5551" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "RGB565" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BGR565" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RGB24" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BGR24" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "RGB888" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RGBX8888" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BGR888" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BGRX8888" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARGB8888" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "RGBA8888" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ABGR8888" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BGRA8888" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARGB2101010" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "YV12" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IYUV" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "YUY2" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UYVY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "YVYU" 'PrefixI 'False) (U1 :: Type -> Type)))))))

setPaletteColors Source #

Arguments

:: MonadIO m 
=> Palette

The Palette to modify

-> Vector (V4 Word8)

A Vector of colours to copy into the palette

-> CInt

The index of the first palette entry to modify

-> m () 

Set a range of colors in a palette.

See SDL_SetPaletteColors for C documentation.

pixelFormatToMasks :: MonadIO m => PixelFormat -> m (CInt, V4 Word32) Source #

Convert the given the enumerated pixel format to a bpp value and RGBA masks.

See SDL_PixelFormatEnumToMasks for C documentation.

masksToPixelFormat :: MonadIO m => CInt -> V4 Word32 -> m PixelFormat Source #

Convert a bpp value and RGBA masks to an enumerated pixel format.

See SDL_MasksToPixelFormatEnum for C documentation.

Textures

data Texture Source #

Instances

Instances details
Eq Texture Source # 
Instance details

Defined in SDL.Video.Renderer

Creating, Using and Destroying Textures

createTexture Source #

Arguments

:: (Functor m, MonadIO m) 
=> Renderer

The rendering context.

-> PixelFormat 
-> TextureAccess 
-> V2 CInt

The size of the texture.

-> m Texture 

Create a texture for a rendering context.

See SDL_CreateTexture for C documentation.

data TextureAccess Source #

Information to the GPU about how you will use a texture.

Constructors

TextureAccessStatic

Changes rarely, cannot be locked

TextureAccessStreaming

changes frequently, can be locked

TextureAccessTarget

Can be used as a render target

Instances

Instances details
Data TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TextureAccess -> c TextureAccess Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TextureAccess Source #

toConstr :: TextureAccess -> Constr Source #

dataTypeOf :: TextureAccess -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TextureAccess) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TextureAccess) Source #

gmapT :: (forall b. Data b => b -> b) -> TextureAccess -> TextureAccess Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TextureAccess -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TextureAccess -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> TextureAccess -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TextureAccess -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TextureAccess -> m TextureAccess Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TextureAccess -> m TextureAccess Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TextureAccess -> m TextureAccess Source #

Bounded TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Enum TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Generic TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep TextureAccess :: Type -> Type Source #

Read TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Show TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Eq TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

Ord TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

FromNumber TextureAccess CInt Source # 
Instance details

Defined in SDL.Video.Renderer

ToNumber TextureAccess CInt Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep TextureAccess Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep TextureAccess = D1 ('MetaData "TextureAccess" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (C1 ('MetaCons "TextureAccessStatic" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TextureAccessStreaming" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TextureAccessTarget" 'PrefixI 'False) (U1 :: Type -> Type)))

createTextureFromSurface Source #

Arguments

:: (Functor m, MonadIO m) 
=> Renderer

The rendering context

-> Surface

The surface containing pixel data used to fill the texture

-> m Texture 

Create a texture from an existing surface.

See SDL_CreateTextureFromSurface for C documentation.

updateTexture Source #

Arguments

:: (Functor m, MonadIO m) 
=> Texture

The Texture to be updated

-> Maybe (Rectangle CInt)

The area to update, Nothing for entire texture

-> ByteString

The raw pixel data

-> CInt

The number of bytes in a row of pixel data, including padding between lines

-> m () 

Updates texture rectangle with new pixel data.

See SDL_UpdateTexture for C documentation.

destroyTexture :: MonadIO m => Texture -> m () Source #

Destroy the specified texture.

See SDL_DestroyTexture for the C documentation.

glBindTexture Source #

Arguments

:: (Functor m, MonadIO m) 
=> Texture

The texture to bind to the current OpenGL/ES/ES2 context

-> m () 

Bind an OpenGL/ES/ES2 texture to the current context for use with when rendering OpenGL primitives directly.

See SDL_GL_BindTexture for C documentation.

glUnbindTexture Source #

Arguments

:: (Functor m, MonadIO m) 
=> Texture

The texture to unbind from the current OpenGL/ES/ES2 context

-> m () 

Unbind an OpenGL/ES/ES2 texture from the current context.

See SDL_GL_UnbindTexture for C documentation.

Texture State

textureAlphaMod :: Texture -> StateVar Word8 Source #

Get or set the additional alpha value multiplied into render copy operations.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetTextureAlphaMod and SDL_GetTextureAlphaMod for C documentation.

textureBlendMode :: Texture -> StateVar BlendMode Source #

Get or set the blend mode used for texture copy operations.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetTextureBlendMode and SDL_GetTextureBlendMode for C documentation.

data BlendMode Source #

Blend modes used in copy and drawing operations.

Constructors

BlendNone

No blending

BlendAlphaBlend

Alpha blending.

dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
dstA = srcA + (dstA * (1-srcA))
BlendAdditive

Additive blending

dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA
BlendMod

Color modulate

@ dstRGB = srcRGB * dstRGB dstA = dstA

Instances

Instances details
Data BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BlendMode -> c BlendMode Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BlendMode Source #

toConstr :: BlendMode -> Constr Source #

dataTypeOf :: BlendMode -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BlendMode) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BlendMode) Source #

gmapT :: (forall b. Data b => b -> b) -> BlendMode -> BlendMode Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BlendMode -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BlendMode -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> BlendMode -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BlendMode -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BlendMode -> m BlendMode Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BlendMode -> m BlendMode Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BlendMode -> m BlendMode Source #

Bounded BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Enum BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Generic BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep BlendMode :: Type -> Type Source #

Read BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Show BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Eq BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

Ord BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

FromNumber BlendMode Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

ToNumber BlendMode Word32 Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep BlendMode Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep BlendMode = D1 ('MetaData "BlendMode" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) ((C1 ('MetaCons "BlendNone" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlendAlphaBlend" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BlendAdditive" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlendMod" 'PrefixI 'False) (U1 :: Type -> Type)))

textureColorMod :: Texture -> StateVar (V3 Word8) Source #

Get or set the additional color value multiplied into render copy operations.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetTextureColorMod and SDL_GetTextureColorMod for C documentation.

Accessing Texture Data

lockTexture Source #

Arguments

:: MonadIO m 
=> Texture

The Texture to lock for access, which must have been created with TextureAccessStreaming

-> Maybe (Rectangle CInt)

The area to lock for access; Nothing to lock the entire texture

-> m (Ptr (), CInt)

A pointer to the locked pixels, appropriately offset by the locked area, and the pitch of the locked pixels (the pitch is the length of one row in bytes).

Lock a portion of the texture for *write-only* pixel access.

See SDL_LockTexture for C documentation.

unlockTexture :: MonadIO m => Texture -> m () Source #

Unlock a texture, uploading the changes to video memory, if needed.

Warning: See Bug No. 1586 before using this function!

See SDL_UnlockTexture for C documentation.

queryTexture :: MonadIO m => Texture -> m TextureInfo Source #

Query the attributes of a texture.

See SDL_QueryTexture for C documentation.

data TextureInfo Source #

Constructors

TextureInfo 

Fields

Instances

Instances details
Generic TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep TextureInfo :: Type -> Type Source #

Read TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Show TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Eq TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Ord TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep TextureInfo Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep TextureInfo = D1 ('MetaData "TextureInfo" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (C1 ('MetaCons "TextureInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "texturePixelFormat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PixelFormat) :*: S1 ('MetaSel ('Just "textureAccess") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TextureAccess)) :*: (S1 ('MetaSel ('Just "textureWidth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt) :*: S1 ('MetaSel ('Just "textureHeight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt))))

data Rectangle a Source #

Constructors

Rectangle (Point V2 a) (V2 a) 

Instances

Instances details
Functor Rectangle Source # 
Instance details

Defined in SDL.Video.Renderer

Methods

fmap :: (a -> b) -> Rectangle a -> Rectangle b Source #

(<$) :: a -> Rectangle b -> Rectangle a Source #

Storable a => Storable (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

Generic (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep (Rectangle a) :: Type -> Type Source #

Methods

from :: Rectangle a -> Rep (Rectangle a) x Source #

to :: Rep (Rectangle a) x -> Rectangle a Source #

Read a => Read (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

Show a => Show (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

Eq a => Eq (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

Ord a => Ord (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep (Rectangle a) Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep (Rectangle a) = D1 ('MetaData "Rectangle" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (C1 ('MetaCons "Rectangle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point V2 a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (V2 a))))

Available Renderers

These functions allow you to query the current system for available Renderers that can be created with createRenderer.

getRendererInfo :: MonadIO m => Renderer -> m RendererInfo Source #

Get information about a rendering context.

See SDL_GetRendererInfo for C documentation.

data RendererInfo Source #

Information about an instantiated Renderer.

Constructors

RendererInfo 

Fields

Instances

Instances details
Generic RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Associated Types

type Rep RendererInfo :: Type -> Type Source #

Read RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Show RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Eq RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

Ord RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererInfo Source # 
Instance details

Defined in SDL.Video.Renderer

type Rep RendererInfo = D1 ('MetaData "RendererInfo" "SDL.Video.Renderer" "sdl2-2.5.5.0-inplace" 'False) (C1 ('MetaCons "RendererInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "rendererInfoName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "rendererInfoFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RendererConfig) :*: S1 ('MetaSel ('Just "rendererInfoNumTextureFormats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) :*: (S1 ('MetaSel ('Just "rendererInfoTextureFormats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PixelFormat]) :*: (S1 ('MetaSel ('Just "rendererInfoMaxTextureWidth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt) :*: S1 ('MetaSel ('Just "rendererInfoMaxTextureHeight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt)))))

getRenderDriverInfo :: MonadIO m => m [RendererInfo] Source #

Enumerate all known render drivers on the system, and determine their supported features.

See SDL_GetRenderDriverInfo for C documentation.