Reworked wgpu buffers, updated glow side to have proper transform location storage, attempting to fix visibility modifiers, implemented some of the feedback received in initial PR.

This commit is contained in:
shan 2022-10-04 18:24:46 -07:00
parent 5d0fffc626
commit 6e7b3ced0b
20 changed files with 411 additions and 417 deletions

View file

@ -8,7 +8,7 @@ pub struct Fill<'a> {
/// The color or gradient of the fill.
///
/// By default, it is set to [`FillStyle::Solid`] `BLACK`.
pub style: FillStyle<'a>,
pub style: Style<'a>,
/// The fill rule defines how to determine what is inside and what is
/// outside of a shape.
@ -24,7 +24,7 @@ pub struct Fill<'a> {
impl <'a> Default for Fill<'a> {
fn default() -> Fill<'a> {
Fill {
style: FillStyle::Solid(Color::BLACK),
style: Style::Solid(Color::BLACK),
rule: FillRule::NonZero,
}
}
@ -33,7 +33,7 @@ impl <'a> Default for Fill<'a> {
impl<'a> From<Color> for Fill<'a> {
fn from(color: Color) -> Fill<'a> {
Fill {
style: FillStyle::Solid(color),
style: Style::Solid(color),
..Fill::default()
}
}
@ -41,18 +41,18 @@ impl<'a> From<Color> for Fill<'a> {
/// The color or gradient of a [`Fill`].
#[derive(Debug, Clone)]
pub enum FillStyle<'a> {
pub enum Style<'a> {
/// A solid color
Solid(Color),
/// A color gradient
Gradient(&'a Gradient),
}
impl <'a> Into<Shader> for FillStyle<'a> {
impl <'a> Into<Shader> for Style<'a> {
fn into(self) -> Shader {
match self {
FillStyle::Solid(color) => Shader::Solid(color),
FillStyle::Gradient(gradient) => gradient.clone().into()
Style::Solid(color) => Shader::Solid(color),
Style::Gradient(gradient) => gradient.clone().into()
}
}
}

View file

@ -8,7 +8,7 @@ pub struct Stroke<'a> {
/// The color or gradient of the stroke.
///
/// By default, it is set to [`StrokeStyle::Solid`] `BLACK`.
pub style: StrokeStyle<'a>,
pub style: Style<'a>,
/// The distance between the two edges of the stroke.
pub width: f32,
/// The shape to be used at the end of open subpaths when they are stroked.
@ -24,7 +24,7 @@ impl<'a> Stroke<'a> {
/// Sets the color of the [`Stroke`].
pub fn with_color(self, color: Color) -> Self {
Stroke {
style: StrokeStyle::Solid(color),
style: Style::Solid(color),
..self
}
}
@ -48,7 +48,7 @@ impl<'a> Stroke<'a> {
impl<'a> Default for Stroke<'a> {
fn default() -> Self {
Stroke {
style: StrokeStyle::Solid(Color::BLACK),
style: Style::Solid(Color::BLACK),
width: 1.0,
line_cap: LineCap::default(),
line_join: LineJoin::default(),
@ -59,18 +59,18 @@ impl<'a> Default for Stroke<'a> {
/// The color or gradient of a [`Stroke`].
#[derive(Debug, Clone, Copy)]
pub enum StrokeStyle<'a> {
pub enum Style<'a> {
/// A solid color
Solid(Color),
/// A color gradient
Gradient(&'a Gradient),
}
impl <'a> Into<Shader> for StrokeStyle<'a> {
impl <'a> Into<Shader> for Style<'a> {
fn into(self) -> Shader {
match self {
StrokeStyle::Solid(color) => Shader::Solid(color),
StrokeStyle::Gradient(gradient) => gradient.clone().into()
Style::Solid(color) => Shader::Solid(color),
Style::Gradient(gradient) => gradient.clone().into()
}
}
}