Skip to content

finite_draw_rounded_rect

The finite_draw_rounded_rect function attempts to draw a rounded rectangle onto a window with Cairo.

void finite_draw_rounded_rect(FiniteShell *shell, double x, double y, double width, double height, double radius, FiniteColorGroup *color, cairo_pattern_t *pat, bool withPreserve)
TypeDescription
FiniteShell *shellThe FiniteShell to resize.
double xThe x position to draw the rectangle at.
double yThe y position to draw the rectangle at.
double widthThe width of the rectangle.
double heightThe height of the rectangle
double radiusThe Radoius of the rounded edges of the rectangle.
FiniteColorGroup *colorA single FiniteColorGroup
cairo_pattern_t *patA single Cairo Pattern.
bool withPreserveDetermines whether to ‘preserve’ the data for things like stroke.
#include <finite/draw.h>
FiniteColorGroup myColor = {
.r = 211.0/255.0,
.g = 63.0/255.0,
.b = 73.0/255.0
};
finite_draw_rounded_rect(myShell, 0,0, 100, 100, 15, &myColor, NULL, false);

finite_draw_rounded_rect supports both solid colors with FiniteColorGroup and gradients with cairo_pattern_t but you CANNOT have both values set. One of the last two params MUST be NULL. Having two color values set will throw an error.

If shell.cr is undefined, this function will create a new Cairo draw tool and set it to shell.cr

This function must have a valid FiniteShell

This function uses Cairo which requires a valid cairo_surface_t in FiniteShell.cairo_surface beforehand.