struct

Tryst::SDL::Renderer::Pixels

Inherits Struct < Value < Object

A snapshot of what was drawn, for tests and screenshots.

Reading pixels back stalls the GPU, so this is deliberately not something to do per frame - but it is the only way to assert that a draw call actually put the colour where it was asked to, which is worth a great deal in a suite that otherwise can only check that nothing crashed.

Constructors

new(surface : Pointer(LibSDL::Surface), width : Int32, height : Int32)

@api private

Source

Instance methods

[](x : Int32, y : Int32) : Color

The colour at a point. Raises rather than returning a wrong colour if the read fails.

Source
height
Source
release

@api private - Renderer#read_pixels frees this once the block it yielded to has finished.

Source
width
Source