-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompactMap.h
81 lines (60 loc) · 2.2 KB
/
CompactMap.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright 2011 Matt DeVore
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class SurfaceFiller;
class CompactMap {
Buffer left_over_pixels, pattern_pixels;
typedef struct {
BYTE x, opaque_count;
} RUN;
typedef Array<RUN> ROW;
typedef Array<ROW> VCTR_ROW;
VCTR_ROW left_over;
typedef struct {
BYTE x, y, w, h;
} RCT;
/** Colors of the blocks. */
Array<BYTE> blocks;
/** Coordinates of the blocks. */
Array<Array<RCT> > block_areas;
typedef struct {
BYTE x, y;
} PNT;
typedef struct {
Array<PNT> spots;
BYTE width, height;
} PATTERN;
Array<PATTERN> patterns;
/** Renders this compact map to the given locked surface region. No clipping
* is performed.
*/
void Render(BYTE *surf_ptr, int pitch);
friend class CmpFiller;
public:
CompactMap(BYTE **source);
static std::auto_ptr<std::vector<CompactMap *> >
LoadMapSet(const char *type, const char *res_name);
/** Renders the "step 1" component of the compact map, which is comprised
* entirely of rectangles. A lock must be obtained on the buffer of the given
* Graphics object, which is done automatically if there is no lock already.
*
* @param gfx the Graphics object to which to draw the rectangles.
* @param x the x-coordinate at which to draw the rectangles.
* @param y the y-coordinate at which to draw the rectangles.
* @param clip Indicates whether to clip the rectangles to the Graphics
* buffer. If this is false when portions of the rectangles reach outside of
* the Graphics buffer, the results are undefined.
*/
void RenderStep1(Gfx *gfx, int x, int y, bool clip);
inline bool NoStep2() {return left_over.Empty() && patterns.Empty();}
std::auto_ptr<Gfx::SurfaceFiller> Filler();
};