freetype: initial import @ 4e2b158
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
0d2675507d
commit
b50dade2fd
20 changed files with 2252 additions and 0 deletions
35
freetype/src/BitmapGlyph.zig
Normal file
35
freetype/src/BitmapGlyph.zig
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
const std = @import("std");
|
||||
const c = @import("c.zig");
|
||||
const Bitmap = @import("Bitmap.zig");
|
||||
const Error = @import("error.zig").Error;
|
||||
const convertError = @import("error.zig").convertError;
|
||||
|
||||
const BitmapGlyph = @This();
|
||||
|
||||
handle: c.FT_BitmapGlyph,
|
||||
|
||||
pub fn init(handle: c.FT_BitmapGlyph) BitmapGlyph {
|
||||
return BitmapGlyph{ .handle = handle };
|
||||
}
|
||||
|
||||
pub fn deinit(self: BitmapGlyph) void {
|
||||
c.FT_Done_Glyph(@ptrCast(c.FT_Glyph, self.handle));
|
||||
}
|
||||
|
||||
pub fn clone(self: BitmapGlyph) Error!BitmapGlyph {
|
||||
var res = std.mem.zeroes(c.FT_Glyph);
|
||||
try convertError(c.FT_Glyph_Copy(@ptrCast(c.FT_Glyph, self.handle), &res));
|
||||
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, res));
|
||||
}
|
||||
|
||||
pub fn left(self: BitmapGlyph) i32 {
|
||||
return self.handle.*.left;
|
||||
}
|
||||
|
||||
pub fn top(self: BitmapGlyph) i32 {
|
||||
return self.handle.*.top;
|
||||
}
|
||||
|
||||
pub fn bitmap(self: BitmapGlyph) Bitmap {
|
||||
return Bitmap.init(self.handle.*.bitmap);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue