Add transform stack to canvas::Frame
This commit is contained in:
parent
76df374624
commit
558abf648b
6 changed files with 122 additions and 12 deletions
|
|
@ -44,11 +44,18 @@ impl Color {
|
|||
///
|
||||
/// [`Color`]: struct.Color.html
|
||||
pub fn from_rgb8(r: u8, g: u8, b: u8) -> Color {
|
||||
Color::from_rgba8(r, g, b, 1.0)
|
||||
}
|
||||
|
||||
/// Creates a [`Color`] from its RGB8 components and an alpha value.
|
||||
///
|
||||
/// [`Color`]: struct.Color.html
|
||||
pub fn from_rgba8(r: u8, g: u8, b: u8, a: f32) -> Color {
|
||||
Color {
|
||||
r: f32::from(r) / 255.0,
|
||||
g: f32::from(g) / 255.0,
|
||||
b: f32::from(b) / 255.0,
|
||||
a: 1.0,
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,15 @@ pub struct Point {
|
|||
}
|
||||
|
||||
impl Point {
|
||||
/// The origin (i.e. a [`Point`] with both X=0 and Y=0).
|
||||
///
|
||||
/// [`Point`]: struct.Point.html
|
||||
pub const ORIGIN: Point = Point::new(0.0, 0.0);
|
||||
|
||||
/// Creates a new [`Point`] with the given coordinates.
|
||||
///
|
||||
/// [`Point`]: struct.Point.html
|
||||
pub fn new(x: f32, y: f32) -> Self {
|
||||
pub const fn new(x: f32, y: f32) -> Self {
|
||||
Self { x, y }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue