Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_capture_lowering.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <optional>
6#include <stdexcept>
7
8namespace pulp::view {
9
13inline std::optional<IRNode> lower_faithful_capture_to_image(
14 const IRNode& node) {
16 return std::nullopt;
17 if (!node.capture_asset_id || node.capture_asset_id->empty())
18 throw std::invalid_argument(
19 "faithful_capture node requires capture_asset_id");
20 IRNode image = node;
21 image.type = "image";
22 // Visual capture is authoritative. Semantic evidence is stored out of band;
23 // leaving audio_widget set would let recognition reclassify this image as
24 // a native silver knob/fader and overwrite the authored pixels.
25 image.audio_widget = AudioWidgetType::none;
26 image.render_mode = NodeRenderMode::normal;
27 // Children of a capture would double-draw: the bitmap already contains
28 // them, so re-emitting them paints the same pixels twice. Control overlays
29 // are the exception the composition contract depends on — a lowered knob
30 // paints ONLY its value geometry (ring, pointer) over the captured body, so
31 // it adds what the still image cannot show rather than repeating it. Drop
32 // everything else, which is what the double-draw rule is actually for.
33 auto controls = std::move(image.children);
34 image.children.clear();
35 for (auto& child : controls)
36 if (child.audio_widget != AudioWidgetType::none)
37 image.children.push_back(std::move(child));
38 image.alternate_frames.clear();
39 image.attributes["asset_ref"] = *node.capture_asset_id;
40 return image;
41}
42
45 node = std::move(*image);
46 for (auto& child : node.children)
48 for (auto& frame : node.alternate_frames)
50}
51
52} // namespace pulp::view
Normalized intermediate representation (IR) for imported designs: the IR value model (style,...
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ faithful_capture
Definition design_ir.hpp:452
@ normal
Definition design_ir.hpp:450
@ none
Definition design_ir.hpp:259
std::optional< IRNode > lower_faithful_capture_to_image(const IRNode &node)
Canonical lowering from an authoritative browser-capture node to the ordinary image-node contract sha...
Definition design_capture_lowering.hpp:13
void lower_faithful_captures_in_place(IRNode &node)
Definition design_capture_lowering.hpp:43
@ image
Definition design_fidelity.hpp:37
Definition design_ir.hpp:614
std::optional< std::string > capture_asset_id
Asset id (into IRAssetManifest) of the browser screenshot backing when render_mode == faithful_captur...
Definition design_ir.hpp:673
std::string type
Definition design_ir.hpp:615
NodeRenderMode render_mode
How this node materializes.
Definition design_ir.hpp:666
std::vector< IRNode > children
Definition design_ir.hpp:636
std::vector< IRNode > alternate_frames
Alternate states of a faithful_svg node (multi-state capture).
Definition design_ir.hpp:691