freetype: rename convertError to intToError
This commit is contained in:
parent
b92770404f
commit
643753c80a
9 changed files with 129 additions and 35 deletions
|
|
@ -4,7 +4,7 @@ const BitmapGlyph = @import("BitmapGlyph.zig");
|
|||
const Stroker = @import("Stroker.zig");
|
||||
const types = @import("types.zig");
|
||||
const Error = @import("error.zig").Error;
|
||||
const convertError = @import("error.zig").convertError;
|
||||
const intToError = @import("error.zig").intToError;
|
||||
|
||||
const Glyph = @This();
|
||||
|
||||
|
|
@ -38,14 +38,14 @@ pub fn deinit(self: Glyph) void {
|
|||
|
||||
pub fn clone(self: Glyph) Error!Glyph {
|
||||
var res = std.mem.zeroes(c.FT_Glyph);
|
||||
try convertError(c.FT_Glyph_Copy(self.handle, &res));
|
||||
try intToError(c.FT_Glyph_Copy(self.handle, &res));
|
||||
return Glyph.init(res);
|
||||
}
|
||||
|
||||
pub fn transform(self: Glyph, matrix: ?types.Matrix, delta: ?types.Vector) Error!void {
|
||||
var m = matrix orelse std.mem.zeroes(types.Matrix);
|
||||
var d = delta orelse std.mem.zeroes(types.Vector);
|
||||
try convertError(c.FT_Glyph_Transform(self.handle, @ptrCast(*c.FT_Matrix, &m), @ptrCast(*c.FT_Vector, &d)));
|
||||
try intToError(c.FT_Glyph_Transform(self.handle, @ptrCast(*c.FT_Matrix, &m), @ptrCast(*c.FT_Vector, &d)));
|
||||
}
|
||||
|
||||
pub fn getCBox(self: Glyph, bbox_mode: BBoxMode) types.BBox {
|
||||
|
|
@ -57,19 +57,19 @@ pub fn getCBox(self: Glyph, bbox_mode: BBoxMode) types.BBox {
|
|||
pub fn toBitmap(self: Glyph, render_mode: types.RenderMode, origin: ?types.Vector) Error!BitmapGlyph {
|
||||
var res = self.handle;
|
||||
var o = origin orelse std.mem.zeroes(types.Vector);
|
||||
try convertError(c.FT_Glyph_To_Bitmap(&res, @enumToInt(render_mode), @ptrCast(*c.FT_Vector, &o), 0));
|
||||
try intToError(c.FT_Glyph_To_Bitmap(&res, @enumToInt(render_mode), @ptrCast(*c.FT_Vector, &o), 0));
|
||||
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, self.handle));
|
||||
}
|
||||
|
||||
pub fn stroke(self: Glyph, stroker: Stroker) Error!Glyph {
|
||||
var res = self.handle;
|
||||
try convertError(c.FT_Glyph_Stroke(&res, stroker.handle, 0));
|
||||
try intToError(c.FT_Glyph_Stroke(&res, stroker.handle, 0));
|
||||
return Glyph.init(res);
|
||||
}
|
||||
|
||||
pub fn strokeBorder(self: Glyph, stroker: Stroker, inside: bool) Error!Glyph {
|
||||
var res = self.handle;
|
||||
try convertError(c.FT_Glyph_StrokeBorder(&res, stroker.handle, if (inside) 1 else 0, 0));
|
||||
try intToError(c.FT_Glyph_StrokeBorder(&res, stroker.handle, if (inside) 1 else 0, 0));
|
||||
return Glyph.init(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue