p6::Canvas
Section: Canvas
A canvas is an image that can be drawn onto.
Inherits from p6::ImageOrCanvas
Summary
| Name | |
|---|---|
Canvas(ImageSize size, glpp::TextureLayout texture_layout = {glpp::InternalFormat::RGBA16, glpp::Channels::RGBA, glpp::TexelDataType::UnsignedByte})Creates an empty canvas texture_layout is an advanced setting; it controls how the pixels are gonna be stored on the GPU.  | |
| ImageSize | size() const Returns the size in pixels.  | 
| virtual float | aspect_ratio() const override Returns the aspect ratio ( width / height) | 
| float | inverse_aspect_ratio() const Returns the inverse aspect ratio ( height / width) | 
| virtual const Texture & | texture() const override Returns the internal texture, that you can use to do advanced stuff with custom shaders.  | 
| const glpp::RenderTarget & | render_target() const Returns the internal render target, that you can use to do advanced stuff.  | 
| glpp::RenderTarget & | render_target() Returns the internal render target, that you can use to do advanced stuff.  | 
| void | resize(ImageSize size)Resizes the canvas.  | 
| void | destructive_resize(ImageSize size)Resizes the canvas.  | 
Details
Canvas()
Canvas(
ImageSizesize,glpp::TextureLayouttexture_layout ={glpp::InternalFormat::RGBA16, glpp::Channels::RGBA, glpp::TexelDataType::UnsignedByte});
Creates an empty canvas texture_layout is an advanced setting; it controls how the pixels are gonna be stored on the GPU.
size()
ImageSizesize() const;
Returns the size in pixels.
aspect_ratio()
floataspect_ratio() const override;
Returns the aspect ratio (width / height) 
Reimplements: p6::ImageOrCanvas::aspect_ratio
inverse_aspect_ratio()
floatinverse_aspect_ratio() const;
Returns the inverse aspect ratio (height / width) 
texture()
const Texture &texture() const override;
Returns the internal texture, that you can use to do advanced stuff with custom shaders.
Reimplements: p6::ImageOrCanvas::texture
render_target()
const glpp::RenderTarget &render_target() const;
Returns the internal render target, that you can use to do advanced stuff.
render_target()
glpp::RenderTarget &render_target();
Returns the internal render target, that you can use to do advanced stuff.
resize()
voidresize(ImageSizesize);
Resizes the canvas.
destructive_resize()
voiddestructive_resize(ImageSizesize);
Resizes the canvas.
⚠️ All of its pixel content is lost. If you don't want that you can use resize() instead.
Updated on 2024 October 24