ScummVM API documentation
base_surface_tinygl.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 WINTERMUTE_BASE_SURFACE_TINYGL_H
23#define WINTERMUTE_BASE_SURFACE_TINYGL_H
24
25#include "engines/wintermute/base/gfx/base_surface.h"
26
27#if defined(USE_TINYGL)
28
29#include "graphics/tinygl/tinygl.h"
30
31namespace Wintermute {
32
33class BaseGame;
34class BaseRenderer3D;
35
36class BaseSurfaceTinyGL : public BaseSurface {
37public:
38 BaseSurfaceTinyGL(BaseGame *game, BaseRenderer3D *renderer);
39 ~BaseSurfaceTinyGL();
40
41 bool invalidate() override;
42 bool prepareToDraw() override;
43
44 bool displayTransRotate(int x, int y, float rotate, int32 hotspotX, int32 hotspotY, Common::Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
45 bool displayTransZoom(int x, int y, Common::Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
46 bool displayTrans(int x, int y, Common::Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
47 bool display(int x, int y, Common::Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
48 bool displayTiled(int x, int y, Common::Rect32 rect, int numTimesX, int numTimesY) override;
49 bool create(const char *filename, bool texture2D, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
50 bool create(int width, int height) override;
51 bool setAlphaImage(const char *filename) override;
52 bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
53 bool putPixel(int x, int y, byte r, byte g, byte b, byte a) override;
54 bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const override;
55 bool startPixelOp() override;
56 bool endPixelOp() override;
57 bool isTransparentAtLite(int x, int y) const override;
58
59 void setTexture();
60
61 int getWidth() override {
62 return _width;
63 }
64
65 int getHeight() override {
66 return _height;
67 }
68
69 uint getGLTextureWidth() const {
70 return _texWidth;
71 }
72
73 uint getGLTextureHeight() const {
74 return _texHeight;
75 }
76
77 TinyGL::BlitImage *getBlitImage() {
78 return _blitImage;
79 }
80
81private:
82 TGLuint _tex;
83 BaseRenderer3D *_renderer;
84 Graphics::Surface *_imageData;
85 Graphics::Surface *_maskData;
86 uint _texWidth{};
87 uint _texHeight{};
88 bool _pixelOpReady;
89 bool _surfaceModified;
90 TinyGL::BlitImage *_blitImage;
91 bool _texture2D;
92
93 bool loadImage();
94 void writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask);
95};
96
97} // End of namespace Wintermute
98
99#endif // defined(USE_TINYGL)
100
101#endif
Definition: rect.h:538
Definition: surface.h:67