pub struct ScreenPrimitive2d { /* private fields */ }Expand description
One validated solid primitive in viewport-local logical pixels. Coordinates have a top-left origin and positive y downward. Clipping is viewport-local, not translated with the primitive. Shapes are independent; a sequence of capsules is not a polyline join implementation. Constructors reject non-portable geometry, non-normalized linear RGBA and unrepresentable source precision. Drawing additionally checks a combined boundary-error bound of 0.25 physical pixels at the actual target density; accepted construction does not guarantee acceptance at every later DPI.
Implementations§
Source§impl ScreenPrimitive2d
impl ScreenPrimitive2d
Sourcepub fn circle(
center: LogicalScreenPosition,
radius: LogicalPixels,
color: Color,
) -> Result<Self, ScreenPrimitiveError>
pub fn circle( center: LogicalScreenPosition, radius: LogicalPixels, color: Color, ) -> Result<Self, ScreenPrimitiveError>
Creates a filled analytic circle. Colors must be finite normalized linear RGBA.
Sourcepub fn round_line(
from: LogicalScreenPosition,
to: LogicalScreenPosition,
width: LogicalPixels,
color: Color,
) -> Result<Self, ScreenPrimitiveError>
pub fn round_line( from: LogicalScreenPosition, to: LogicalScreenPosition, width: LogicalPixels, color: Color, ) -> Result<Self, ScreenPrimitiveError>
Creates an independent round-capped line of positive logical-pixel width. Coincident endpoints are rejected; use a circle for a point. Extremely disproportionate length/width is rejected when cap coordinates lose portable f32 resolution, rather than silently rendering square ends.
Sourcepub fn rect(
minimum: LogicalScreenPosition,
size: LogicalScreenVector,
color: Color,
) -> Result<Self, ScreenPrimitiveError>
pub fn rect( minimum: LogicalScreenPosition, size: LogicalScreenVector, color: Color, ) -> Result<Self, ScreenPrimitiveError>
Creates a square-cornered filled rectangle with strictly positive logical size.
Sourcepub const fn with_clip(self, clip: ScreenClipRect) -> Self
pub const fn with_clip(self, clip: ScreenClipRect) -> Self
Captures a previously validated viewport-local logical clip.
Sourcepub const fn clip(self) -> Option<ScreenClipRect>
pub const fn clip(self) -> Option<ScreenClipRect>
Optional viewport-local logical clip captured by this primitive.
Sourcepub fn from_screen_scene(
scene: &ScreenScene,
) -> Result<Vec<Self>, ScreenPrimitiveError>
pub fn from_screen_scene( scene: &ScreenScene, ) -> Result<Vec<Self>, ScreenPrimitiveError>
Converts supported commands in stable scene order without partial output. Only solid filled unstroked circles/square rectangles and independent round logical-width lines are accepted. Gradients, shadows, polylines, dashes, markers and other styles return their source command index. The scene background is not part of the batch; pass it to begin_frame.