pkg/macos: starting frames

This commit is contained in:
Mitchell Hashimoto
2022-10-08 17:52:01 -07:00
parent cc14344bf8
commit 1e2e4169a5
3 changed files with 61 additions and 0 deletions

29
pkg/macos/text/frame.zig Normal file
View File

@@ -0,0 +1,29 @@
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const foundation = @import("../foundation.zig");
const graphics = @import("../graphics.zig");
const text = @import("../text.zig");
const c = @import("c.zig");
pub const Frame = opaque {
pub fn release(self: *Frame) void {
foundation.CFRelease(self);
}
pub fn getLineOrigins(
self: *Frame,
range: foundation.Range,
points: []graphics.Point,
) void {
c.CTFrameGetLineOrigins(
@ptrCast(c.CTFrameRef, self),
@bitCast(c.CFRange, range),
@ptrCast(*c.CGPoint, points.ptr),
);
}
};
test {
// See framesetter tests...
}