Skip to content

Commit

Permalink
Merge #99
Browse files Browse the repository at this point in the history
99: Fix into and from component tuple conversion for Yxy r=Ogeon a=Ogeon



Co-authored-by: Erik Hedvall <[email protected]>
  • Loading branch information
bors[bot] and Ogeon committed May 26, 2018
2 parents 1d56a48 + 74ec2ed commit f8600f6
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions palette/src/yxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,14 @@ where
}
}

/// Convert to a `(y, x, luma)`, a.k.a. `(y, x, Y)` tuple.
/// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
pub fn into_components(self) -> (T, T, T) {
(self.y, self.x, self.luma)
}

/// Convert from a `(y, x, luma)`, a.k.a. `(y, x, Y)` tuple.
pub fn from_components((y, x, luma): (T, T, T)) -> Self {
Self::with_wp(y, x, luma)
}

/// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple, which is the
/// more classical component order.
pub fn into_xyy_components(self) -> (T, T, T) {
(self.x, self.y, self.luma)
}

/// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple, which is the
/// more classical component order.
pub fn from_xyy_components((x, y, luma): (T, T, T)) -> Self {
Self::with_wp(y, x, luma)
/// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
pub fn from_components((x, y, luma): (T, T, T)) -> Self {
Self::with_wp(x, y, luma)
}
}

Expand Down Expand Up @@ -152,26 +140,14 @@ where
}
}

/// Convert to a `(y, x, luma)`, a.k.a. `(y, x, Y)` tuple.
/// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
pub fn into_components(self) -> (T, T, T, A) {
(self.y, self.x, self.luma, self.alpha)
}

/// Convert from a `(y, x, luma)`, a.k.a. `(y, x, Y)` tuple.
pub fn from_components((y, x, luma, alpha): (T, T, T, A)) -> Self {
Self::with_wp(y, x, luma, alpha)
}

/// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple, which is the
/// more classical component order.
pub fn into_xyy_components(self) -> (T, T, T, A) {
(self.x, self.y, self.luma, self.alpha)
}

/// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple, which is the
/// more classical component order.
pub fn from_xyy_components((x, y, luma, alpha): (T, T, T, A)) -> Self {
Self::with_wp(y, x, luma, alpha)
/// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
pub fn from_components((x, y, luma, alpha): (T, T, T, A)) -> Self {
Self::with_wp(x, y, luma, alpha)
}
}

Expand Down

0 comments on commit f8600f6

Please sign in to comment.