Skip to content

Commit

Permalink
fix rgb ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed May 13, 2024
1 parent b3b137a commit e73e6ae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl core::fmt::Debug for RGB {
impl RGB {
pub fn new(r: u8, g: u8, b: u8) -> Self {
Self {
unpacked: [r, g, b, 0],
unpacked: [b, g, r, 0],
}
}

Expand All @@ -62,27 +62,27 @@ impl RGB {
}

pub fn r(&self) -> u8 {
unsafe { self.unpacked[0] }
unsafe { self.unpacked[2] }
}

pub fn g(&self) -> u8 {
unsafe { self.unpacked[1] }
}

pub fn b(&self) -> u8 {
unsafe { self.unpacked[2] }
unsafe { self.unpacked[0] }
}

pub fn set_r(&mut self, r: u8) {
unsafe { self.unpacked[0] = r }
unsafe { self.unpacked[2] = r }
}

pub fn set_g(&mut self, g: u8) {
unsafe { self.unpacked[1] = g }
}

pub fn set_b(&mut self, b: u8) {
unsafe { self.unpacked[2] = b }
unsafe { self.unpacked[0] = b }
}
}

Expand Down

0 comments on commit e73e6ae

Please sign in to comment.