summaryrefslogtreecommitdiff
path: root/cd/src/sim/sim.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-04 11:56:41 -0800
committerPixel <pixel@nobis-crew.org>2009-11-04 11:59:33 -0800
commitd577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch)
tree590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /cd/src/sim/sim.h
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'cd/src/sim/sim.h')
-rwxr-xr-xcd/src/sim/sim.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/cd/src/sim/sim.h b/cd/src/sim/sim.h
new file mode 100755
index 0000000..fec3ce6
--- /dev/null
+++ b/cd/src/sim/sim.h
@@ -0,0 +1,55 @@
+/** \file
+ * \brief Simulation Base Driver
+ *
+ * See Copyright Notice in cd.h
+ */
+
+#ifndef __SIM_H
+#define __SIM_H
+
+
+struct _cdSimulation
+{
+ 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);
+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
+