ScummVM API documentation
bitmap.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 Broken Sword 2.5 engine
24 *
25 * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
26 *
27 * Licensed under GNU GPL v2
28 *
29 */
30
31#ifndef SWORD25_BITMAP_H
32#define SWORD25_BITMAP_H
33
34#include "sword25/kernel/common.h"
35#include "sword25/gfx/graphicengine.h"
36#include "sword25/gfx/renderobject.h"
37
38namespace Sword25 {
39
40class Bitmap : public RenderObject {
41protected:
42 Bitmap(RenderObjectPtr<RenderObject> parentPtr, TYPES type, uint handle = 0);
43
44public:
45
46 ~Bitmap() override;
47
53 void setAlpha(int alpha);
54
60 void setModulationColor(uint modulationColor);
61
67 void setScaleFactor(float scaleFactor);
68
74 void setScaleFactorX(float scaleFactorX);
75
81 void setScaleFactorY(float scaleFactorY);
82
86 void setFlipH(bool flipH);
87
91 void setFlipV(bool flipV);
92
97 int getAlpha() {
98 return _modulationColor >> BS_ASHIFT;
99 }
100
106 return _modulationColor & BS_RGBMASK;
107 }
108
113 float getScaleFactorX() const {
114 return _scaleFactorX;
115 }
116
121 float getScaleFactorY() const {
122 return _scaleFactorY;
123 }
124
128 bool isFlipH() {
129 return _flipH;
130 }
131
135 bool isFlipV() {
136 return _flipV;
137 }
138
139 // -----------------------------------------------------------------------------
140 // Die folgenden Methoden müssen alle BS_Bitmap-Klassen implementieren
141 // -----------------------------------------------------------------------------
142
151 virtual uint getPixel(int x, int y) const = 0;
152
164 virtual bool setContent(const byte *pixeldata, uint size, uint offset = 0, uint stride = 0) = 0;
165
166 virtual bool isScalingAllowed() const = 0;
167 virtual bool isAlphaAllowed() const = 0;
168 virtual bool isColorModulationAllowed() const = 0;
169 virtual bool isSetContentAllowed() const = 0;
170
171 bool persist(OutputPersistenceBlock &writer) override;
172 bool unpersist(InputPersistenceBlock &reader) override;
173
174protected:
175 bool _flipH;
176 bool _flipV;
177 float _scaleFactorX;
178 float _scaleFactorY;
179 uint32 _modulationColor;
180 int32 _originalWidth;
181 int32 _originalHeight;
182};
183
184} // End of namespace Sword25
185
186#endif
Definition: bitmap.h:40
int getModulationColor()
Gibt die aktuelle 24bit RGB Modulationsfarde des Bildes zurück.
Definition: bitmap.h:105
bool isFlipH()
Gibt zurück, ob das Bild an der X-Achse gespiegelt angezeigt wird.
Definition: bitmap.h:128
void setScaleFactorY(float scaleFactorY)
Setzt den Skalierungsfaktor der Bitmap auf der Y-Achse.
void setAlpha(int alpha)
Setzt den Alphawert des Bitmaps.
void setFlipH(bool flipH)
Legt fest, ob das Bild an der X-Achse gespiegelt werden soll.
bool isFlipV()
Gibt zurück, ob das Bild an der Y-Achse gespiegelt angezeigt wird.
Definition: bitmap.h:135
void setScaleFactorX(float scaleFactorX)
Setzt den Skalierungsfaktor der Bitmap auf der X-Achse.
virtual bool setContent(const byte *pixeldata, uint size, uint offset=0, uint stride=0)=0
Füllt den Inhalt des Bildes mit Pixeldaten.
void setScaleFactor(float scaleFactor)
Setzt den Skalierungsfaktor des Bitmaps.
int getAlpha()
Gibt den aktuellen Alphawert des Bildes zurück.
Definition: bitmap.h:97
virtual uint getPixel(int x, int y) const =0
Liest einen Pixel des Bildes.
void setFlipV(bool flipV)
Legt fest, ob das Bild an der Y-Achse gespiegelt werden soll.
float getScaleFactorY() const
Gibt den Skalierungsfakter des Bitmaps auf der Y-Achse zurück.
Definition: bitmap.h:121
float getScaleFactorX() const
Gibt den Skalierungsfakter des Bitmaps auf der X-Achse zurück.
Definition: bitmap.h:113
void setModulationColor(uint modulationColor)
Setzt die Modulationfarbe der Bitmaps.
Definition: inputpersistenceblock.h:40
Definition: outputpersistenceblock.h:39
Dieses ist die Klasse die sämtliche sichtbaren Objekte beschreibt.
Definition: renderobject.h:72
TYPES
Definition: renderobject.h:76
Definition: renderobjectptr.h:46
Definition: console.h:27