ScummVM API documentation
design.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  * MIT License:
21  *
22  * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
23  *
24  * Permission is hereby granted, free of charge, to any person
25  * obtaining a copy of this software and associated documentation
26  * files (the "Software"), to deal in the Software without
27  * restriction, including without limitation the rights to use,
28  * copy, modify, merge, publish, distribute, sublicense, and/or sell
29  * copies of the Software, and to permit persons to whom the
30  * Software is furnished to do so, subject to the following
31  * conditions:
32  *
33  * The above copyright notice and this permission notice shall be
34  * included in all copies or substantial portions of the Software.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43  * OTHER DEALINGS IN THE SOFTWARE.
44  *
45  */
46 
47 #ifndef WAGE_DESIGN_H
48 #define WAGE_DESIGN_H
49 
50 #include "common/memstream.h"
51 #include "common/rect.h"
52 
53 #include "graphics/nine_patch.h"
54 #include "graphics/macgui/macwindowmanager.h"
55 
56 namespace Wage {
57 
58 using namespace Graphics::MacGUIConstants;
59 
60 class Design {
61 public:
63  ~Design();
64 
65  void setBounds(Common::Rect *bounds) {
66  _bounds = bounds;
67  }
68 
69  Common::Rect *getBounds() {
70  return _bounds;
71  }
72 
73  void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y);
74  bool isInBounds(int x, int y);
75  static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
76  static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
77  static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType);
78  static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType);
79  static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
80  static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
81 
82  bool isBoundsCalculation() { return _boundsCalculationMode; }
83  void adjustBounds(int16 x, int16 y);
84 
85 private:
86  byte *_data;
87  int _len;
88  Common::Rect *_bounds;
89  Graphics::ManagedSurface *_surface;
90  bool _boundsCalculationMode;
91  Graphics::ManagedSurface *_maskImage;
92 
93 private:
94  void render(Graphics::MacPatterns &patterns);
95  void drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
96  Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
97  void drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
98  Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
99  void drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
100  Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
101  void drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
102  Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
103  void drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in);
104 };
105 
106 } // End of namespace Wage
107 
108 #endif
Definition: managed_surface.h:51
Definition: macwindowmanager.h:45
Definition: rect.h:144
Definition: stream.h:745
Definition: design.h:60
Definition: debugger.h:28
Definition: stream.h:385