Skip to content

Commit

Permalink
remove CG system header dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
pdoane authored and slimsag committed Sep 17, 2023
1 parent 220c322 commit fbd5d65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/c.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub usingnamespace @cImport({
@cInclude("objc/message.h");
@cInclude("CoreGraphics/CGColorSpace.h");
@cInclude("CoreGraphics/CGGeometry.h");
});
24 changes: 19 additions & 5 deletions src/core_graphics/cg.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
const c = @import("../c.zig");
const builtin = @import("builtin");

pub const ColorSpaceRef = c.CGColorSpaceRef;
pub const Point = c.CGPoint;
pub const Rect = c.CGRect;
pub const Size = c.CGSize;
pub const ColorSpaceRef = *opaque {};

pub const Float = if (builtin.target.ptrBitWidth() == 8) f64 else f32;

pub const Point = extern struct {
x: Float,
y: Float,
};

pub const Size = extern struct {
width: Float,
height: Float,
};

pub const Rect = extern struct {
origin: Point,
size: Size,
};

0 comments on commit fbd5d65

Please sign in to comment.