Skip to content

finite_draw_pattern_linear

The finite_draw_pattern_linear function attempts to create a cairo pattern as a linear gradient.

cairo_pattern_t *finite_draw_pattern_linear(double startX, double startY, double endX, double endY, FiniteGradientPoint *points, size_t n)
TypeDescription
double startXThe starting X position of the gradient
double startyThe starting Y position of the gradient
double endXThe ending X position of the gradient
double endYThe ending y position of the gradient
FiniteGradientPoint *pointsAn array of FiniteGradientPoints
size_t nThe number of items in the points array.
#include <finite/draw.h>
double xW = 338, yH = 68;
double nW = (double)(width - 400), nY = (double)(height - 100);
finite_draw_rounded_rect(shell, nW, nY, xW, yH, 20, &color, NULL, true);
FiniteGradientPoint new_points[2] = {
{0, 1, 0.325, 0.325},
{1, 1, 0.474, 0.098}
};
cairo_pattern_t *pat = finite_draw_pattern_linear(nW, nY, (double)(width), (double)(height), new_points, 2);
finite_draw_stroke(shell, NULL, pat, 14);
cairo_pattern_destroy(pat);

This function creates a cairo_pattern_t that at some point must be destroyed with cairo_pattern_destroy