mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
pkg/macos: CGColorSpace
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
pub const c = @import("graphics/c.zig");
|
||||
pub usingnamespace @import("graphics/color_space.zig");
|
||||
pub usingnamespace @import("graphics/font.zig");
|
||||
|
||||
test {
|
||||
|
24
pkg/macos/graphics/color_space.zig
Normal file
24
pkg/macos/graphics/color_space.zig
Normal file
@ -0,0 +1,24 @@
|
||||
const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const c = @import("c.zig");
|
||||
|
||||
pub const ColorSpace = opaque {
|
||||
pub fn createDeviceGray() Allocator.Error!*ColorSpace {
|
||||
return @intToPtr(
|
||||
?*ColorSpace,
|
||||
@ptrToInt(c.CGColorSpaceCreateDeviceGray()),
|
||||
) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn release(self: *ColorSpace) void {
|
||||
c.CGColorSpaceRelease(@ptrCast(c.CGColorSpaceRef, self));
|
||||
}
|
||||
};
|
||||
|
||||
test {
|
||||
//const testing = std.testing;
|
||||
|
||||
const space = try ColorSpace.createDeviceGray();
|
||||
defer space.release();
|
||||
}
|
Reference in New Issue
Block a user