ScummVM API documentation
renderedimage.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_RENDERED_IMAGE_H
32#define SWORD25_RENDERED_IMAGE_H
33
34// -----------------------------------------------------------------------------
35// INCLUDES
36// -----------------------------------------------------------------------------
37
38#include "sword25/kernel/common.h"
39#include "sword25/gfx/image/image.h"
40#include "sword25/gfx/graphicengine.h"
41#include "graphics/managed_surface.h"
42
43namespace Sword25 {
44
45class RenderedImage : public Image {
46private:
47 RenderedImage(const RenderedImage &) : Image(), _doCleanup(false) {}
48 RenderedImage &operator=(const RenderedImage &) { return *this; }
49public:
50 RenderedImage(const Common::String &filename, bool &result);
51
60 RenderedImage(uint width, uint height, bool &result);
62
63 ~RenderedImage() override;
64
65 int getWidth() const override {
66 return _surface.w;
67 }
68 int getHeight() const override {
69 return _surface.h;
70 }
71
72 void copyDirectly(int posX, int posY);
73
74 bool blit(int posX = 0, int posY = 0,
75 int flipping = Graphics::FLIP_NONE,
76 Common::Rect *pPartRect = NULL,
77 uint color = BS_ARGB(255, 255, 255, 255),
78 int width = -1, int height = -1,
79 RectangleList *updateRects = 0) override;
80 bool fill(const Common::Rect *pFillRect, uint color) override;
81 bool setContent(const byte *pixeldata, uint size, uint offset = 0, uint stride = 0) override;
82 void replaceContent(byte *pixeldata, int width, int height);
83 uint getPixel(int x, int y) override;
84
85 bool isBlitSource() const override {
86 return true;
87 }
88 bool isBlitTarget() const override {
89 return false;
90 }
91 bool isScalingAllowed() const override {
92 return true;
93 }
94 bool isFillingAllowed() const override {
95 return false;
96 }
97 bool isAlphaAllowed() const override {
98 return true;
99 }
100 bool isColorModulationAllowed() const override {
101 return true;
102 }
103 bool isSetContentAllowed() const override {
104 return true;
105 }
106
107 void setAlphaType(Graphics::AlphaType alphaType) { _alphaType = alphaType; }
108 bool isSolid() const override { return _alphaType == Graphics::ALPHA_OPAQUE; }
109
110private:
112 Graphics::AlphaType _alphaType;
113 bool _doCleanup;
114
115 Graphics::ManagedSurface *_backSurface;
116};
117
118} // End of namespace Sword25
119
120#endif
Definition: str.h:59
Definition: managed_surface.h:51
int16 & w
Definition: managed_surface.h:134
int16 & h
Definition: managed_surface.h:135
Definition: image.h:50
Definition: microtiles.h:38
Definition: renderedimage.h:45
bool isBlitSource() const override
Checks, if it is allowed to call BS_Image Blit().
Definition: renderedimage.h:85
bool isAlphaAllowed() const override
Returns true, if the BS_Image is allowed to be displayed with an alpha value.
Definition: renderedimage.h:97
int getWidth() const override
Returns the width of the image in pixels.
Definition: renderedimage.h:65
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) override
renders the image in the framebuffer
bool isColorModulationAllowed() const override
Return true, if the BS_Image is allowed to be displayed with color modulation by a Blit() call.
Definition: renderedimage.h:100
bool isSetContentAllowed() const override
Returns true, if the content of the BS_Image is allowed to be replaced by call of SetContent().
Definition: renderedimage.h:103
bool isBlitTarget() const override
Checks, if the BS_Image can be a target image for a Blit call.
Definition: renderedimage.h:88
bool isScalingAllowed() const override
Returns true, if the BS_Image is allowed to be scaled by a Blit() call.
Definition: renderedimage.h:91
RenderedImage(uint width, uint height, bool &result)
Creates an empty BS_RenderedImage.
bool isFillingAllowed() const override
Returns true, if the BS_Image is allowed to be filled by a Fill() call.
Definition: renderedimage.h:94
bool setContent(const byte *pixeldata, uint size, uint offset=0, uint stride=0) override
Fills the content of the image with pixel data.
int getHeight() const override
Returns the height of the image in pixels.
Definition: renderedimage.h:68
uint getPixel(int x, int y) override
Reads out a pixel of the image.
bool fill(const Common::Rect *pFillRect, uint color) override
fills a rectangular section of the image with a color.
@ FLIP_NONE
The image will not be flipped.
Definition: transform_struct.h:49
Definition: console.h:27
Definition: rect.h:536