Skip to documentation
SLOP

tiny.simd.Rect

Reference tiny.simd Rect

Defined in image.

API (18)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsimageRect
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/simd/src/image/root.zig:402

zig
pub const Rect = struct {    x0_value: usize,    y0_value: usize,    xsize_value: usize,    ysize_value: usize,    pub fn empty() Rect {        return init(0, 0, 0, 0);    }    pub fn init(xbegin: usize, ybegin: usize, width: usize, height: usize) Rect {        return .{            .x0_value = xbegin,            .y0_value = ybegin,            .xsize_value = width,            .ysize_value = height,        };    }    pub fn initClamped(        xbegin: usize,        ybegin: usize,        xsize_max: usize,        ysize_max: usize,        xend: usize,        yend: usize,    ) Rect {        return .{            .x0_value = xbegin,            .y0_value = ybegin,            .xsize_value = clampedSize(xbegin, xsize_max, xend),            .ysize_value = clampedSize(ybegin, ysize_max, yend),        };    }    pub fn fromImage(image: anytype) Rect {        return init(0, 0, image.xsize(), image.ysize());    }    pub fn subrect(        self: Rect,        xbegin: usize,        ybegin: usize,        xsize_max: usize,        ysize_max: usize,    ) GeometryError!Rect {        const absolute_x = std.math.add(usize, self.x0_value, xbegin) catch            return error.RowSizeOverflow;        const absolute_y = std.math.add(usize, self.y0_value, ybegin) catch            return error.RowSizeOverflow;        const xend = std.math.add(usize, self.x0_value, self.xsize_value) catch            return error.RowSizeOverflow;        const yend = std.math.add(usize, self.y0_value, self.ysize_value) catch            return error.RowSizeOverflow;        return initClamped(            absolute_x,            absolute_y,            xsize_max,            ysize_max,            xend,            yend,        );    }    pub fn isInside(self: Rect, image: anytype) bool {        const xend = std.math.add(usize, self.x0_value, self.xsize_value) catch            return false;        const yend = std.math.add(usize, self.y0_value, self.ysize_value) catch            return false;        return xend <= image.xsize() and yend <= image.ysize();    }    pub fn constRow(self: Rect, comptime T: type, image: *const Image(T), y: usize) []const T {        std.debug.assert(self.isInside(image));        std.debug.assert(y < self.ysize_value);        return image.constRow(y + self.y0_value)[self.x0_value..];    }    pub fn mutableRow(self: Rect, comptime T: type, image: *const Image(T), y: usize) []T {        std.debug.assert(self.isInside(image));        std.debug.assert(y < self.ysize_value);        return image.mutableRow(y + self.y0_value)[self.x0_value..];    }    pub fn constPlaneRow(        self: Rect,        comptime T: type,        image: *const Image3(T),        component: usize,        y: usize,    ) []const T {        std.debug.assert(self.isInside(image));        std.debug.assert(y < self.ysize_value);        return image.constPlaneRow(component, y + self.y0_value)[self.x0_value..];    }    pub fn mutablePlaneRow(        self: Rect,        comptime T: type,        image: *const Image3(T),        component: usize,        y: usize,    ) []T {        std.debug.assert(self.isInside(image));        std.debug.assert(y < self.ysize_value);        return image.mutablePlaneRow(component, y + self.y0_value)[self.x0_value..];    }    pub fn x0(self: Rect) usize {        return self.x0_value;    }    pub fn y0(self: Rect) usize {        return self.y0_value;    }    pub fn xsize(self: Rect) usize {        return self.xsize_value;    }    pub fn ysize(self: Rect) usize {        return self.ysize_value;    }};

Source: lib/simd/src/root.zig:525

zig
pub const Rect = image.Rect;
Called byCallsNo direct callersimageImage3RectisInsideRectconstPlaneRow
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersimageImageRectisInsideRectconstRow
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsimageImageimageImage3Rectempty
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callstest sourcelib.simd.src.image.testtest: rectangles clamp compose and ad...Rectinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsRectsubrecttest sourcelib.simd.src.image.testtest: rectangles clamp compose and ad...private sourcelib.simd.src.image.rootclampedSizeRectinitClamped
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsRectconstPlaneRowRectconstRowRectmutablePlaneRowRectmutableRowRectisInside
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsNo direct callersimageImage3RectisInsideRectmutablePlaneRow
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersimageImageRectisInsideRectmutableRow
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersRectinitClampedRectsubrect
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions15
Public names30
Members4
Version26.7.0
Revisiondaab053ee433