Next: , Previous: , Up: API Reference   [Contents][Index]


3.7 Rendering

(use-modules (sdl2 render))
Procedure: make-renderer window [#:optional flags='(accelerated vsync)]

Return a new renderer for window created with the options specified in flags, a list of symbols. The valid symbols that may appear in flags are:

Procedure: renderer? r

Return #t if r is a renderer.

Procedure: delete-renderer! renderer

Delete the rendering context renderer.

Procedure: call-with-renderer renderer proc

Call proc, passing it renderer and closing renderer upon exit of proc.

Procedure: clear-renderer renderer

Clear the rendering target renderer with the current drawing color.

Procedure: present-renderer renderer

Display renderer.

Procedure: renderer-integer-scale renderer

Returns #t if renderer currently uses integer scaling and #f otherwise. Integer scaling can be used together with logical size to effectively restrict the drawing region to an area even if the window is larger than that.

Procedure: set-renderer-integer-scale! renderer enable?

If enable? is #t, enable integer scaling, otherwise disable it.

Procedure: renderer-logical-size renderer

Return the current logical size used by renderer.

Procedure: set-renderer-logical-size! renderer width height

Set the logical size of renderer to width x height.

Procedure: renderer-scale renderer

Return the scaling factors (X Y) used by renderer to scale coordinates.

Procedure: set-renderer-scale! renderer scale-x scale-y

Set the factors by which renderer scales coordinates according to the scaling factors scale-x and scale-y.

Procedure: renderer-viewport renderer

Return the rectangle that renderer currently draws on. If the entire region is used, all values of that rectangle will be 0.

Procedure: set-renderer-viewport! renderer rect

Set the drawing area for renderer to rect.

Procedure: render-copy renderer texture [#:angle 0] [#:srcrect] [#:dstrect] [#:center]

Copy texture to the rendering target of renderer.

Procedure: set-renderer-draw-color! renderer r g b a

Set color of renderer to the 32-bit color defined by the 8-bit color channels r, g, b, a. Each color channel value is in the range [0, 255].

Procedure: set-renderer-draw-blend-mode! renderer blend-mode

Set blend mode of renderer to blend-mode. See Blend Modes for more information.

Procedure: set-renderer-target! renderer texture

Sets the render target for renderer to texture, making all comming draw requests redirect to texture.

Pass #f to reset it to the default target.

Procedure: renderer-target renderer

Returns the current render target of renderer or #f if it’s a texture.

Procedure: draw-line renderer x1 y1 x2 y2

Draw a line from (x1, y1) to (x2, y2) on the current rendering target of renderer.

Procedure: draw-lines renderer points

Draw a series of connected lines from points on the current rendering target of renderer. Optionally, for best performance, points may instead be a bytevector packed with signed 32 bit integers, 2 per point (x and y).

Procedure: draw-point renderer x y

Draw a point at (x, y) on the current rendering target of renderer.

Procedure: draw-points renderer points

Draw a multiple points from points on the current rendering target of renderer. Optionally, for best performance, points may instead be a bytevector packed with signed 32 bit integers, 2 per point (x and y).

Procedure: draw-rect renderer rectangle

Draw the outline of rectangle onto renderer.

Procedure: draw-rects renderer rects

Draw the outline of all rects in the list rects onto renderer. Optionally, for best performance, rects may instead be a bytevector packed with signed 32 bit integers, 4 per rect (x, y, width, height).

Procedure: fill-rect renderer rectangle

Fill rectangle onto renderer.

Procedure: fill-rects renderer rects

Fill the list rects onto renderer. Optionally, for best performance, rects may instead be a bytevector packed with signed 32 bit integers, 4 per rect (x, y, width, height).

Procedure: make-texture renderer format access width height

Returns a new texture for renderer with pixel format. access is one of the symbols:

Procedure: query-texture texture

Return 4 values for the format, access, width and height of a texture.

Procedure: surface->texture renderer surface

Convert surface to a texture suitable for renderer.

Procedure: delete-texture! texture

Free the memory used by texture.

Procedure: texture-color-mod texture

Get color mod of texture as a list of the integers.

Procedure: texture-alpha-mod texture

Get alpha mod of texture as a single integer.

Procedure: set-texture-color-mod! texture r g b

Set the color mod of texture.

Procedure: set-texture-alpha-mod! texture a

Set the alpha mod of texture.

Procedure: set-texture-blend-mode! texture blend-mode

Set the blend of texture to blend-mode. See Blend Modes for more information.


Next: , Previous: , Up: API Reference   [Contents][Index]