Starts copying the pixels of source back to the CPU without waiting for them. Poll with pixel_read_is_done, then collect them with pixel_read_end.
- source: the render target to read.
- dest_format: the format of the pixels you get back.
- width: size of the result in pixels;
sourceis scaled to fit. -1 keeps the size ofsource. - height: size of the result in pixels. -1 keeps the size of
source. - srgb: treats the result as sRGB-encoded.
- flip: reverses the order of the rows, so the top row comes first.
target := texture_create_render_target(256, 256, .RGBA8);
reader := pixel_read_begin(*target, .RGBA8, flip = true);
while !pixel_read_is_done(reader) {}
bitmap := pixel_read_end(reader);This one is only checked to compile, not run.
pixel_read_begin :: (
source: *Texture,
dest_format: Texture_Format,
width: s32 = -1,
height: s32 = -1,
srgb := false,
flip := false
) -> *Pixel_Read
Starts copying the pixels of source back to the CPU without waiting for them. Poll with pixel_read_is_done, then collect them with pixel_read_end.
Parameters
- source: *Texture
- the render target to read.
- dest_format: Texture_Format
- the format of the pixels you get back.
- width: s32 = -1
- size of the result in pixels;
sourceis scaled to fit. -1 keeps the size ofsource. - height: s32 = -1
- size of the result in pixels. -1 keeps the size of
source. - srgb := false
- treats the result as sRGB-encoded.
- flip := false
- reverses the order of the rows, so the top row comes first.
Returns
target := texture_create_render_target(256, 256, .RGBA8);
reader := pixel_read_begin(*target, .RGBA8, flip = true);
while !pixel_read_is_done(reader) {}
bitmap := pixel_read_end(reader);This one is only checked to compile, not run.