freetype: install test exe and move all tests to src/main.zig
This commit is contained in:
parent
956e07b2ba
commit
a6a678b912
20 changed files with 72 additions and 1107 deletions
71
freetype/src/computations.zig
Normal file
71
freetype/src/computations.zig
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
const _c = @import("c");
|
||||
const intToError = @import("error.zig").intToError;
|
||||
const Error = @import("error.zig").Error;
|
||||
|
||||
const Vector = @import("image.zig").Vector;
|
||||
const Matrix = @import("types.zig").Matrix;
|
||||
|
||||
pub const angel_pi = _c.FT_ANGLE_PI;
|
||||
pub const angel_2pi = _c.FT_ANGLE_2PI;
|
||||
pub const angel_pi2 = _c.FT_ANGLE_PI2;
|
||||
pub const angel_pi4 = _c.FT_ANGLE_PI4;
|
||||
|
||||
pub fn mulDiv(a: i32, b: i32, c: i32) i32 {
|
||||
return @intCast(i32, _c.FT_MulDiv(a, b, c));
|
||||
}
|
||||
|
||||
pub fn mulFix(a: i32, b: i32) i32 {
|
||||
return @intCast(i32, _c.FT_MulFix(a, b));
|
||||
}
|
||||
|
||||
pub fn divFix(a: i32, b: i32) i32 {
|
||||
return @intCast(i32, _c.FT_DivFix(a, b));
|
||||
}
|
||||
|
||||
pub fn roundFix(a: i32) i32 {
|
||||
return @intCast(i32, _c.FT_RoundFix(a));
|
||||
}
|
||||
|
||||
pub fn ceilFix(a: i32) i32 {
|
||||
return @intCast(i32, _c.FT_CeilFix(a));
|
||||
}
|
||||
|
||||
pub fn floorFix(a: i32) i32 {
|
||||
return @intCast(i32, _c.FT_FloorFix(a));
|
||||
}
|
||||
|
||||
pub fn vectorTransform(vec: *Vector, matrix: Matrix) void {
|
||||
_c.FT_Vector_Transform(vec, &matrix);
|
||||
}
|
||||
|
||||
pub fn matrixMul(a: Matrix, b: *Matrix) void {
|
||||
_c.FT_Matrix_Multiply(&a, b);
|
||||
}
|
||||
|
||||
pub fn matrixInvert(m: *Matrix) Error!void {
|
||||
try intToError(_c.FT_Matrix_Invert(m));
|
||||
}
|
||||
|
||||
pub fn angleDiff(a: i32, b: i32) i32 {
|
||||
return @intCast(i32, _c.FT_Angle_Diff(a, b));
|
||||
}
|
||||
|
||||
pub fn vectorUnit(vec: *Vector, angle: i32) void {
|
||||
_c.FT_Vector_Unit(vec, angle);
|
||||
}
|
||||
|
||||
pub fn vectorRotate(vec: *Vector, angle: i32) void {
|
||||
_c.FT_Vector_Rotate(vec, angle);
|
||||
}
|
||||
|
||||
pub fn vectorLength(vec: *Vector) i32 {
|
||||
return @intCast(i32, _c.FT_Vector_Length(vec));
|
||||
}
|
||||
|
||||
pub fn vectorPolarize(vec: *Vector, length: *i32, angle: *i32) void {
|
||||
_c.FT_Vector_Polarize(vec, &@intCast(c_long, length.*), &@intCast(c_long, angle.*));
|
||||
}
|
||||
|
||||
pub fn vectorFromPolar(vec: *Vector, length: i32, angle: i32) void {
|
||||
_c.FT_Vector_From_Polar(vec, length, angle);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue