| ... | ... | @@ -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 | } |