mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
Serialize Color as srgb (#1136)
This commit is contained in:
committed by
Keavon Chambers
parent
b626d39035
commit
f68bc42fc9
@@ -102,16 +102,14 @@ pub trait Pixel: Clone + Pod + Zeroable {
|
||||
bytemuck::bytes_of(self).to_vec()
|
||||
}
|
||||
// TODO: use u8 for Color
|
||||
fn from_bytes(bytes: &[u8]) -> &Self {
|
||||
bytemuck::try_from_bytes(bytes).expect("Failed to convert bytes to pixel")
|
||||
fn from_bytes(bytes: &[u8]) -> Self {
|
||||
*bytemuck::try_from_bytes(bytes).expect("Failed to convert bytes to pixel")
|
||||
}
|
||||
|
||||
fn byte_size() -> usize {
|
||||
std::mem::size_of::<Self>()
|
||||
}
|
||||
}
|
||||
impl<T: Serde + Clone + Pod + Zeroable> Pixel for T {}
|
||||
|
||||
pub trait RGB: Pixel {
|
||||
type ColorChannel: Channel;
|
||||
fn red(&self) -> Self::ColorChannel;
|
||||
|
||||
Reference in New Issue
Block a user