Skip to content

finite_draw_rect

The finite_draw_rect function attempts to draw a regular rectangle onto a window with Cairo.

void finite_draw_rect(FiniteShell *shell, double x, double y, double width, double height, FiniteColorGroup *color, cairo_pattern_t *pat, bool withPreserve)
TypeDescription
FiniteShell *shellThe FiniteShell where the window is.
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
FiniteColorGroup *colorA single FiniteColorGroup
cairo_pattern_t *patA single Cairo Pattern.
bool withPreserveWhether the rectangle should preserve it’s path data. (Must be true to apply additional effects like strokes)
#include <finite/draw.h>
FiniteColorGroup myColor = {
.r = 211.0/255.0,
.g = 63.0/255.0,
.b = 73.0/255.0
};
finite_draw_rect(myShell, 0,0, 100, 100, &myColor, NULL);

finite_draw_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.

This function doesn’t use information from finite_draw_set_draw_position as of v0.6.0

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.