ScummVM API documentation
color.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 AGS_LIB_ALLEGRO_COLOR_H
23#define AGS_LIB_ALLEGRO_COLOR_H
24
25#include "common/scummsys.h"
26#include "graphics/screen.h"
27#include "ags/lib/allegro/base.h"
28#include "ags/lib/allegro/alconfig.h"
29
30namespace AGS3 {
31
32#define PAL_SIZE 256
33#define MASK_COLOR_8 0
34#define MASK_COLOR_15 0x7C1F
35#define MASK_COLOR_16 0xF81F
36#define MASK_COLOR_24 0xFF00FF
37#define MASK_COLOR_32 0xFF00FF
38
39class BITMAP;
40
41namespace AGS {
42namespace Shared {
43class Stream;
44} // namespace Shared
45} // namespace AGS
46
47#include "common/pack-start.h" // START STRUCT PACKING
48
49struct color {
50 byte r, g, b;
51 byte filler;
52
53 void readFromFile(AGS::Shared::Stream *file);
54 void writeToFile(AGS::Shared::Stream *file) const;
55 void clear() {
56 r = g = b = filler = 0;
57 }
58} PACKED_STRUCT;
59
60typedef color RGB;
61typedef RGB PALETTE[PAL_SIZE];
62
63#include "common/pack-end.h" // END STRUCT PACKING
64
65struct RGB_MAP {
66 byte data[32][32][32];
67};
68
69struct COLOR_MAP {
70 byte data[PAL_SIZE][PAL_SIZE];
71};
72
73enum BlenderMode {
74 kSourceAlphaBlender,
75 kArgbToArgbBlender,
76 kArgbToRgbBlender,
77 kRgbToArgbBlender,
78 kRgbToRgbBlender,
79 kAlphaPreservedBlenderMode,
80 kOpaqueBlenderMode,
81 kAdditiveBlenderMode,
82 kTintBlenderMode,
83 kTintLightBlenderMode
84};
85
86extern int makecol(byte r, byte g, byte b);
87
88AL_ARRAY(const int, _rgb_scale_5);
89AL_ARRAY(const int, _rgb_scale_6);
90
91AL_FUNC(void, set_palette, (AL_CONST PALETTE p));
92AL_FUNC(void, set_palette_range, (AL_CONST PALETTE p, int from, int to, int retracesync));
93
94AL_FUNC(void, get_color, (int idx, RGB *p));
95AL_FUNC(void, get_palette, (PALETTE p));
96AL_FUNC(void, get_palette_range, (PALETTE p, int from, int to));
97
98AL_FUNC(void, fade_interpolate, (AL_CONST PALETTE source, AL_CONST PALETTE dest, PALETTE output, int pos, int from, int to));
99
100AL_FUNC(void, select_palette, (AL_CONST PALETTE p));
101AL_FUNC(void, unselect_palette, (void));
102
103AL_FUNC(void, create_rgb_table, (RGB_MAP *table, AL_CONST PALETTE pal, AL_METHOD(void, callback, (int pos))));
104AL_FUNC(void, create_light_table, (COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, int b, AL_METHOD(void, callback, (int pos))));
105AL_FUNC(void, create_trans_table, (COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, int b, AL_METHOD(void, callback, (int pos))));
106
107AL_FUNC(void, set_blender_mode, (BlenderMode, int r, int g, int b, int a));
108AL_FUNC(void, set_alpha_blender, (void));
109AL_FUNC(void, set_trans_blender, (int r, int g, int b, int a));
110
111AL_FUNC(void, hsv_to_rgb, (float h, float s, float v, int *r, int *g, int *b));
112AL_FUNC(void, rgb_to_hsv, (int r, int g, int b, float *h, float *s, float *v));
113
114AL_FUNC(int, bestfit_color, (AL_CONST PALETTE pal, int r, int g, int b));
115
116AL_FUNC(int, makecol8, (int r, int g, int b));
117AL_FUNC(int, makecol_depth, (int color_depth, int r, int g, int b));
118
119AL_FUNC(int, makeacol_depth, (int color_depth, int r, int g, int b, int a));
120
121AL_FUNC(int, getr, (int c));
122AL_FUNC(int, getg, (int c));
123AL_FUNC(int, getb, (int c));
124AL_FUNC(int, geta, (int c));
125
126AL_FUNC(int, getr_depth, (int color_depth, int c));
127AL_FUNC(int, getg_depth, (int color_depth, int c));
128AL_FUNC(int, getb_depth, (int color_depth, int c));
129AL_FUNC(int, geta_depth, (int color_depth, int c));
130
131extern int makecol15(int r, int g, int b);
132extern int makecol16(int r, int g, int b);
133extern int makecol24(int r, int g, int b);
134extern int makecol32(int r, int g, int b);
135extern int makeacol32(int r, int g, int b, int a);
136extern int getr8(int c);
137extern int getg8(int c);
138extern int getb8(int c);
139extern int getr15(int c);
140extern int getg15(int c);
141extern int getb15(int c);
142extern int getr16(int c);
143extern int getg16(int c);
144extern int getb16(int c);
145extern int getr24(int c);
146extern int getg24(int c);
147extern int getb24(int c);
148extern int getr32(int c);
149extern int getg32(int c);
150extern int getb32(int c);
151extern int geta32(int c);
152
153} // namespace AGS3
154
155#endif
Definition: stream.h:52
Definition: color.h:69
Definition: color.h:65
Definition: color.h:49