Closed ripytide closed 5 months ago
The motivation for this change was me wanting to implement crop()
which would take a Rect
but the current Rect
is not conducive to the crop()
functions requirements as described above.
crop()
and similar functions are what I'm implementing as a part of https://github.com/image-rs/image/issues/2238
I came across the
Rect
type when starting on some functions which take rectangular regions such ascrop()
. I would like to use this type to take arguments to thecrop()
function. However, there are several issues I have with it at the moment that make me reluctant to go near it.Currently defined as:
left
andtop
members which don't define which is thex
and which is they
.left
andtop
arei32
and notu32
since negative values don't make any sense in normal image coordinates. Also variousImage
methods takex: u32
which makes this very un-ergonomic to use.Proposal: May I suggest we change
Rect
to be defined as:The docs can then state that the
xy
define the top-left point of the rectangle.This also matches other
Rect
types in the rust ecosystem such as the Rectangle fromiced
.