ScummVM API documentation
graphics.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  * Additional copyright for this file:
8  * Copyright (C) 1995 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19 
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef BURIED_GRAPHICS_H
26 #define BURIED_GRAPHICS_H
27 
28 #include "common/rect.h"
29 #include "common/scummsys.h"
30 
31 namespace Common {
32 class SeekableReadStream;
33 }
34 
35 namespace Graphics {
36 class Font;
37 struct Surface;
38 }
39 
40 namespace Buried {
41 
42 class BuriedEngine;
43 
44 enum Cursor {
45  kCursorNone = 0,
46 
47  // Windows cursors
48  kCursorArrow = 32512,
49  kCursorWait = 32514,
50 
51  // Buried in Time Cursors
52  kCursorEmptyArrow = 100,
53  kCursorFinger = 101,
54  kCursorMagnifyingGlass = 102,
55  kCursorOpenHand = 103,
56  kCursorClosedHand = 104,
57  kCursorPutDown = 105,
58  kCursorNextPage = 106,
59  kCursorPrevPage = 107,
60  kCursorMoveUp = 108,
61  kCursorMoveDown = 109,
62  kCursorLocateA = 110,
63  kCursorLocateB = 111,
64  kCursorArrowUp = 112,
65  kCursorArrowLeft = 113,
66  kCursorArrowDown = 114,
67  kCursorArrowRight = 115
68 };
69 
70 enum TextAlign {
74 };
75 
77 public:
79  ~GraphicsManager();
80 
81  byte *getDefaultPalette() const { return _palette; }
82  Graphics::Font *createFont(int size, bool bold = false) const;
83  Cursor setCursor(Cursor newCursor);
84  void toggleCursor(bool show);
85  Graphics::Surface *getBitmap(uint32 bitmapID);
86  Graphics::Surface *getBitmap(const Common::Path &fileName, bool required = true);
87  uint32 getColor(byte r, byte g, byte b);
88 
89  void invalidateRect(const Common::Rect &rect, bool erase = true);
90  const Common::Rect &getDirtyRect() const { return _dirtyRect; }
91 
92  void markMouseMoved() { _mouseMoved = true; }
93  void updateScreen(bool drawWindows = true);
94  Graphics::Surface *getScreen() const { return _screen; }
95  bool needsErase() const { return _needsErase; }
96 
97  void blit(const Graphics::Surface *surface, int x, int y);
98  void blit(const Graphics::Surface *surface, int x, int y, uint width, uint height);
99  void blit(const Graphics::Surface *surface, const Common::Rect &srcRect, const Common::Rect &dstRect);
100  void fillRect(const Common::Rect &rect, uint32 color);
101  void keyBlit(Graphics::Surface *dst, int xDst, int yDst, int w, int h, const Graphics::Surface *src, uint xSrc, uint ySrc, uint32 transColor);
102  void keyBlit(Graphics::Surface *dst, int xDst, int yDst, int w, int h, const Graphics::Surface *src, uint xSrc, uint ySrc, byte rTrans, byte gTrans, byte bTrans);
103  void opaqueTransparentBlit(Graphics::Surface *dst, int xDst, int yDst, int w, int h, const Graphics::Surface *src, uint xSrc, uint ySrc, int opacityValue, byte r, byte g, byte b);
104  bool checkPointAgainstMaskedBitmap(const Graphics::Surface *bitmap, int x, int y, const Common::Point &point, byte rTrans, byte gTrans, byte bTrans);
105  void crossBlit(Graphics::Surface *dst, int xDst, int yDst, uint w, uint h, const Graphics::Surface *src, uint xSrc, uint ySrc);
106  void renderText(Graphics::Surface *dst, Graphics::Font *font, const Common::String &text, int x, int y, int w, int h, uint32 color, int lineHeight, TextAlign textAlign = kTextAlignLeft, bool centerVertically = false);
107  void renderText(Graphics::Surface *dst, Graphics::Font *font, const Common::U32String &text, int x, int y, int w, int h, uint32 color, int lineHeight, TextAlign textAlign = kTextAlignLeft, bool centerVertically = false);
108  void drawEllipse(const Common::Rect &rect, uint32 color);
109 
110  Graphics::Surface *remapPalettedFrame(const Graphics::Surface *frame, const byte *palette);
111 
112  int computeHPushOffset(int speed);
113  int computeVPushOffset(int speed);
114 
115 private:
116  BuriedEngine *_vm;
117  Cursor _curCursor;
118 
119  Common::Rect _dirtyRect;
120  bool _mouseMoved;
121  Graphics::Surface *_screen;
122  byte *_palette;
123  bool _needsErase;
124 
125  byte *createDefaultPalette() const;
126  Graphics::Surface *getBitmap(Common::SeekableReadStream *stream);
127 
128  Graphics::Font *createArialFont(int size, bool bold) const;
129 
130  Graphics::Font *createMSGothicFont(int size, bool bold) const;
131 };
132 
138 public:
139  TempCursorChange(Cursor cursor);
140  ~TempCursorChange();
141 
142 private:
143  Cursor _prevCursor;
144 };
145 
146 } // End of namespace Buried
147 
148 #endif
Center the text.
Definition: font.h:52
Definition: str.h:59
Definition: graphics.h:76
Definition: font.h:83
TextAlign
Definition: font.h:48
Definition: surface.h:67
Definition: graphics.h:137
Align the text to the left.
Definition: font.h:51
Definition: rect.h:144
Definition: path.h:52
bool crossBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt)
Definition: stream.h:745
Definition: buried.h:67
Definition: agent_evaluation.h:31
Definition: ustr.h:57
Definition: atari-cursor.h:38
Align the text to the right.
Definition: font.h:54
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: rect.h:45
bool keyBlit(byte *dst, const byte *src, const uint dstPitch, const uint srcPitch, const uint w, const uint h, const uint bytesPerPixel, const uint32 key)