JUMBO vecmath completion update
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const vm = @import("root");
|
||||
const vm = @import("../root.zig");
|
||||
|
||||
pub const Color = extern struct {
|
||||
r: u8,
|
||||
@@ -33,26 +33,26 @@ pub const Color = extern struct {
|
||||
|
||||
pub inline fn l(comptime literal: []const u8) Color {
|
||||
if (literal.len == 4 and literal[0] == '#') { // #RGB
|
||||
return .initOpaque(
|
||||
return initOpaque(
|
||||
(std.fmt.parseUnsigned(u8, literal[1..2], 16) catch unreachable) * 0x11,
|
||||
(std.fmt.parseUnsigned(u8, literal[2..3], 16) catch unreachable) * 0x11,
|
||||
(std.fmt.parseUnsigned(u8, literal[3..4], 16) catch unreachable) * 0x11,
|
||||
);
|
||||
} else if (literal.len == 5 and literal[0] == '#') { // #RGBA
|
||||
return .init(
|
||||
return init(
|
||||
(std.fmt.parseUnsigned(u8, literal[1..2], 16) catch unreachable) * 0x11,
|
||||
(std.fmt.parseUnsigned(u8, literal[2..3], 16) catch unreachable) * 0x11,
|
||||
(std.fmt.parseUnsigned(u8, literal[3..4], 16) catch unreachable) * 0x11,
|
||||
(std.fmt.parseUnsigned(u8, literal[4..5], 16) catch unreachable) * 0x11,
|
||||
);
|
||||
} else if (literal.len == 7 and literal[0] == '#') { // #RRGGBB
|
||||
return .initOpaque(
|
||||
return initOpaque(
|
||||
(std.fmt.parseUnsigned(u8, literal[1..3], 16) catch unreachable),
|
||||
(std.fmt.parseUnsigned(u8, literal[3..5], 16) catch unreachable),
|
||||
(std.fmt.parseUnsigned(u8, literal[5..7], 16) catch unreachable),
|
||||
);
|
||||
} else if (literal.len == 9 and literal[0] == '#') { // #RRGGBBAA
|
||||
return .init(
|
||||
return init(
|
||||
(std.fmt.parseUnsigned(u8, literal[1..3], 16) catch unreachable),
|
||||
(std.fmt.parseUnsigned(u8, literal[3..5], 16) catch unreachable),
|
||||
(std.fmt.parseUnsigned(u8, literal[5..7], 16) catch unreachable),
|
||||
|
||||
Reference in New Issue
Block a user