diff --git a/HSL.zig b/HSL.zig index 72aeef11f0ddf065262c94198e52405651a0b054..9e26cf3045a30942f5958c3b0db66162d758e70f 100644 --- a/HSL.zig +++ b/HSL.zig @@ -27,7 +27,10 @@ pub fn eql(x: Self, y: Self) bool { return x.h == y.h and x.s == y.s and x.l == y.l and x.a == y.a; } -pub usingnamespace _x.mixin(@This(), f32, .h, .s, .l); +const M = _x.mixin(@This(), f32, .h, .s, .l); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; // https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB // https://www.rapidtables.com/convert/color/hsl-to-rgb.html diff --git a/HSV.zig b/HSV.zig index 7c41894f0c74df8624ada522d5fb9a96f823773a..cfcf1489479d8854c34fc35bce912a8f8eb03814 100644 --- a/HSV.zig +++ b/HSV.zig @@ -27,7 +27,10 @@ pub fn eql(x: Self, y: Self) bool { return x.h == y.h and x.s == y.s and x.v == y.v and x.a == y.a; } -pub usingnamespace _x.mixin(@This(), f32, .h, .s, .v); +const M = _x.mixin(@This(), f32, .h, .s, .v); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; // https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB // https://www.rapidtables.com/convert/color/hsv-to-rgb.html diff --git a/LinearRgb.zig b/LinearRgb.zig index 9bfbf8ff423f365551be025815f04898a1a569cd..22a6210fe27657d63c1b584120008b227dcc2195 100644 --- a/LinearRgb.zig +++ b/LinearRgb.zig @@ -34,7 +34,10 @@ pub fn relative_luminance(x: Self) f32 { return (0.2126 * r) + (0.7152 * g) + (0.0722 * b); } -pub usingnamespace _x.mixin(@This(), f32, .r, .g, .b); +const M = _x.mixin(@This(), f32, .r, .g, .b); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; // https://gamedev.stackexchange.com/a/194038 pub fn to_srgb(x: Self) color.sRGB { diff --git a/YCbCr.zig b/YCbCr.zig index 9f355d7255dae3c3e3a58c44677ddce24b398825..f08005e7b0754f0ed6d63f0fffc1b1bc87b62fd5 100644 --- a/YCbCr.zig +++ b/YCbCr.zig @@ -27,7 +27,10 @@ pub fn eql(x: Self, y: Self) bool { return x.y == y.y and x.cb == y.cb and x.cr == y.cr and x.a == y.a; } -pub usingnamespace _x.mixin(@This(), u8, .y, .cb, .cr); +const M = _x.mixin(@This(), u8, .y, .cb, .cr); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; pub fn to_srgb(x: Self) color.sRGB { // zig fmt: off diff --git a/YUV.zig b/YUV.zig index 115baf18bf3603406bd4cefab5c9168019679a7b..e1ae0eb7a0e7fb25a7f80ba58a112f32d8ef8b3f 100644 --- a/YUV.zig +++ b/YUV.zig @@ -26,7 +26,10 @@ pub fn eql(x: Self, y: Self) bool { return x.y == y.y and x.u == y.u and x.v == y.v and x.a == y.a; } -pub usingnamespace _x.mixin(@This(), f32, .y, .u, .v); +pub const M = _x.mixin(@This(), f32, .y, .u, .v); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; // https://web.archive.org/web/20180423091842/http://www.equasys.de/colorconversion.html pub fn to_srgb(x: Self) color.sRGB { diff --git a/sRGB.zig b/sRGB.zig index 3135fb560f33b0d2e7a29bb0656fedc22379a309..a4d65c5a41376078932853bbca4aa495525c1102 100644 --- a/sRGB.zig +++ b/sRGB.zig @@ -67,7 +67,10 @@ pub fn format(x: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, }); } -pub usingnamespace _x.mixin(@This(), u8, .r, .g, .b); +const M = _x.mixin(@This(), u8, .r, .g, .b); +pub const to_vec = M.to_vec; +pub const from_vec = M.from_vec; +pub const to_array = M.to_array; // https://www.w3.org/TR/WCAG/#dfn-relative-luminance // https://webstore.iec.ch/publication/6169