Skip to content

Mixed-integer clipping operations #20

@nxsaken

Description

@nxsaken

Clipping windows are often defined to be ((0, 0), (w - 1, h - 1)), where (w, h) is the unsigned resolution of an image or a screen (generally, a 2D array). Usually, these windows are much smaller than the coordinate space.

Currently, clipping windows use the same type as the coordinate space. It would be nice to have mixed-integer operations where any window type W0 can be used with any coordinate type C0. Something like:

let clipped: AnyOctant<u8> = Clip::<u8>::new((0, 0), (255, 255))?
    .any_octant::<i16>((-1280, -64), (127, 630))?;

This can't be combined with const in this form today, since there is no way to implement the method for each type parameter inherently. However, some other API could be possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions