summaryrefslogtreecommitdiffstats
path: root/test/source/mktile1.c
diff options
context:
space:
mode:
authorHenning Makholm <henning@makholm.net>2006-01-27 18:00:00 (EST)
committer Julien Jorge <julien.jorge@stuff-o-matic.com>2013-01-10 16:00:40 (EST)
commit7b7cd6da61b1fcc0f2a3ecce2cb9e6c42782c717 (patch)
tree98d2772f50aaddb02ac94492d2b8b151aa3e9465 /test/source/mktile1.c
downloadxcftools-7b7cd6da61b1fcc0f2a3ecce2cb9e6c42782c717.zip
xcftools-7b7cd6da61b1fcc0f2a3ecce2cb9e6c42782c717.tar.gz
xcftools-7b7cd6da61b1fcc0f2a3ecce2cb9e6c42782c717.tar.bz2
Import of release 0.7
Diffstat (limited to 'test/source/mktile1.c')
-rw-r--r--test/source/mktile1.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/source/mktile1.c b/test/source/mktile1.c
new file mode 100644
index 0000000..50709df
--- /dev/null
+++ b/test/source/mktile1.c
@@ -0,0 +1,35 @@
+/* This program is written by Henning Makholm, and is in the
+ * public domain.
+ */
+
+#define TEST_IMAGE_WIDTH 50
+#define TEST_IMAGE_HEIGHT 50
+
+#include <math.h>
+#include <stdlib.h>
+
+void
+makepixel(int x,int y,int *r,int *g,int *b,int *a) {
+ double yy = 2*(double)y/(TEST_IMAGE_HEIGHT-1) - 1 ;
+ double xx = 2*(double)x/(TEST_IMAGE_WIDTH-1) - 1 ;
+ double rad = sqrt(xx*xx+yy*yy) ;
+ unsigned t = x + abs((y - TEST_IMAGE_HEIGHT/2)) ;
+ t = t / 10 + ((600 + y - TEST_IMAGE_HEIGHT/2) / 10)*77 ;
+ if( rad < 0.9 )
+ *a = 255 ;
+ else if( rad < 1 )
+ *a = 190 ;
+ else if( rad < 1.2 )
+ *a = 73 ;
+ else
+ *a = 0 ;
+
+ t *= 3847822 ;
+ t ^= 29938132 ;
+ t %= 2093847 ;
+ *r = 120 * ((t >> 3) % 3) + 3 ;
+ *g = 120 * ((t >> 7) % 3) + 3 ;
+ *b = 120 * ((t >> 10) % 3) + 3 ;
+}
+
+#include "mkbase.i"