pub struct Context { /* private fields */ }Expand description
Context for 2D (distance field) rendering
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(gpu: &Gpu) -> Self
pub fn new(gpu: &Gpu) -> Self
Build a new 2D rendering context, given a device and queue
If render timestamps are desirable, then the device should be
initialized with wgpu::Features::TIMESTAMP_QUERY.
Sourcepub fn run(
&self,
shape: &RenderShape,
workspace: &mut Workspace,
out: &mut ReadBuffer<PixelBufferTag>,
settings: RenderConfig,
) -> Result<Image, SubmitError>
pub fn run( &self, shape: &RenderShape, workspace: &mut Workspace, out: &mut ReadBuffer<PixelBufferTag>, settings: RenderConfig, ) -> Result<Image, SubmitError>
Renders the image, with a blocking wait to read pixel data from the GPU
This function is not present when built for the wasm32 target
Sourcepub fn run_with_vars(
&self,
shape: &RenderShape,
vars: &ShapeVars<f32>,
workspace: &mut Workspace,
out: &mut ReadBuffer<PixelBufferTag>,
settings: RenderConfig,
) -> Result<Image, SubmitError>
pub fn run_with_vars( &self, shape: &RenderShape, vars: &ShapeVars<f32>, workspace: &mut Workspace, out: &mut ReadBuffer<PixelBufferTag>, settings: RenderConfig, ) -> Result<Image, SubmitError>
Renders the image, with a blocking wait to read pixel data from the GPU
This function is not present when built for the wasm32 target
Sourcepub async fn run_async(
&self,
shape: &RenderShape,
workspace: &mut Workspace,
out: &mut ReadBuffer<PixelBufferTag>,
settings: RenderConfig,
) -> Result<Image, SubmitError>
pub async fn run_async( &self, shape: &RenderShape, workspace: &mut Workspace, out: &mut ReadBuffer<PixelBufferTag>, settings: RenderConfig, ) -> Result<Image, SubmitError>
Renders the image, with an async wait to read pixel data from the GPU
Sourcepub async fn run_with_vars_async(
&self,
shape: &RenderShape,
vars: &ShapeVars<f32>,
workspace: &mut Workspace,
out: &mut ReadBuffer<PixelBufferTag>,
settings: RenderConfig,
) -> Result<Image, SubmitError>
pub async fn run_with_vars_async( &self, shape: &RenderShape, vars: &ShapeVars<f32>, workspace: &mut Workspace, out: &mut ReadBuffer<PixelBufferTag>, settings: RenderConfig, ) -> Result<Image, SubmitError>
Renders the image, with an async wait to read pixel data from the GPU
Sourcepub fn submit(
&self,
shape: &RenderShape,
workspace: &mut Workspace,
settings: &RenderConfig,
) -> Result<(), SubmitError>
pub fn submit( &self, shape: &RenderShape, workspace: &mut Workspace, settings: &RenderConfig, ) -> Result<(), SubmitError>
Submits a single image to be rendered on the GPU
The resulting image (as a buffer of RawDistancePixel data) is
available on the GPU in buffers.output().
Sourcepub fn submit_with_vars(
&self,
shape: &RenderShape,
vars: &ShapeVars<f32>,
workspace: &mut Workspace,
settings: &RenderConfig,
) -> Result<(), SubmitError>
pub fn submit_with_vars( &self, shape: &RenderShape, vars: &ShapeVars<f32>, workspace: &mut Workspace, settings: &RenderConfig, ) -> Result<(), SubmitError>
Submits a single image to be rendered on the GPU, with extra variables
See submit for additional details.
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl !UnwindSafe for Context
impl Unpin for Context
impl UnsafeUnpin for Context
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.