create
Create a texture that can be rendered with renderTexture.
Remember to destroy the texture at some point, see destroyLater.
Only valid between Window.begin and Window.end.
Parameters
- pixels:[]const Color.PMA
- []const Color.PMA
- options:CreateOptions
- CreateOptions
Source
Implementation
pub fn create(pixels: []const Color.PMA, options: CreateOptions) TextureError!Texture {
if (pixels.len != options.width * options.height) {
dvui.log.err("Texture was created with an incorrect amount of pixels, expected {d} but got {d} (w: {d}, h: {d})", .{ pixels.len, options.width * options.height, options.width, options.height });
}
dvui.currentWindow().render_stats.textures_created += 1;
return dvui.currentWindow().backend.textureCreate(@ptrCast(pixels.ptr), options);
}