ghostty/pkg/freetype/bitmap.zig
Mitchell Hashimoto 2e1bc7bb01 Bring back freetype font bitmap conversion
Monaco on Mac is mono
2022-10-16 20:47:21 -07:00

24 lines
668 B
Zig
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const std = @import("std");
const c = @import("c.zig");
const freetype = @import("main.zig");
const errors = @import("errors.zig");
const Error = errors.Error;
const intToError = errors.intToError;
/// Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to a
/// bitmap object with depth 8bpp, making the number of used bytes per line
/// (a.k.a. the pitch) a multiple of alignment.
pub fn bitmapConvert(
lib: freetype.Library,
source: *const c.FT_Bitmap,
target: *c.FT_Bitmap,
alignment: u32,
) Error!void {
try intToError(c.FT_Bitmap_Convert(
lib.handle,
source,
target,
alignment,
));
}