Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
shapes.h
Go to the documentation of this file.
1
43#ifndef SRC_BRESENHAM_H_
44#define SRC_BRESENHAM_H_
45
46#include <stdbool.h>
47#include "palette.h"
48
49void drawLineFast(int16_t x0, int16_t y0, int16_t x1, int16_t y1, paletteColor_t color);
50void drawLine(int x0, int y0, int x1, int y1, paletteColor_t col, int dashWidth);
51void drawLineScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int dashWidth, int xOrigin, int yOrigin,
52 int xScale, int yScale);
53void drawRect(int x0, int y0, int x1, int y1, paletteColor_t col);
54void drawRectFilled(int x0, int y0, int x1, int y1, paletteColor_t col);
55void drawRectScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int xOrigin, int yOrigin, int xScale,
56 int yScale);
57void drawRoundedRect(int x0, int y0, int x1, int y1, int r, paletteColor_t fillColor, paletteColor_t outlineColor);
58void drawTriangleOutlined(int16_t v0x, int16_t v0y, int16_t v1x, int16_t v1y, int16_t v2x, int16_t v2y,
59 paletteColor_t fillColor, paletteColor_t outlineColor);
60void drawEllipse(int xm, int ym, int a, int b, paletteColor_t col);
61void drawEllipseScaled(int xm, int ym, int a, int b, paletteColor_t col, int xOrigin, int yOrigin, int xScale,
62 int yScale);
63void drawCircle(int xm, int ym, int r, paletteColor_t col);
64void drawCircleScaled(int xm, int ym, int r, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale);
65void drawCircleQuadrants(int xm, int ym, int r, bool q1, bool q2, bool q3, bool q4, paletteColor_t col);
66void drawCircleFilled(int xm, int ym, int r, paletteColor_t col);
67void drawCircleFilledScaled(int xm, int ym, int r, paletteColor_t col, int xOrigin, int yOrigin, int xScale,
68 int yScale);
69void drawCircleFilledQuadrants(int xm, int ym, int r, bool q1, bool q2, bool q3, bool q4, paletteColor_t col);
70void drawCircleOutline(int xm, int ym, int r, int stroke, paletteColor_t col);
71void drawEllipseRect(int x0, int y0, int x1, int y1, paletteColor_t col);
72void drawEllipseRectScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int xOrigin, int yOrigin, int xScale,
73 int yScale);
74void drawQuadBezierSeg(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col);
75void drawQuadBezierSegScaled(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col, int xOrigin,
76 int yOrigin, int xScale, int yScale);
77void drawQuadBezier(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col);
78void drawQuadBezierScaled(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col, int xOrigin, int yOrigin,
79 int xScale, int yScale);
80void drawQuadRationalBezierSeg(int x0, int y0, int x1, int y1, int x2, int y2, float w, paletteColor_t col);
81void drawQuadRationalBezier(int x0, int y0, int x1, int y1, int x2, int y2, float w, paletteColor_t col);
82void drawRotatedEllipse(int x, int y, int a, int b, float angle, paletteColor_t col);
83void drawRotatedEllipseRect(int x0, int y0, int x1, int y1, long zd, paletteColor_t col);
84void drawCubicBezierSeg(int x0, int y0, float x1, float y1, float x2, float y2, int x3, int y3, paletteColor_t col);
85void drawCubicBezier(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, paletteColor_t col);
86void drawCubicBezierScaled(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, paletteColor_t col,
87 int xOrigin, int yOrigin, int xScale, int yScale);
88void drawQuadSpline(int n, int x[], int y[], paletteColor_t col);
89void drawCubicSpline(int n, int x[], int y[], paletteColor_t col);
90
91void initShapes(void);
92
93#endif /* SRC_BRESENHAM_H_ */
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
void drawCubicBezierSeg(int x0, int y0, float x1, float y1, float x2, float y2, int x3, int y3, paletteColor_t col)
Draw limited cubic Bezier segment.
Definition shapes.c:2133
void initShapes(void)
Initialize shape drawing by making a static local pointer to the framebuffer This is done for speed r...
Definition shapes.c:70
void drawLineScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int dashWidth, int xOrigin, int yOrigin, int xScale, int yScale)
Draw a line that that is translated and scaled. Scaling may make it wider than one pixel....
Definition shapes.c:181
void drawCircleFilledScaled(int xm, int ym, int r, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw a filed circle with translation and scaling.
Definition shapes.c:1413
void drawEllipseRectScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw the outline of an ellipse with translation and scaling within a rectangle. Scaling may make it w...
Definition shapes.c:1516
void drawQuadRationalBezierSeg(int x0, int y0, int x1, int y1, int x2, int y2, float w, paletteColor_t col)
Draw a limited one pixel wide rational Bezier curve with squared weight.
Definition shapes.c:1759
void drawLineFast(int16_t x0, int16_t y0, int16_t x1, int16_t y1, paletteColor_t color)
Optimized method to quickly draw a one pixel wide solid line.
Definition shapes.c:199
void drawQuadBezierSeg(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col)
Draw a one pixel wide quadratic Bezier curve. This is limited to gradients without sign change.
Definition shapes.c:1618
void drawEllipse(int xm, int ym, int a, int b, paletteColor_t col)
Draw a one pixel wide outline of an ellipse.
Definition shapes.c:1071
void drawCubicBezierScaled(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw any cubic Bezier curve with translation and scaling.
Definition shapes.c:2289
void drawEllipseScaled(int xm, int ym, int a, int b, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw the outline of an ellipse with translation and scaling. Scaling may make it wider than one pixel...
Definition shapes.c:1053
void drawQuadSpline(int n, int x[], int y[], paletteColor_t col)
Draw a quadratic spline. This overwrites the input arrays x and y.
Definition shapes.c:2307
void drawQuadBezier(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col)
Draw a one pixel wide quadratic Bezier curve.
Definition shapes.c:1718
void drawRectScaled(int x0, int y0, int x1, int y1, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw the outline of a rectangle that is translated and scaled. Scaling may make it wider than one pix...
Definition shapes.c:567
void drawCircleOutline(int xm, int ym, int r, int stroke, paletteColor_t col)
Draw the outline of a circle with the given stroke width.
Definition shapes.c:1336
void drawCircleFilledQuadrants(int xm, int ym, int r, bool q1, bool q2, bool q3, bool q4, paletteColor_t col)
Draw filled-in quadrants of a circle.
Definition shapes.c:1232
void drawCubicBezier(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, paletteColor_t col)
Draw any cubic Bezier curve.
Definition shapes.c:2267
void drawCubicSpline(int n, int x[], int y[], paletteColor_t col)
Draw a cubic spline. This overwrites the input arrays x and y.
Definition shapes.c:2355
void drawRotatedEllipseRect(int x0, int y0, int x1, int y1, long zd, paletteColor_t col)
Draw an ellipse, bounded by a rectangle, rotated (integer)
Definition shapes.c:1958
void drawCircleFilled(int xm, int ym, int r, paletteColor_t col)
Draw a filled circle.
Definition shapes.c:1396
void drawRectFilled(int x0, int y0, int x1, int y1, paletteColor_t col)
Draw a filled rectangle, with bounds checking and arbitrary orders.
Definition shapes.c:490
void drawTriangleOutlined(int16_t v0x, int16_t v0y, int16_t v1x, int16_t v1y, int16_t v2x, int16_t v2y, paletteColor_t fillColor, paletteColor_t outlineColor)
Optimized method to draw a triangle with outline. The interior color may be cTransparent to draw just...
Definition shapes.c:660
void drawRoundedRect(int x0, int y0, int x1, int y1, int r, paletteColor_t fillColor, paletteColor_t outlineColor)
Draw an outlined and filled rectangle with rounded corners.
Definition shapes.c:587
void drawQuadRationalBezier(int x0, int y0, int x1, int y1, int x2, int y2, float w, paletteColor_t col)
Draw any one pixel wide quadratic rational Bezier curve with squared weight.
Definition shapes.c:1849
void drawEllipseRect(int x0, int y0, int x1, int y1, paletteColor_t col)
Draw a one pixel wide outline of an ellipse within a rectangle.
Definition shapes.c:1496
void drawQuadBezierScaled(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw a one pixel wide quadratic Bezier curve with translation and scaling.
Definition shapes.c:1738
void drawRotatedEllipse(int x, int y, int a, int b, float angle, paletteColor_t col)
Draw an ellipse rotated by angle (radian)
Definition shapes.c:1937
void drawRect(int x0, int y0, int x1, int y1, paletteColor_t col)
Draw the a one pixel wide outline of a rectangle.
Definition shapes.c:476
void drawCircleScaled(int xm, int ym, int r, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw the outline of a circle with translation and scaling. Scaling may make it wider than one pixel.
Definition shapes.c:1165
void drawLine(int x0, int y0, int x1, int y1, paletteColor_t col, int dashWidth)
Draw a one pixel wide straight line between two points. The line may be solid or dashed.
Definition shapes.c:159
void drawCircleQuadrants(int xm, int ym, int r, bool q1, bool q2, bool q3, bool q4, paletteColor_t col)
Draw the one pixel wide outline of the quadrants of a circle.
Definition shapes.c:1185
void drawQuadBezierSegScaled(int x0, int y0, int x1, int y1, int x2, int y2, paletteColor_t col, int xOrigin, int yOrigin, int xScale, int yScale)
Draw a one pixel wide quadratic Bezier curve with translation and scaling. This is limited to gradien...
Definition shapes.c:1639
void drawCircle(int xm, int ym, int r, paletteColor_t col)
Draw the one pixel wide outline of a circle.
Definition shapes.c:1148