Recording

class Recording

Immutable command buffer containing recorded draw operations.

Public Functions

Recording(std::vector<CompactDrawOp> ops, DrawOpArena arena, std::vector<std::shared_ptr<Image>> images, std::vector<Path> paths, std::vector<std::shared_ptr<Shader>> shaders, std::vector<std::shared_ptr<ColorFilter>> colorFilters)
void accept(DrawOpVisitor &visitor) const
inline const DrawOpArena &arena() const
inline const std::vector<std::shared_ptr<ColorFilter>> &colorFilters() const
void dispatch(DrawOpVisitor &visitor, const class DrawPass &pass) const
const ColorFilter *getColorFilter(u16 index) const
const Image *getImage(u32 index) const
const Path *getPath(u32 index) const
const Shader *getShader(u16 index) const
inline const std::vector<std::shared_ptr<Image>> &images() const
inline const std::vector<CompactDrawOp> &ops() const
inline const std::vector<Path> &paths() const
inline const std::vector<std::shared_ptr<Shader>> &shaders() const
class Recorder

Records draw operations into a compact command buffer.

Public Functions

void clearClip()
void clearTransform()
void drawImage(std::shared_ptr<Image> image, f32 x, f32 y)
void drawImageRect(std::shared_ptr<Image> image, Rect src, Rect dst, const Paint &p)
void drawLine(Point p1, Point p2, Color c, f32 width)
void drawLine(Point p1, Point p2, const Paint &p)
void drawPolyline(const Point *pts, i32 count, Color c, f32 width)
void drawPolyline(const Point *pts, i32 count, const Paint &p)
void drawText(Point p, std::string_view text, Color c)
void drawText(Point pos, std::string_view text, const Paint &p)
void fillCircle(f32 cx, f32 cy, f32 radius, Color c)
void fillCircle(f32 cx, f32 cy, f32 radius, const Paint &p)
void fillPath(const Path &path, const Paint &p)
void fillRect(Rect r, Color c)
void fillRect(Rect r, const Paint &p)
void fillRoundRect(Rect r, f32 rx, f32 ry, Color c)
void fillRoundRect(Rect r, f32 rx, f32 ry, const Paint &p)
std::unique_ptr<Recording> finish()
void reset()
void setClip(Rect r)
void setClipPath(const Path &path, bool antiAlias = true)
void setTransform(const Matrix &m)
void strokeCircle(f32 cx, f32 cy, f32 radius, Color c, f32 width)
void strokeCircle(f32 cx, f32 cy, f32 radius, const Paint &p)
void strokePath(const Path &path, const Paint &p)
void strokeRect(Rect r, Color c, f32 width)
void strokeRect(Rect r, const Paint &p)
void strokeRoundRect(Rect r, f32 rx, f32 ry, Color c, f32 width)
void strokeRoundRect(Rect r, f32 rx, f32 ry, const Paint &p)
class DrawOpArena

Arena allocator for variable-length DrawOp data.

Public Functions

explicit DrawOpArena(size_t initialCapacity = 4096)
u32 allocate(size_t bytes)
const Matrix *getMatrix(u32 offset) const
const Point *getPoints(u32 offset) const
void getRectPair(u32 offset, Rect &src, Rect &dst) const
void getRoundRect(u32 offset, Rect &r, f32 &rx, f32 &ry) const
const char *getString(u32 offset) const
void reset()
u32 storeMatrix(const Matrix &m)
u32 storePoints(const Point *pts, i32 count)
u32 storeRectPair(Rect src, Rect dst)

Store two rects (src + dst) for drawImageRect.

u32 storeRoundRect(Rect r, f32 rx, f32 ry)
u32 storeString(std::string_view str)