summaryrefslogtreecommitdiff
path: root/src/sim/sim.h
diff options
context:
space:
mode:
authorscuri <scuri>2008-10-17 06:10:33 +0000
committerscuri <scuri>2008-10-17 06:10:33 +0000
commit7b52cc13af4e85f1ca2deb6b6c77de9c95ea0dcf (patch)
treed0857278bde2eff784227c57dcaf930346ceb7ac /src/sim/sim.h
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'src/sim/sim.h')
-rw-r--r--src/sim/sim.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/sim/sim.h b/src/sim/sim.h
new file mode 100644
index 0000000..16189a1
--- /dev/null
+++ b/src/sim/sim.h
@@ -0,0 +1,58 @@
+/** \file
+ * \brief Simulation Base Driver
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#ifndef __SIM_H
+#define __SIM_H
+
+
+struct _cdSimulation
+{
+ cdTT_Text* tt_text; /* TrueType Font Simulation using FreeType library */
+
+ int antialias;
+
+ cdCanvas *canvas;
+
+ const char* font_map[100];
+ int font_map_n;
+
+ /* horizontal line draw functions */
+ void (*SolidLine)(cdCanvas* canvas, int xmin, int y, int xmax);
+ void (*PatternLine)(cdCanvas* canvas, int xmin, int xmax, int y, int pw, const long *pattern);
+ void (*StippleLine)(cdCanvas* canvas, int xmin, int xmax, int y, int pw, const unsigned char *stipple);
+ void (*HatchLine)(cdCanvas* canvas, int xmin, int xmax, int y, unsigned char hatch);
+};
+
+#define simRotateHatchN(_x,_n) ((_x) = ((_x) << (_n)) | ((_x) >> (8-(_n))))
+
+void simFillDrawAAPixel(cdCanvas *canvas, int x, int y, unsigned short alpha_weigth);
+void simFillHorizLine(cdSimulation* simulation, int xmin, int y, int xmax);
+void simGetPenPos(cdCanvas* canvas, int x, int y, const char* s, FT_Matrix *matrix, FT_Vector *pen);
+int simIsPointInPolyWind(cdPoint* poly, int n, int x, int y);
+
+/* list of non-horizontal line segments */
+typedef struct _simLineSegment
+{
+ int x1, y1; /* always y1 < y2 */
+ int x2, y2; /* (x2,y2) is not included in the segment to avoid duplicated intersections */
+ int x; /* incremental x from x2 to x1 */
+ int DeltaX, DeltaY, XDir;
+ unsigned short ErrorInc, ErrorAcc;
+} simLineSegment;
+
+void simAddSegment(simLineSegment* segment, int x1, int y1, int x2, int y2, int *y_max, int *y_min);
+int simSegmentInc(simLineSegment* segment, cdCanvas* canvas, int y);
+
+void simPolyFill(cdSimulation* simulation, cdPoint* poly, int n);
+void simLineThin(cdCanvas* canvas, int x1, int y1, int x2, int y2);
+void simLineThick(cdCanvas* canvas, int x1, int y1, int x2, int y2);
+void simfLineThin(cdCanvas* canvas, double x1, double y1, double x2, double y2, int *last_xi_a, int *last_yi_a, int *last_xi_b, int *last_yi_b);
+extern int simLineStyleNoReset;
+
+int simCalcEllipseNumSegments(cdCanvas* canvas, int xc, int yc, int width, int height);
+
+#endif
+