Impossible SDK

Reference

ui/clip.h

Rectangular and rounded-rectangle clip stacks. Portable.

im_clip_entry

One clip entry on an im_clip_stack (rectangular when all radii are 0).

ui/clip.h, line 10
typedef struct im_clip_entry {
    im_rect rect;
    im_radii radii;
    bool is_rounded;
    int int_left;
    int int_top;
    int int_right;
    int int_bottom;
} im_clip_entry;

im_clip_stack

Growable stack of active clips backed by a caller-supplied allocator.

ui/clip.h, line 21
typedef struct im_clip_stack {
    im_allocator alloc;
    im_clip_entry *entries;
    uint32_t count;
    uint32_t cap;
    int surface_w;
    int surface_h;
} im_clip_stack;

im_clip_init

Initialise an empty clip stack for a surface of dimensions (width, height).

ui/clip.h, line 31
bool im_clip_init(im_clip_stack *stack, im_allocator alloc, int width, int height);

im_clip_destroy

Release all memory owned by the clip stack.

ui/clip.h, line 34
void im_clip_destroy(im_clip_stack *stack);

im_clip_push_rect

Push a rectangular clip. Returns false on allocation failure, leaving the stack unchanged.

ui/clip.h, line 37
bool im_clip_push_rect(im_clip_stack *stack, im_rect rect);

im_clip_push_rounded

Push a rounded-rectangle clip. Returns false on allocation failure, leaving the stack unchanged.

ui/clip.h, line 40
bool im_clip_push_rounded(im_clip_stack *stack, im_rect rect, im_radii radii);

im_clip_pop

Pop the top clip entry. Safe no-op on an empty stack.

ui/clip.h, line 43
void im_clip_pop(im_clip_stack *stack);

im_clip_bounds

Return the intersected integer pixel bounding box [left, right) x [top, bottom) of all active clips.

ui/clip.h, line 46
void im_clip_bounds(const im_clip_stack *stack, int *left, int *top, int *right, int *bottom);

im_clip_pixel_coverage

Return the combined clip coverage (0 to IM_ONE) for pixel (x, y) across all active clips.

ui/clip.h, line 49
uint32_t im_clip_pixel_coverage(const im_clip_stack *stack, int x, int y);
GeneratedMade from ui/clip.hPublished from c4737ad