66ee7c172964fe9665479973fa7c7536afe03fa2 kate Tue Apr 10 22:05:33 2018 -0700 Add Postscript for bezier curve. Fix ellipse. refs #21109 diff --git src/inc/memgfx.h src/inc/memgfx.h index 57a01b1..f595e8f 100644 --- src/inc/memgfx.h +++ src/inc/memgfx.h @@ -339,30 +339,41 @@ void mgEllipse(struct memGfx *mg, int x0, int y0, int x1, int y1, Color color, int mode, boolean isDashed); /* Draw an ellipse (or limit to top or bottom) specified by rectangle, using Bresenham algorithm. * Optionally, alternate dots. * Point 0 is left, point 1 is top of rectangle * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html * Author: Zingl Alois, 8/22/2016 */ /* Ellipse drawing modes */ #define ELLIPSE_FULL 0 #define ELLIPSE_TOP 1 #define ELLIPSE_BOTTOM 2 +int mgCurve(struct memGfx *mg, int x0, int y0, int x1, int y1, int x2, int y2, Color color, + boolean isDashed); +/* Draw a segment of an anti-aliased curve within 3 points (quadratic Bezier) + * Return max y value. Optionally draw curve as dashed line. + * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html + * Author: Zingl Alois, 8/22/2016 + */ +/* TODO: allow specifying a third point on the line + * P(t) = (1-t)^2 * p0 + 2 * (1-t) * t * p1 + t^2 * p2 + */ + struct hslColor mgRgbToHsl(struct rgbColor rgb); /* Convert RGB to HSL colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV) * In HSL, Hue is the color in the range [0,360) with 0=red 120=green 240=blue, * Saturation goes from a shade of grey (0) to fully saturated color (1000), and * Lightness goes from black (0) through the hue (500) to white (1000). */ struct hsvColor mgRgbToHsv(struct rgbColor rgb); /* Convert RGB to HSV colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV) * In HSV, Hue is the color in the range [0,360) with 0=red 120=green 240=blue, * Saturation goes from white (0) to fully saturated color (1000), and * Value goes from black (0) through to the hue (1000). */ #define hsvValMax 1000 #define hsvSatMax 1000 struct rgbColor mgHslToRgb(struct hslColor hsl);