| author | |
| committer | |
| log | c42f8f1d0eaa0f77ff46afd131b8f778b40552e4 |
| tree | 1d68c1805ecb9d55c01f7e8ab92fec4dbb80ab28 |
| parent | c586d8ba0ca57a50ef2ed5f951b2b4ee9c5361c5 |
2 files changed, 28 insertions(+), 0 deletions(-)
YCbCr.zig created+27| ... | @@ -0,0 +1,27 @@ | ||
| 1 | //! object representing a single color in the YCbCr colorspace with channel values from 0-255 | ||
| 2 | |||
| 3 | const std = @import("std"); | ||
| 4 | const Self = @This(); | ||
| 5 | const color = @import("./mod.zig"); | ||
| 6 | |||
| 7 | y: u8, | ||
| 8 | cb: u8, | ||
| 9 | cr: u8, | ||
| 10 | a: u8, | ||
| 11 | |||
| 12 | pub fn initYCbCrA(y: u8, cb: u8, cr: u8, a: u8) Self { | ||
| 13 | return Self{ | ||
| 14 | .y = y, | ||
| 15 | .cb = cb, | ||
| 16 | .cr = cr, | ||
| 17 | .a = a, | ||
| 18 | }; | ||
| 19 | } | ||
| 20 | |||
| 21 | pub fn initYCbCr(y: u8, cb: u8, cr: u8) Self { | ||
| 22 | return initYCbCrA(y, cb, cr, 255); | ||
| 23 | } | ||
| 24 | |||
| 25 | pub fn eql(x: Self, y: Self) bool { | ||
| 26 | return x.y == y.y and x.cb == y.cb and x.cr == y.cr and x.a == y.a; | ||
| 27 | } | ||
mod.zig+1| ... | @@ -6,3 +6,4 @@ pub const LinearRgb = @import("./LinearRgb.zig"); | ... | @@ -6,3 +6,4 @@ pub const LinearRgb = @import("./LinearRgb.zig"); |
| 6 | pub const CMYK = @import("./CMYK.zig"); | 6 | pub const CMYK = @import("./CMYK.zig"); |
| 7 | pub const HSL = @import("./HSL.zig"); | 7 | pub const HSL = @import("./HSL.zig"); |
| 8 | pub const HSV = @import("./HSV.zig"); | 8 | pub const HSV = @import("./HSV.zig"); |
| 9 | pub const YCbCr = @import("./YCbCr.zig"); |