pkg/pixman: fill rects

This commit is contained in:
Mitchell Hashimoto
2022-11-25 14:10:25 -08:00
parent 353172199a
commit 88ff221d6d
2 changed files with 22 additions and 0 deletions

View File

@ -62,6 +62,21 @@ pub const Image = opaque {
) == 0) return pixman.Error.PixmanFailure; ) == 0) return pixman.Error.PixmanFailure;
} }
pub fn fillRectangles(
self: *Image,
op: pixman.Op,
color: pixman.Color,
rects: []const pixman.Rectangle16,
) pixman.Error!void {
if (c.pixman_image_fill_rectangles(
@enumToInt(op),
@ptrCast(*c.pixman_image_t, self),
@ptrCast(*const c.pixman_color_t, &color),
@intCast(c_int, rects.len),
@ptrCast([*c]const c.pixman_rectangle16_t, rects.ptr),
) == 0) return pixman.Error.PixmanFailure;
}
pub fn rasterizeTrapezoid( pub fn rasterizeTrapezoid(
self: *Image, self: *Image,
trap: pixman.Trapezoid, trap: pixman.Trapezoid,

View File

@ -100,6 +100,13 @@ pub const Trapezoid = extern struct {
right: LineFixed, right: LineFixed,
}; };
pub const Rectangle16 = extern struct {
x: i16,
y: i16,
width: u16,
height: u16,
};
pub const Box32 = extern struct { pub const Box32 = extern struct {
x1: i32, x1: i32,
y1: i32, y1: i32,