| 34 | |
| 35 | |
| 36 | static void initBuf(unsigned char *buf, int width, int pitch, int height, |
| 37 | PF *pf, int orientation) |
| 38 | { |
| 39 | int i, j; |
| 40 | |
| 41 | for(j = 0; j < height; j++) |
| 42 | { |
| 43 | int row = orientation == BMPORN_TOPDOWN ? j : height - j - 1; |
| 44 | for(i = 0; i < width; i++) |
| 45 | { |
| 46 | int r, g, b; |
| 47 | memset(&buf[row * pitch + i * pf->size], 0, pf->size); |
| 48 | r = (i * 256 / width) % 256; g = (j * 256 / height) % 256; |
| 49 | b = (j * 256 / height + i * 256 / width) % 256; |
| 50 | if(pf->bpc == 10) |
| 51 | { |
| 52 | r <<= 2; g <<= 2; b <<= 2; |
| 53 | } |
| 54 | pf->setRGB(&buf[row * pitch + i * pf->size], r, g, b); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | |
| 60 | static int cmpBuf(unsigned char *buf, int width, int pitch, int height, PF *pf, |