authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-10-03 15:00:57 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-10-03 15:00:57 -07:00
logc42f8f1d0eaa0f77ff46afd131b8f778b40552e4
tree1d68c1805ecb9d55c01f7e8ab92fec4dbb80ab28
parentc586d8ba0ca57a50ef2ed5f951b2b4ee9c5361c5

add YCbCr


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
3const std = @import("std");
4const Self = @This();
5const color = @import("./mod.zig");
6
7y: u8,
8cb: u8,
9cr: u8,
10a: u8,
11
12pub 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
21pub fn initYCbCr(y: u8, cb: u8, cr: u8) Self {
22 return initYCbCrA(y, cb, cr, 255);
23}
24
25pub 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");
66pub const CMYK = @import("./CMYK.zig");
77pub const HSL = @import("./HSL.zig");
88pub const HSV = @import("./HSV.zig");
9pub const YCbCr = @import("./YCbCr.zig");