2 Copyright (C) 2003 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __SURFACEHANDLER_H__
22 #define __SURFACEHANDLER_H__
26 /////////////// Define a struct to use as
27 /////////////// storage for all the surfaces
28 /////////////// created so far.
32 unsigned short int dwWidth; // Describes the width of the real texture area. Use lPitch to move between successive lines
33 unsigned short int dwHeight; // Describes the height of the real texture area
34 unsigned short int dwCreatedWidth; // Describes the width of the created texture area. Use lPitch to move between successive lines
35 unsigned short int dwCreatedHeight; // Describes the height of the created texture area
36 int lPitch; // Specifies the number of bytes on each row (not necessarily bitdepth*width/8)
37 void *lpSurface; // Pointer to the top left pixel of the image
58 uint32 m_dwWidth; // The requested Texture w/h
61 unsigned int m_dwCreatedTextureWidth; // What was actually created
62 unsigned int m_dwCreatedTextureHeight;
64 float m_fXScale; // = m_dwCorrectedWidth/m_dwWidth
65 float m_fYScale; // = m_dwCorrectedHeight/m_dwWidth
73 bool m_bIsEnhancedTexture;
77 virtual void ScaleImageToSurface(bool scaleS=true, bool scaleT=true);
78 virtual void ClampImageToSurfaceS();
79 virtual void ClampImageToSurfaceT();
81 virtual LPRICETEXTURE GetTexture() { return m_pTexture; }
83 uint32 GetPixelSize();
84 TextureFmt GetSurfaceFormat(void); // Surface pixel format...
85 inline void SetOthersVariables(void)
87 m_bClampedS = m_bScaledS = (m_dwWidth == m_dwCreatedTextureWidth);
88 m_bClampedT = m_bScaledT = (m_dwHeight == m_dwCreatedTextureHeight);
91 // Provides access to "surface"
92 virtual bool StartUpdate(DrawInfo *di)=0;
93 virtual void EndUpdate(DrawInfo *di)=0;
95 virtual void RestoreAlphaChannel(void); // Restore Alpha channel from RGB channel
98 CTexture(uint32 dwWidth, uint32 dwHeight, TextureUsage usage = AS_NORMAL);
99 LPRICETEXTURE m_pTexture;
100 TextureFmt m_dwTextureFmt;