1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * |
---|
5 | * This software was released into the Public Domain. As with most public |
---|
6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
7 | * Jonathan Clark. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef __IMAGE_24__ |
---|
11 | #define __IMAGE_24__ |
---|
12 | |
---|
13 | #include "palette.hpp" |
---|
14 | #include "macs.hpp" |
---|
15 | #include "filter.hpp" |
---|
16 | |
---|
17 | class image24 |
---|
18 | { |
---|
19 | int w,h; |
---|
20 | unsigned char *data; |
---|
21 | public : |
---|
22 | int width() { return w; } |
---|
23 | int height() { return h; } |
---|
24 | image24(unsigned short width, unsigned short height, |
---|
25 | unsigned char *buffer=NULL); |
---|
26 | void pixel(short x, short y, unsigned char &r, |
---|
27 | unsigned char &g, |
---|
28 | unsigned char &b) |
---|
29 | { CHECK(x>=0 && y>=0 && x<w && y<h); |
---|
30 | unsigned char *p=data+y*w*3; r=*(p++); g=*(p++); b=*(p++); } |
---|
31 | void putpixel(short x, short y, unsigned char r, |
---|
32 | unsigned char g, |
---|
33 | unsigned char b) |
---|
34 | { CHECK(x>=0 && y>=0 && x<w && y<h); |
---|
35 | unsigned char *p=data+(y*w+x)*3; *(p++)=r; *(p++)=g; *(p++)=b; } |
---|
36 | unsigned char *scan_line(short y) { return data+y*w*3; } |
---|
37 | image *dither(palette *pal); |
---|
38 | void clear (unsigned char r=0, unsigned char g=0, |
---|
39 | unsigned char b=0); |
---|
40 | void add_error(int x, int y, int r_error, int g_error, int b_error, int error_mult); |
---|
41 | ~image24() { jfree(data); } |
---|
42 | } ; |
---|
43 | |
---|
44 | |
---|
45 | #endif |
---|
46 | |
---|