Mercurial > hg > wm
comparison Meerwald/bruyn_common.c @ 0:be303a3f5ea8
import
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Sun, 12 Aug 2007 13:14:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:be303a3f5ea8 |
---|---|
1 #include "bruyn_common.h" | |
2 | |
3 gray lookup_pattern(int pattern, int c, int r) { | |
4 #define A CATEGORY_A | |
5 #define B CATEGORY_B | |
6 | |
7 gray pattern1[4][4] = | |
8 {{A, A, B, B}, | |
9 {A, A, B, B}, | |
10 {B, B, A, A}, | |
11 {B, B, A, A}}; | |
12 | |
13 gray pattern2[8][8] = | |
14 {{B, B, B, B, A, A, A, A}, | |
15 {B, B, B, B, A, A, A, A}, | |
16 {B, B, B, B, A, A, A, A}, | |
17 {B, B, B, B, A, A, A, A}, | |
18 {A, A, A, A, B, B, B, B}, | |
19 {A, A, A, A, B, B, B, B}, | |
20 {A, A, A, A, B, B, B, B}, | |
21 {A, A, A, A, B, B, B, B}}; | |
22 | |
23 gray pattern3[2][2] = | |
24 {{A, B}, {B, A}}; | |
25 | |
26 #undef A | |
27 #undef B | |
28 | |
29 switch (pattern) { | |
30 case 1: | |
31 return pattern1[r % 4][c % 4]; | |
32 break; | |
33 case 2: | |
34 return pattern2[r % 8][c % 8]; | |
35 break; | |
36 case 3: | |
37 return pattern3[r % 2][c % 2]; | |
38 break; | |
39 } | |
40 | |
41 return CATEGORY_VOID; | |
42 } | |
43 | |
44 |