Canvas

Offscreen drawing.

Header#include "nativeui/gfx/canvas.h"
Namespacenamespace nu
Typeclass (RefCounted)

Constructors

Canvas(const SizeF& size, float scale_factor)

Create a new canvas with specified size and scale factor.

Parameters

Canvas(const SizeF& size)

Create a new canvas with size using default scale factor.

This is strongly discouraged for using, since it does not work well with multi-monitor setup. Only use it when you do not care about per-monitor DPI.

Parameters

Methods

float GetScaleFactor() const

Return the scale factor of the canvas.

Return

float

Painter* GetPainter()

Return the Painter that can be used to draw on the canvas.

Return

Painter*

SizeF GetSize() const

Return the DIP size of canvas.

Return

SizeF