mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 14:01:37 +02:00
♻️ Refactor adding gradient stops
This commit is contained in:
parent
5e9f533624
commit
7105e49ac2
3 changed files with 32 additions and 26 deletions
|
@ -4,6 +4,23 @@ use super::Color;
|
|||
use crate::math;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
pub struct RawStopData {
|
||||
color: [u8; 4],
|
||||
offset: u8,
|
||||
}
|
||||
|
||||
impl RawStopData {
|
||||
pub fn color(&self) -> skia::Color {
|
||||
skia::Color::from_argb(self.color[3], self.color[0], self.color[1], self.color[2])
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> f32 {
|
||||
self.offset as f32 / 100.0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Gradient {
|
||||
colors: Vec<Color>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue