pub struct Frame<'a> { /* private fields */ }Expand description
One frame of drawing into a SoftwareRenderer’s surface, from
SoftwareRenderer::begin_frame.
Draw calls rasterize immediately, in call order, each blended over what is already there. See the crate documentation for coordinates, sampling, and blending.
Implementations§
Source§impl Frame<'_>
impl Frame<'_>
Sourcepub const fn surface(&self) -> &SoftwareSurface
pub const fn surface(&self) -> &SoftwareSurface
The pixels drawn so far.
Sourcepub fn fill_rect(
&mut self,
rect: Rect,
color: Color,
clip: ClipRect,
) -> Result<(), Error>
pub fn fill_rect( &mut self, rect: Rect, color: Color, clip: ClipRect, ) -> Result<(), Error>
Blends a solid rectangle over the surface.
A pixel is covered when its center lies in rect: min < center <= max on each axis.
A rectangle with max <= min on either axis covers nothing.
§Errors
Error::NonFiniteRect if a coordinate is NaN or infinite.
Sourcepub fn textured_rect(
&mut self,
rect: Rect,
uv: Rect,
texture: TextureId,
tint: Color,
clip: ClipRect,
) -> Result<(), Error>
pub fn textured_rect( &mut self, rect: Rect, uv: Rect, texture: TextureId, tint: Color, clip: ClipRect, ) -> Result<(), Error>
Blends texture over rect, mapping uv.min to the rectangle’s top-left corner and
uv.max to its bottom-right, each texel multiplied by the premultiplied tint
(Color::WHITE leaves it unchanged). Coverage is as in Frame::fill_rect.
§Errors
Error::NonFiniteRect for a NaN or infinite coordinate in rect or uv, and
Error::UnknownTexture for a freed or foreign texture.
Sourcepub fn mesh(&mut self, mesh: Mesh<'_>, clip: ClipRect) -> Result<(), Error>
pub fn mesh(&mut self, mesh: Mesh<'_>, clip: ClipRect) -> Result<(), Error>
Blends a triangle mesh over the surface.
A pixel is covered when its center falls inside a triangle. Centers exactly on an edge go to one side by a fixed tie-break, so triangles sharing an edge never both blend a pixel on it. Colors interpolate across each triangle; texels are sampled nearest-neighbor.
§Errors
Error::IndexCount if the index count is not a multiple of three,
Error::IndexOutOfRange for an index past the vertices,
Error::NonFiniteVertex for a NaN or infinite position or texture coordinate on any
vertex, referenced or not, and Error::UnknownTexture for a freed or foreign texture.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Frame<'a>
impl<'a> !UnwindSafe for Frame<'a>
impl<'a> Freeze for Frame<'a>
impl<'a> Send for Frame<'a>
impl<'a> Sync for Frame<'a>
impl<'a> Unpin for Frame<'a>
impl<'a> UnsafeUnpin for Frame<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more