ScummVM API documentation
transform_struct.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_TRANSFORM_STRUCT_H
23 #define GRAPHICS_TRANSFORM_STRUCT_H
24 
25 #include "common/rect.h"
26 
27 namespace Graphics {
28 
29 enum TSpriteBlendMode {
30  BLEND_UNKNOWN = -1,
31  BLEND_NORMAL = 0,
32  BLEND_ADDITIVE = 1,
33  BLEND_SUBTRACTIVE = 2,
34  BLEND_MULTIPLY = 3,
35  NUM_BLEND_MODES
36 };
37 
38 enum AlphaType {
39  ALPHA_OPAQUE = 0,
40  ALPHA_BINARY = 1,
41  ALPHA_FULL = 2
42 };
43 
47 enum FLIP_FLAGS {
49  FLIP_NONE = 0,
51  FLIP_H = 1,
53  FLIP_V = 2,
55  FLIP_HV = FLIP_H | FLIP_V,
57  FLIP_VH = FLIP_H | FLIP_V
58 };
59 
66 const int32 kDefaultZoomX = 100;
67 const int32 kDefaultZoomY = 100;
68 const uint32 kDefaultRgbaMod = 0xFFFFFFFF;
69 const int32 kDefaultHotspotX = 0;
70 const int32 kDefaultHotspotY = 0;
71 const int32 kDefaultOffsetX = 0;
72 const int32 kDefaultOffsetY = 0;
73 const int32 kDefaultAngle = 0;
74 
76 private:
77  void init(Common::Point zoom, uint32 angle, Common::Point hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Common::Point offset);
78 
79 public:
80  TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0);
81  TransformStruct(float zoomX, float zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0);
82  TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false);
83  TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0);
84  TransformStruct(int32 numTimesX, int32 numTimesY);
86 
89  int32 _angle;
90  byte _flip;
91  bool _alphaDisable;
92  TSpriteBlendMode _blendMode;
93  uint32 _rgbaMod;
94  Common::Point _offset;
95  int32 _numTimesX;
96  int32 _numTimesY;
97 
98  bool getMirrorX() const;
99  bool getMirrorY() const;
100 
101  bool operator==(const TransformStruct &compare) const {
102  return (compare._angle == _angle &&
103  compare._flip == _flip &&
104  compare._zoom == _zoom &&
105  compare._offset == _offset &&
106  compare._alphaDisable == _alphaDisable &&
107  compare._rgbaMod == _rgbaMod &&
108  compare._blendMode == _blendMode &&
109  compare._numTimesX == _numTimesX &&
110  compare._numTimesY == _numTimesY
111  );
112  }
113 
114  bool operator!=(const TransformStruct &compare) const {
115  return !(compare == *this);
116  }
117 };
118 } // End of namespace Graphics
119 #endif
uint32 _rgbaMod
RGBa.
Definition: transform_struct.h:93
Common::Point _zoom
Zoom; 100 = no zoom.
Definition: transform_struct.h:87
int32 _angle
Rotation angle, in degrees.
Definition: transform_struct.h:89
byte _flip
Bitflag: see FLIP_XXX.
Definition: transform_struct.h:90
Definition: formatinfo.h:28
Definition: rect.h:45
Common::Point _hotspot
Position of the hotspot.
Definition: transform_struct.h:88
Definition: transform_struct.h:75