1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __TIMAGE_HPP__ |
---|
12 | #define __TIMAGE_HPP__ |
---|
13 | |
---|
14 | #include "image.h" |
---|
15 | #include "palette.h" |
---|
16 | #include "filter.h" |
---|
17 | |
---|
18 | /* Data is stored in the following format: |
---|
19 | * |
---|
20 | * uint8_t skip; // transparent pixel count |
---|
21 | * uint8_t size; // solid pixel count |
---|
22 | * uint8_t data[size]; // solid pixel values |
---|
23 | * ... |
---|
24 | * (no scan line wraps allowed, there can be a last skip value) |
---|
25 | */ |
---|
26 | |
---|
27 | class TransImage |
---|
28 | { |
---|
29 | public: |
---|
30 | TransImage(image *im, char const *name); |
---|
31 | ~TransImage(); |
---|
32 | |
---|
33 | inline vec2i Size() { return m_size; } |
---|
34 | inline uint8_t *Data() { return m_data; } |
---|
35 | |
---|
36 | image *ToImage(); |
---|
37 | |
---|
38 | void PutImage(image *screen, vec2i pos); |
---|
39 | void PutRemap(image *screen, vec2i pos, uint8_t *map); |
---|
40 | void PutDoubleRemap(image *screen, vec2i pos, uint8_t *map, uint8_t *map2); |
---|
41 | void PutFade(image *screen, vec2i pos, int amount, int nframes, |
---|
42 | color_filter *f, palette *pal); |
---|
43 | void PutFadeTint(image *screen, vec2i pos, int amount, int nframes, |
---|
44 | uint8_t *tint, color_filter *f, palette *pal); |
---|
45 | void PutColor(image *screen, vec2i pos, uint8_t color); |
---|
46 | void PutFilled(image *screen, vec2i pos, uint8_t color); |
---|
47 | void PutPredator(image *screen, vec2i pos); |
---|
48 | void PutBlend(image *screen, vec2i pos, image *blend, vec2i bpos, |
---|
49 | int blend_amount, color_filter *f, palette *pal); |
---|
50 | void PutScanLine(image *screen, vec2i pos, int line); |
---|
51 | |
---|
52 | size_t DiskUsage(); |
---|
53 | |
---|
54 | private: |
---|
55 | uint8_t *ClipToLine(image *screen, vec2i pos1, vec2i pos2, |
---|
56 | vec2i &posy, int &ysteps); |
---|
57 | |
---|
58 | enum PutMode { NORMAL, REMAP, REMAP2, FADE, FADE_TINT, COLOR, |
---|
59 | FILLED, PREDATOR, BLEND, SCANLINE }; |
---|
60 | template<int N> |
---|
61 | void PutImageGeneric(image *dest, vec2i pos, uint8_t color, |
---|
62 | image *blend, vec2i bpos, |
---|
63 | uint8_t *map1, uint8_t *map2, int amount, |
---|
64 | int nframes, uint8_t *tint, |
---|
65 | color_filter *f, palette *pal); |
---|
66 | |
---|
67 | vec2i m_size; |
---|
68 | uint8_t *m_data; |
---|
69 | }; |
---|
70 | |
---|
71 | #endif |
---|
72 | |
---|