pub struct LabelBuilder<Label> { /* private fields */ }
Expand description
A builder that constructs Rasterizers. Whereas
BinaryRasterizer produces an array of booleans, Rasterizer
produces an array of some generic type (Label
) that implements
Copy and Add though
typically you’d use a numeric type.
LabelBuilder needs the Label
type so the only way to make one
is to specify a Label
value: the background. The background
is
the value we’ll use to initialize the raster array – it
corresponds to the zero value, so you’ll probably want to start
with LabelBuilder::background(0)
or
LabelBuilder::background(0f32)
.
In addition to background
, width
, and height
, you can also
supply a MergeAlgorithm to specify what the rasterizer should do
when two different shapes fill the same pixel. If you don’t supply
anything, the rasterizer will use
Replace by default.
use geo_rasterize::LabelBuilder;
let mut rasterizer = LabelBuilder::background(0i32).width(4).height(5).build()?;
Implementations§
Source§impl<Label> LabelBuilder<Label>
impl<Label> LabelBuilder<Label>
pub fn background(background: Label) -> Self
pub fn width(self, width: usize) -> Self
pub fn height(self, height: usize) -> Self
pub fn geo_to_pix(self, geo_to_pix: Transform) -> Self
pub fn algorithm(self, algorithm: MergeAlgorithm) -> Self
pub fn build(self) -> Result<Rasterizer<Label>>
Trait Implementations§
Source§impl<Label: Clone> Clone for LabelBuilder<Label>
impl<Label: Clone> Clone for LabelBuilder<Label>
Source§fn clone(&self) -> LabelBuilder<Label>
fn clone(&self) -> LabelBuilder<Label>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<Label: Debug> Debug for LabelBuilder<Label>
impl<Label: Debug> Debug for LabelBuilder<Label>
Source§impl<Label: Default> Default for LabelBuilder<Label>
impl<Label: Default> Default for LabelBuilder<Label>
Source§fn default() -> LabelBuilder<Label>
fn default() -> LabelBuilder<Label>
Auto Trait Implementations§
impl<Label> Freeze for LabelBuilder<Label>where
Label: Freeze,
impl<Label> RefUnwindSafe for LabelBuilder<Label>where
Label: RefUnwindSafe,
impl<Label> Send for LabelBuilder<Label>where
Label: Send,
impl<Label> Sync for LabelBuilder<Label>where
Label: Sync,
impl<Label> Unpin for LabelBuilder<Label>where
Label: Unpin,
impl<Label> UnwindSafe for LabelBuilder<Label>where
Label: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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