ScummVM API documentation
Image.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
/*
23
* This code is based on the CRAB engine
24
*
25
* Copyright (c) Arvind Raja Yadav
26
*
27
* Licensed under MIT
28
*
29
*/
30
31
#ifndef CRAB_IMAGE_H
32
#define CRAB_IMAGE_H
33
34
#include "crab/Rectangle.h"
35
#include "crab/rapidxml/rapidxml.hpp"
36
37
namespace
Graphics
{
38
class
ManagedSurface;
39
struct
Surface;
40
}
// End of namespace Graphics
41
42
namespace
Common
{
43
struct
Rect;
44
}
// End of namespace Common
45
46
namespace
Crab
{
47
48
namespace
pyrodactyl {
49
namespace
image {
50
// Image data used in Asset Manager
51
class
Image
{
52
// The dimensions of the image
53
int
_w, _h;
54
55
enum
ImageRotateDegrees {
56
kImageRotateBy90,
57
kImageRotateBy180,
58
kImageRotateBy270
59
};
60
61
public
:
62
Graphics::ManagedSurface
*_texture;
63
64
Image
() : _texture(
nullptr
), _w(0), _h(0) {}
65
~
Image
() {}
66
67
Graphics::Surface
* rotate(
const
Graphics::ManagedSurface
&src, ImageRotateDegrees rotation);
68
69
// Set color modulation
70
void
color(
const
uint8 &r,
const
uint8 &g,
const
uint8 &b) {
71
#if 0
72
SDL_SetTextureColorMod(texture, r, g, b);
73
#endif
74
warning
(
"Setting color modulation for texture: %d %d %d"
, r, g, b);
75
}
76
77
// Set blending
78
#if 0
79
void
BlendMode(
const
SDL_BlendMode &mode) { SDL_SetTextureBlendMode(texture, mode); }
80
#endif
81
82
// Set alpha modulation
83
int
alpha(
const
uint8 &alpha) {
84
#if 0
85
return
SDL_SetTextureAlphaMod(texture, alpha);
86
#endif
87
debug
(5,
"Setting alpha modulation for texture: %d "
, alpha);
88
return
0;
89
}
90
91
// Get alpha modulation
92
uint8 alpha() {
93
uint8 res = 255;
94
#if 0
95
SDL_GetTextureAlphaMod(texture, &res);
96
#endif
97
return
res;
98
}
99
100
// Load the image
101
bool
load(
const
Common::Path
&path);
102
bool
load(rapidxml::xml_node<char> *node,
const
char
*name);
103
bool
load(
Graphics::Surface
*surface);
104
bool
load(
Graphics::ManagedSurface
*surface);
105
106
107
// Draw the texture
108
void
draw(
const
int
&x,
const
int
&y,
Common::Rect
*clip =
nullptr
,
const
TextureFlipType &flip = FLIP_NONE);
109
void
draw(
const
int
&x,
const
int
&y,
Rect
*clip,
const
TextureFlipType &flip = FLIP_NONE,
Graphics::ManagedSurface
*surf =
nullptr
);
110
void
fastDraw(
const
int
&x,
const
int
&y,
Rect
*clip =
nullptr
);
111
112
// Delete the texture
113
void
deleteImage();
114
115
int
w() {
116
return
_w;
117
}
118
119
int
h() {
120
return
_h;
121
}
122
123
bool
valid() {
124
return
_texture !=
nullptr
;
125
}
126
};
127
}
// End of namespace image
128
}
// End of namespace pyrodactyl
129
130
}
// End of namespace Crab
131
132
#endif // CRAB_IMAGE_H
Graphics::ManagedSurface
Definition:
managed_surface.h:51
Graphics::Surface
Definition:
surface.h:67
Crab::Rect
Definition:
Rectangle.h:42
warning
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Common::Rect
Definition:
rect.h:144
Common::Path
Definition:
path.h:52
debug
void debug(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Common
Definition:
algorithm.h:29
Graphics
Definition:
formatinfo.h:28
Crab
Definition:
moveeffect.h:37
Image
Definition:
movie_decoder.h:32
engines
crab
image
Image.h
Generated on Sat Aug 31 2024 09:08:45 for ScummVM API documentation by
1.8.13