Skip to content

Commit

Permalink
image: add documentation for view
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed Dec 9, 2024
1 parent ffac3ad commit 62fdce2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/image.zig
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ pub fn Image(comptime T: type) type {
return self.rows == other.rows and self.cols == other.cols and self.data.len == other.data.len;
}

/// Returns an image view with boundaries defined by `rect`. The returned image
/// references the memory of `self`, so there are no allocations or copies.
pub fn view(self: Self, rect: Rectangle(usize)) Image(T) {
assert(rect.r < self.cols);
assert(rect.b < self.rows);
Expand Down

0 comments on commit 62fdce2

Please sign in to comment.