ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

zblit.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 /*
00024  * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
00025  * which is licensed under the zlib-license (see LICENSE).
00026  * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
00027  */
00028 
00029 #ifndef GRAPHICS_TINYGL_ZBLIT_H_
00030 #define GRAPHICS_TINYGL_ZBLIT_H_
00031 
00032 #include "graphics/surface.h"
00033 #include "common/rect.h"
00034 
00035 namespace Graphics {
00036 
00037 struct BlitTransform {
00038     BlitTransform(int dstX, int dstY) : _rotation(0), _originX(0), _originY(0), _aTint(1.0f),
00039                 _rTint(1.0f), _gTint(1.0f), _bTint(1.0), _flipHorizontally(false),
00040                 _flipVertically(false) {
00041         _destinationRectangle.translate(dstX,dstY);
00042     }
00043 
00044     void sourceRectangle(int srcX, int srcY, int srcWidth, int srcHeight) {
00045         _sourceRectangle.left = srcX;
00046         _sourceRectangle.top = srcY;
00047         _sourceRectangle.setWidth(srcWidth);
00048         _sourceRectangle.setHeight(srcHeight);
00049     }
00050 
00051     void tint(float aTint, float rTint = 1.0f, float gTint = 1.0f, float bTint = 1.0f) {
00052         _aTint = aTint;
00053         _rTint = rTint;
00054         _gTint = gTint;
00055         _bTint = bTint;
00056     }
00057 
00058     void scale(int width, int height) {
00059         _destinationRectangle.setWidth(width);
00060         _destinationRectangle.setHeight(height);
00061     }
00062 
00063     void rotate(int rotation, int originX, int originY) {
00064         _rotation = rotation;
00065         _originX = originX;
00066         _originY = originY;
00067     }
00068 
00069     void flip(bool verticalFlip, bool horizontalFlip) {
00070         _flipVertically = verticalFlip;
00071         _flipHorizontally = horizontalFlip;
00072     }
00073 
00074     bool operator==(const BlitTransform &other) const {
00075         return _sourceRectangle == other._sourceRectangle && _destinationRectangle == other._destinationRectangle &&
00076             _rotation == other._rotation && _originX == other._originX && _originY == other._originY &&
00077             _aTint == other._aTint && _rTint == other._rTint && _gTint == other._gTint && _bTint == other._bTint &&
00078             _flipHorizontally == other._flipHorizontally && _flipVertically == other._flipVertically;
00079     }
00080 
00081     Common::Rect _sourceRectangle;
00082     Common::Rect _destinationRectangle;
00083     int _rotation;
00084     int _originX, _originY;
00085     float _aTint, _rTint, _gTint, _bTint;
00086     bool _flipHorizontally, _flipVertically;
00087 };
00088 
00089 struct BlitImage;
00090 
00095 BlitImage *tglGenBlitImage();
00096 
00104 void tglUploadBlitImage(BlitImage *blitImage, const Graphics::Surface &surface, uint32 colorKey, bool applyColorKey);
00105 
00110 void tglDeleteBlitImage(BlitImage *blitImage);
00111 
00118 void tglGetBlitImageSize(BlitImage *blitImage, int &width, int &height);
00119 
00125 int tglGetBlitImageVersion(BlitImage *blitImage);
00126 
00132 void tglBlit(BlitImage *blitImage, const BlitTransform &transform);
00133 
00140 void tglBlit(BlitImage *blitImage, int x, int y);
00141 
00147 void tglBlitNoBlend(BlitImage *blitImage, const BlitTransform &transform);
00148 
00155 void tglBlitFast(BlitImage *blitImage, int x, int y);
00156 
00163 void tglBlitZBuffer(BlitImage *blitImage, int x, int y);
00164 
00165 void tglIncBlitImageRef(BlitImage *blitImage);
00166 
00167 namespace Internal {
00171     void tglCleanupImages(); // This function checks if any blit image is to be cleaned up and deletes it.
00172     
00173     // Documentation for those is the same as the one before, only those function are the one that actually execute the correct code path.
00174     void tglBlit(BlitImage *blitImage, const BlitTransform &transform);
00175 
00176     // Disables blending explicitly.
00177     void tglBlitNoBlend(BlitImage *blitImage, const BlitTransform &transform);
00178 
00179     // Disables blending, transforms and tinting.
00180     void tglBlitFast(BlitImage *blitImage, int x, int y);
00181 
00182     void tglBlitZBuffer(BlitImage *blitImage, int x, int y);
00183 
00187     void tglBlitSetScissorRect(const Common::Rect &rect);
00188     void tglBlitResetScissorRect(void);
00189 } // end of namespace Internal
00190 
00191 } // end of namespace Graphics
00192 
00193 #endif // GRAPHICS_TINYGL_ZBLIT_H_


Generated on Sat Jul 20 2019 05:01:01 for ResidualVM by doxygen 1.7.1
curved edge   curved edge