MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ place_rect()

MAYAFLUX_API uint32_t MayaFlux::Portal::Forma::Plot::place_rect ( Surface &  surface,
FormaTarget  buf,
const RectSpec &  spec,
uint32_t  relate_to = 0 
)

Place a filled rectangle element onto surface using a target.

buf should be a TRIANGLE_STRIP slice of the plot batch. A plot batch may also contain text slices. Buffer construction is the caller's responsibility.

Parameters
surfaceTarget surface.
bufTarget for the four rectangle vertices.
specRectangle geometry and color.
relate_toIf non-zero, the produced element is related to this id.
Returns
Element id of the produced rect element.

Definition at line 68 of file Plot.cpp.

73{
74 const auto verts = Kinesis::filled_rect(spec.bounds, spec.color);
75 buf.submit(verts);
76
77 Element el;
78 el.with_buffer(std::move(buf))
79 .with_bounds(spec.bounds)
80 .with_name(spec.name);
81
82 if (!spec.interactive)
83 el.non_interactive();
84
85 const uint32_t id = surface.layer().add(std::move(el));
86 if (relate_to != 0)
87 surface.layer().relate(relate_to, id);
88
89 return id;
90}
void submit(const std::vector< uint8_t > &bytes) const
Replace this target's geometry.
Definition Target.cpp:51
bool relate(uint32_t primary_id, uint32_t related_id)
Record that related_id belongs with primary_id.
Definition Layer.cpp:205
Slot add(Element element)
Add an element to the layer.
Definition Layer.cpp:9
Layer & layer() noexcept
Access the spatial registry.
Definition Surface.hpp:159
Element & with_bounds(Kinesis::AABB2D b)
Set the fast-reject AABB.
Definition Element.hpp:109
Element & non_interactive()
Exclude from hit testing.
Definition Element.hpp:279
Element & with_buffer(FormaTarget target)
Attach a FormaBuffer, or a slice of one, as the rendered output for this region.
Definition Element.hpp:195
Element & with_name(std::string n)
Set the human-readable name used in Lila introspection and debug output.
Definition Element.hpp:304
A bounded, renderable region on a window surface.
Definition Element.hpp:61

References MayaFlux::Portal::Forma::Layer::add(), MayaFlux::Portal::Forma::Plot::RectSpec::bounds, MayaFlux::Portal::Forma::Plot::RectSpec::color, MayaFlux::Portal::Forma::Plot::RectSpec::interactive, MayaFlux::Portal::Forma::Surface::layer(), MayaFlux::Portal::Forma::Plot::RectSpec::name, MayaFlux::Portal::Forma::Element::non_interactive(), place_rect(), MayaFlux::Portal::Forma::Layer::relate(), MayaFlux::Portal::Forma::FormaTarget::submit(), MayaFlux::Portal::Forma::Element::with_bounds(), MayaFlux::Portal::Forma::Element::with_buffer(), and MayaFlux::Portal::Forma::Element::with_name().

Referenced by MayaFlux::Portal::Forma::internal::Atelier::place_adornments(), and place_rect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: