summaryrefslogtreecommitdiffstats
path: root/test/source/mkmodebase.c
blob: 376be1215fab5d2b1aed788f62d804c970ed5f47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* This program is written by Henning Makholm, and is in the
 * public domain.
 */

#define TEST_IMAGE_WIDTH 64
#define TEST_IMAGE_HEIGHT 64

void
makepixel(int x,int y,int *r,int *g,int *b,int *a) {
  if( x < 3 || x >= 61 ) {
    *a = 0 ;
    return ;
  }
  if( y < 3 || y >= 61 ||
      x < 6 || x >= 58 ) {
    *a = 255 ;
    *r=*g=*b= 255*(x>=32) ;
    return ;
  }
  x -= 6 ;
  if( x <= 17 ) {
    *a = x*15 ;
    *r = 255 ;
    *g = 0 ;
    *b = 17*7 ;
    return ;
  }
  *a = 255 ;
  x -= 17 ;
  if( x <= 17 ) {
    *r = 255 ;
    *g = x*15 ;
    *b = (17-x)*7 ;
    return ;
  }
  x -= 17 ;
  if( x <= 17 ) {
    *r = (17-x)*15 ;
    *g = (17-x)*15 ;
    *b = (x-1)*15 ;
    return ;
  }
  *r=255 ;
  *g=*b=0 ;
}

#include "mkbase.i"