ScummVM API documentation
buffer.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef MADS_CORE_BUFFER_H
23#define MADS_CORE_BUFFER_H
24
25#include "mads/core/general.h"
26#include "mads/core/font.h"
27
28namespace MADS {
29
30#define MAX_PEEL_VALUE 80
31
32#define BUFFER_PRESERVE -1 /* Normal preserve attempt (EMS or disk) */
33#define BUFFER_PRESERVE_RAM -2 /* Disallows disk preservation */
34#define BUFFER_ATTEMPT_CONVENTIONAL -8 /* Attempt conventional preserve */
35
36#define BUFFER_PRESERVED_CONVENTIONAL -1 /* Preserved in conventional memory */
37#define BUFFER_NOT_PRESERVED -3 /* All attempts to preserve failed */
38#define BUFFER_PRESERVED_DISK -10 /* Preserved on disk */
39
40
41extern int buffer_restore_keep_flag;
42extern word pattern_control_value;
43extern int auto_pattern;
44
45
50extern bool buffer_init(Buffer *buf, word x, word y);
51
56extern bool buffer_init_name(Buffer *buf, word x, word y, const char *block_name);
57
63extern bool buffer_free(Buffer *buf);
64
69extern bool buffer_fill(Buffer &target, byte value);
70
82extern bool buffer_rect_copy(Buffer from, Buffer unto,
83 int ul_x, int ul_y, int size_x, int size_y);
84
92extern bool buffer_rect_fill(Buffer &target,
93 int ul_x, int ul_y, int size_x, int size_y, byte value);
94
105extern bool buffer_rect_copy_2(const Buffer &from, Buffer &unto,
106 int from_x, int from_y,
107 int unto_x, int unto_y,
108 int size_x, int size_y);
109
113extern void buffer_put_pixel(Buffer &buf, word x, word y, byte c);
114
118extern byte buffer_get_pixel(const Buffer &buf, word x, word y);
119
124extern void buffer_hline(Buffer &buf, word x1, word x2, word y, byte color);
125
130extern void buffer_vline(Buffer &buf, word x, word y1, word y2, byte color);
131
135extern void buffer_draw_box(Buffer &buf, word x1, word y1, word x2, word y2, byte color);
136
140extern void buffer_hline_xor(Buffer &buf, int x1, int x2, int y);
141
145extern void buffer_vline_xor(Buffer &buf, int x, int y1, int y2);
146
150extern void buffer_draw_crosshair(Buffer &buf, int x, int y);
151
155extern void buffer_draw_box_xor(Buffer &buf, int x1, int y1, int x2, int y2);
156
163extern bool buffer_get_delta_bounds(Buffer &buf1, Buffer buf2,
164 byte newcol, word *xl, word *xh, word *yl, word *yh);
165
173extern byte *buffer_pointer(Buffer *buf, int x, int y);
174extern const byte *buffer_pointer(const Buffer *buf, int x, int y);
175
176extern bool buffer_conform(Buffer *buffer, int *x, int *y,
177 int *xs, int *ys);
178
191extern int buffer_inter_merge_2(Buffer from, Buffer unto,
192 int from_x, int from_y, int unto_x, int unto_y, int size_x, int size_y);
193
199extern void buffer_line(Buffer target, int x1, int y1, int x2, int y2,
200 int color);
201
208extern void buffer_line_xor(Buffer target, int x1, int y1, int x2, int y2);
209
220extern int buffer_legal(const Buffer &walk, int orig_wrap, int x1, int y1, int x2, int y2);
221
222extern word buffer_rect_fill_pattern(Buffer target, int ul_x, int ul_y, int size_x, int size_y,
223 int base_x, int base_y, int base_xs, byte value1, byte value2,
224 word start_accum, word note_line);
225
233extern bool buffer_rect_fill_swap(Buffer target, int ul_x, int ul_y,
234 int size_x, int size_y, byte value1, byte value2);
235
236extern void buffer_peel_horiz(Buffer *target, int peel);
237
238extern void buffer_peel_vert(Buffer *target, int peel,
239 byte *work_memory, long work_size);
240
241extern int buffer_to_disk(Buffer *source, int x, int y, int xs, int ys);
242extern void buffer_from_disk(Buffer *source, int buffer_id, int x, int y, int xs, int ys);
243
244extern int buffer_preserve(Buffer *source, int flags,
245 int source_ems_handle, int x, int y, int xs, int ys);
246extern void buffer_restore(Buffer *source, int preserve_handle,
247 int target_ems_handle, int x, int y, int xs, int ys);
248
249extern bool buffer_rect_translate(Buffer from, Buffer unto,
250 int from_x, int from_y, int unto_x, int unto_y,
251 int size_x, int size_y, byte *table);
252
253extern bool buffer_scan(Buffer *buffer, int magic,
254 int base_x, int base_y, int size_x, int size_y);
255
256extern bool buffer_compare(Buffer *buffer0, Buffer *buffer1,
257 int base_x, int base_y, int base_x2, int base_y2, int size_x, int size_y);
258
259} // namespace MADS
260
261#endif
Definition: display_client.h:113
void buffer_put_pixel(Buffer *buf, int32 x, int32 y, byte c)