31059016e90d9d6d65e11f55808869efacb8d4e2 kate Tue Apr 10 18:16:17 2018 -0700 Add postscript for ellipse drawing. refs #21109 diff --git src/inc/memgfx.h src/inc/memgfx.h index b7e72f7..57a01b1 100644 --- src/inc/memgfx.h +++ src/inc/memgfx.h @@ -3,31 +3,30 @@ * This stuff is byte-a-pixel for simplicity. * It can do 256 colors. * * This file is copyright 2000 Jim Kent, but license is hereby * granted for all use - public, private or commercial. */ #ifndef MEMGFX_H #define MEMGFX_H #ifndef GFXPOLY_H #include "gfxPoly.h" #endif typedef unsigned int Color; - #if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc) || defined(__ppc__) || defined(__s390__) || defined(__s390x__) // BIGENDIAN machines: #define MEMGFX_BIGENDIAN 1 #define MG_WHITE 0xffffffff #define MG_BLACK 0x000000ff #define MG_RED 0xff0000ff #define MG_GREEN 0x00ff00ff #define MG_BLUE 0x0000ffff #define MG_CYAN 0x00ffffff #define MG_MAGENTA 0xff00ffff #define MG_YELLOW 0xffff00ff #define MG_GRAY 0x808080ff @@ -326,30 +325,44 @@ * vertical lines from the bottom to y1 on the left and bottom to * y2 on the right. */ struct memGfx *mgRotate90(struct memGfx *in); /* Create a copy of input that is rotated 90 degrees clockwise. */ void mgCircle(struct memGfx *mg, int xCen, int yCen, int rad, Color color, boolean filled); /* Draw a circle using a stepping algorithm. Doesn't correct * for non-square pixels. */ void mgDrawPoly(struct memGfx *mg, struct gfxPoly *poly, Color color, boolean filled); /* Draw polygon, possibly filled in color. */ +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 + 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);