ScummVM API documentation
bitmapresource.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_RESOURCE_H
32 #define SWORD25_BITMAP_RESOURCE_H
33 
34 #include "sword25/kernel/common.h"
35 #include "sword25/kernel/resource.h"
36 #include "sword25/gfx/image/image.h"
37 
38 namespace Sword25 {
39 
40 class BitmapResource : public Resource {
41 public:
42  BitmapResource(const Common::String &filename, Image *pImage) :
43  _pImage(pImage), Resource(filename, Resource::TYPE_BITMAP) {}
44  ~BitmapResource() override { delete _pImage; }
45 
49  bool isValid() const {
50  return (_pImage != 0);
51  }
52 
56  int getWidth() const {
57  assert(_pImage);
58  return _pImage->getWidth();
59  }
60 
64  int getHeight() const {
65  assert(_pImage);
66  return _pImage->getHeight();
67  }
68 
105  bool blit(int posX = 0, int posY = 0,
106  int flipping = Graphics::FLIP_NONE,
107  Common::Rect *pSrcPartRect = NULL,
108  uint color = BS_ARGB(255, 255, 255, 255),
109  int width = -1, int height = -1,
110  RectangleList *updateRects = 0) {
111  assert(_pImage);
112  return _pImage->blit(posX, posY, flipping, pSrcPartRect, color, width, height, updateRects);
113  }
114 
128  bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)) {
129  assert(_pImage);
130  return _pImage->fill(pFillRect, color);
131  }
132 
141  uint getPixel(int x, int y) const {
142  return _pImage->getPixel(x, y);
143  }
144 
146 
152  bool isBlitTarget() {
153  assert(_pImage);
154  return _pImage->isBlitTarget();
155  }
156 
161  assert(_pImage);
162  return _pImage->isScalingAllowed();
163  }
164 
169  assert(_pImage);
170  return _pImage->isFillingAllowed();
171  }
172 
176  bool isAlphaAllowed() {
177  assert(_pImage);
178  return _pImage->isAlphaAllowed();
179  }
180 
185  assert(_pImage);
186  return _pImage->isColorModulationAllowed();
187  }
188 
189  bool isSolid() {
190  assert(_pImage);
191  return _pImage->isSolid();
192  }
193 
194 private:
195  Image *_pImage;
196 };
197 
198 } // End of namespace Sword25
199 
200 #endif
bool isBlitTarget()
Überprüft, ob das BS_Image ein Zielbild für einen Blit-Aufruf sein kann.
Definition: bitmapresource.h:152
virtual uint getPixel(int x, int y)=0
Reads out a pixel of the image.
Definition: str.h:59
virtual bool isScalingAllowed() const =0
Returns true, if the BS_Image is allowed to be scaled by a Blit() call.
uint getPixel(int x, int y) const
Liest einen Pixel des Bildes.
Definition: bitmapresource.h:141
Definition: rect.h:144
virtual int getHeight() const =0
Returns the height of the image in pixels.
Definition: microtiles.h:38
virtual bool fill(const Common::Rect *pFillRect=0, uint color=BS_RGB(0, 0, 0))=0
fills a rectangular section of the image with a color.
virtual bool isAlphaAllowed() const =0
Returns true, if the BS_Image is allowed to be displayed with an alpha value.
Definition: resource.h:43
bool isColorModulationAllowed()
Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit Farbmodulation dargestellt werden...
Definition: bitmapresource.h:184
bool isAlphaAllowed()
Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit einem Alphawert dargestellt werde...
Definition: bitmapresource.h:176
Definition: console.h:27
int getHeight() const
Gibt die Höhe des Bitmaps zurück.
Definition: bitmapresource.h:64
virtual int getWidth() const =0
Returns the width of the image in pixels.
virtual bool isBlitTarget() const =0
Checks, if the BS_Image can be a target image for a Blit call.
virtual bool isFillingAllowed() const =0
Returns true, if the BS_Image is allowed to be filled by a Fill() call.
bool isFillingAllowed()
Gibt true zurück, wenn das BS_Image mit einem Aufruf von Fill() gefüllt werden kann.
Definition: bitmapresource.h:168
int getWidth() const
Gibt die Breite des Bitmaps zurück.
Definition: bitmapresource.h:56
bool isScalingAllowed()
Gibt true zurück, falls das BS_Image bei einem Aufruf von Blit() skaliert dargestellt werden kann...
Definition: bitmapresource.h:160
bool blit(int posX=0, int posY=0, int flipping=Graphics::FLIP_NONE, Common::Rect *pSrcPartRect=NULL, uint color=BS_ARGB(255, 255, 255, 255), int width=-1, int height=-1, RectangleList *updateRects=0)
Rendert das Bild in den Framebuffer.
Definition: bitmapresource.h:105
virtual bool blit(int posX=0, int posY=0, int flipping=Graphics::FLIP_NONE, Common::Rect *pPartRect=NULL, uint color=BS_ARGB(255, 255, 255, 255), int width=-1, int height=-1, RectangleList *updateRects=0)=0
renders the image in the framebuffer
Definition: movie_decoder.h:32
bool fill(const Common::Rect *pFillRect=0, uint color=BS_RGB(0, 0, 0))
Füllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
Definition: bitmapresource.h:128
bool isValid() const
Gibt zurück, ob das Objekt einen gültigen Zustand hat.
Definition: bitmapresource.h:49
virtual bool isColorModulationAllowed() const =0
Return true, if the BS_Image is allowed to be displayed with color modulation by a Blit() call...
Definition: bitmapresource.h:40