Поправлены цвета

This commit is contained in:
2026-02-25 22:31:50 +03:00
parent 5c9ec3167a
commit 31ba2c57cb
10 changed files with 26 additions and 25 deletions

View File

@@ -142,11 +142,12 @@ pub const DrawContext = struct {
}
};
/// u32 в порядке 0xRRGGBBAA: старший байт R, младший A (чёрный = 0x000000FF).
pub fn rgbaToPma(rgba: u32) Color.PMA {
const r: u8 = @intCast((rgba >> 0) & 0xFF);
const g: u8 = @intCast((rgba >> 8) & 0xFF);
const b: u8 = @intCast((rgba >> 16) & 0xFF);
const a: u8 = @intCast((rgba >> 24) & 0xFF);
const r: u8 = @intCast((rgba >> 24) & 0xFF);
const g: u8 = @intCast((rgba >> 16) & 0xFF);
const b: u8 = @intCast((rgba >> 8) & 0xFF);
const a: u8 = @intCast((rgba >> 0) & 0xFF);
if (a == 0) return .{ .r = 0, .g = 0, .b = 0, .a = 0 };
const af: f32 = @as(f32, @floatFromInt(a)) / 255.0;
return .{