Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::render::SkpFrameCapture Class Reference

Records a single frame's draw ops into an SkPicture and serializes it to a .skp artifact. More...

#include <skp_capture.hpp>

Public Member Functions

 SkpFrameCapture (int width, int height, skgpu::graphite::Context *graphite_context=nullptr)
 Begin a capture sized to width x height logical pixels.
 ~SkpFrameCapture ()
 SkpFrameCapture (const SkpFrameCapture &)=delete
SkpFrameCapture & operator= (const SkpFrameCapture &)=delete
bool available () const
 True when Skia is compiled in and the recording canvas exists.
canvas::Canvas * canvas ()
 The canvas to paint the frame into.
SkpCaptureResult finish_to_file (const std::string &path)
 Finish recording and write the .skp to path.
SkpCaptureResult finish_to_memory (std::string &out_blob)
 Finish recording and serialize the .skp into out_blob (raw .skp bytes).

Detailed Description

Records a single frame's draw ops into an SkPicture and serializes it to a .skp artifact.

Usage: SkpFrameCapture capture(width, height); if (capture.available()) { root_view.paint_all(*capture.canvas()); // re-run the paint auto result = capture.finish_to_file(path); }

The capture canvas is a normal pulp::canvas::Canvas, so any code that paints a live frame paints a capture frame unchanged. After finish_to_file / finish_to_memory the capture is consumed and canvas() returns nullptr.

Constructor & Destructor Documentation

◆ SkpFrameCapture() [1/2]

pulp::render::SkpFrameCapture::SkpFrameCapture ( int width,
int height,
skgpu::graphite::Context * graphite_context = nullptr )
explicit

Begin a capture sized to width x height logical pixels.

The cull rect of the recorded SkPicture is [0,0,width,height].

graphite_context is optional. Pass the live Graphite Context (e.g. from the SkiaSurface the frame is rendered on) when the frame may embed GPU-texture-backed images — atlas glyphs, surface snapshots. The capture uses it to read those images off the GPU so they PNG-encode into the .skp. A purely vector / raster-image frame needs no context and nullptr is fine.

◆ ~SkpFrameCapture()

pulp::render::SkpFrameCapture::~SkpFrameCapture ( )

◆ SkpFrameCapture() [2/2]

pulp::render::SkpFrameCapture::SkpFrameCapture ( const SkpFrameCapture & )
delete

Member Function Documentation

◆ available()

bool pulp::render::SkpFrameCapture::available ( ) const

True when Skia is compiled in and the recording canvas exists.

False builds degrade gracefully — canvas() is nullptr and finish_* return a failed result.

◆ canvas()

canvas::Canvas * pulp::render::SkpFrameCapture::canvas ( )

The canvas to paint the frame into.

Valid until finish_* is called or the capture is destroyed; nullptr when unavailable.

◆ finish_to_file()

SkpCaptureResult pulp::render::SkpFrameCapture::finish_to_file ( const std::string & path)

Finish recording and write the .skp to path.

Embedded images are PNG-encoded via SkSerialProcs::fImageProc. Consumes the capture: a second call returns a failed result.

◆ finish_to_memory()

SkpCaptureResult pulp::render::SkpFrameCapture::finish_to_memory ( std::string & out_blob)

Finish recording and serialize the .skp into out_blob (raw .skp bytes).

Useful for tests and in-memory transport. Consumes the capture.

◆ operator=()

SkpFrameCapture & pulp::render::SkpFrameCapture::operator= ( const SkpFrameCapture & )
delete

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/render/include/pulp/render/skp_capture.hpp