ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nut_renderer.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 #if !defined(SCUMM_NUT_RENDERER_H) && defined(ENABLE_SCUMM_7_8)
23 #define SCUMM_NUT_RENDERER_H
24 
25 #include "common/file.h"
26 #include "graphics/surface.h"
27 #include "scumm/charset_v7.h"
28 
29 namespace Scumm {
30 
31 class ScummEngine;
32 
33 class NutRenderer {
34 protected:
35 
36  enum {
37  kDefaultTransparentColor = 0,
38  kSmush44TransparentColor = 2
39  };
40 
41  ScummEngine *_vm;
42  int _numChars;
43  int _maxCharSize;
44  int _fontHeight;
45  int _spacing;
46  byte *_charBuffer;
47  byte *_decodedData;
48  byte *_paletteMap;
49  byte _bpp;
50  byte _palette[16];
51  const int _direction;
52 
53  const int8 *_2byteShadowXOffsetTable;
54  const int8 *_2byteShadowYOffsetTable;
55  uint8 *_2byteColorTable;
56  uint8 *_2byteMainColor;
57  const int _2byteSteps;
58 
59  struct {
60  uint16 width;
61  uint16 height;
62  byte *src;
63  byte transparency;
64  } _chars[256];
65 
66  void codec1(byte *dst, const byte *src, int width, int height, int pitch);
67  void codec21(byte *dst, const byte *src, int width, int height, int pitch);
68 
69  void loadFont(const char *filename);
70  byte *unpackChar(byte c);
71 
72 public:
73  NutRenderer(ScummEngine *vm, const char *filename);
74  virtual ~NutRenderer();
75  int getNumChars() const { return _numChars; }
76 
77  void drawFrame(byte *dst, int c, int x, int y);
78  int draw2byte(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, uint16 chr);
79  int drawCharV7(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags, byte chr, bool hardcodedColors = false, bool smushColorMode = false);
80 
81  int getCharWidth(byte c) const;
82  int getCharHeight(byte c) const;
83 
84  int getFontHeight() const { return _fontHeight; }
85 };
86 
87 } // End of namespace Scumm
88 
89 #endif
Definition: rect.h:144
Definition: actor.h:30