ScummVM API documentation
zblit_public.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 GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
23 #define GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
24 
25 #include "common/rect.h"
26 
27 #include "graphics/surface.h"
28 
29 namespace TinyGL {
30 
31 struct BlitTransform {
32  BlitTransform(int dstX, int dstY) : _rotation(0), _originX(0), _originY(0), _aTint(1.0f),
33  _rTint(1.0f), _gTint(1.0f), _bTint(1.0), _flipHorizontally(false),
34  _flipVertically(false) {
35  _destinationRectangle.translate(dstX, dstY);
36  }
37 
38  void sourceRectangle(int srcX, int srcY, int srcWidth, int srcHeight) {
39  _sourceRectangle.left = srcX;
40  _sourceRectangle.top = srcY;
41  _sourceRectangle.setWidth(srcWidth);
42  _sourceRectangle.setHeight(srcHeight);
43  }
44 
45  void tint(float aTint, float rTint = 1.0f, float gTint = 1.0f, float bTint = 1.0f) {
46  _aTint = aTint;
47  _rTint = rTint;
48  _gTint = gTint;
49  _bTint = bTint;
50  }
51 /*
52  void scale(int width, int height) {
53  _destinationRectangle.setWidth(width);
54  _destinationRectangle.setHeight(height);
55  }
56 */
57  void rotate(int rotation, int originX, int originY) {
58  _rotation = rotation;
59  _originX = originX;
60  _originY = originY;
61  }
62 
63  void flip(bool verticalFlip, bool horizontalFlip) {
64  _flipVertically = verticalFlip;
65  _flipHorizontally = horizontalFlip;
66  }
67 
68  bool operator==(const BlitTransform &other) const {
69  return
70  _sourceRectangle == other._sourceRectangle && _destinationRectangle == other._destinationRectangle &&
71  _rotation == other._rotation && _originX == other._originX && _originY == other._originY &&
72  _aTint == other._aTint && _rTint == other._rTint && _gTint == other._gTint && _bTint == other._bTint &&
73  _flipHorizontally == other._flipHorizontally && _flipVertically == other._flipVertically;
74  }
75 
76  Common::Rect _sourceRectangle;
77  Common::Rect _destinationRectangle;
78  int _rotation;
79  int _originX, _originY;
80  float _aTint, _rTint, _gTint, _bTint;
81  bool _flipHorizontally, _flipVertically;
82 };
83 
84 struct BlitImage;
85 
86 } // end of namespace TinyGL
87 
92 TinyGL::BlitImage *tglGenBlitImage();
93 
101 void tglUploadBlitImage(TinyGL::BlitImage *blitImage, const Graphics::Surface &surface, uint32 colorKey, bool applyColorKey, bool zBuffer = false);
102 
107 void tglDeleteBlitImage(TinyGL::BlitImage *blitImage);
108 
115 void tglGetBlitImageSize(TinyGL::BlitImage *blitImage, int &width, int &height);
116 
122 int tglGetBlitImageVersion(TinyGL::BlitImage *blitImage);
123 
129 void tglBlit(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform);
130 
137 void tglBlit(TinyGL::BlitImage *blitImage, int x, int y);
138 
145 void tglBlitFast(TinyGL::BlitImage *blitImage, int x, int y);
146 
153 void tglBlitZBuffer(TinyGL::BlitImage *blitImage, int x, int y);
154 
155 void tglIncBlitImageRef(TinyGL::BlitImage *blitImage);
156 
157 #endif // GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
void setHeight(int16 aHeight)
Definition: rect.h:198
Definition: zblit_public.h:31
Definition: surface.h:67
Definition: rect.h:144
void translate(int16 dx, int16 dy)
Definition: rect.h:354
Definition: colormasks.h:27
void setWidth(int16 aWidth)
Definition: rect.h:194
int16 left
Definition: rect.h:145