ScummVM API documentation
gfx_context.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  * Copyright 2020 Google
21  *
22  */
23 #ifndef HADESCH_GFX_CONTEXT_H
24 #define HADESCH_GFX_CONTEXT_H
25 
26 #include "common/ptr.h"
27 #include "common/rect.h"
28 #include "graphics/managed_surface.h"
29 
30 namespace Hadesch {
31 class GfxContext {
32 public:
33  virtual void blitVideo(byte *sourcePixels, int sourcePitch, int sourceW, int sourceH,
34  byte *palette, Common::Point offset) = 0;
35  // Use only in pod_image.cpp because of palette format
36  virtual void blitPodImage(byte *sourcePixels, int sourcePitch, int sourceW, int sourceH,
37  byte *palette, size_t ncolours, Common::Point offset) = 0;
38  virtual void clear() = 0;
39  virtual void renderSubtitle(const Common::U32String &, Common::Point viewPoint) = 0;
40  virtual void fade(int val) = 0;
41  virtual void renderToScreen(Common::Point viewPoint) = 0;
42  virtual ~GfxContext() {}
43 };
44 
46 public:
47  void blitVideo(byte *sourcePixels, int sourcePitch, int sourceW, int sourceH,
48  byte *palette, Common::Point offset) override;
49  void blitPodImage(byte *sourcePixels, int sourcePitch, int sourceW, int sourceH,
50  byte *palette, size_t ncolours, Common::Point offset) override;
51  void clear() override;
52  void fade(int val) override;
53  void renderToScreen(Common::Point viewPoint) override;
54  void renderSubtitle(const Common::U32String &, Common::Point viewPoint) override;
55  byte findColor(byte r, byte g, byte b);
56 
57  GfxContext8Bit(int canvasW, int canvasH);
58  ~GfxContext8Bit() {}
59 
60 private:
62  byte _palette[256 * 4];
63  bool _paletteUsed[256];
64 };
65 
66 void blendVideo8To8(byte *targetPixels, int targetPitch, int targetW, int targetH,
67  byte *sourcePixels, int sourceW, int sourceH, Common::Point offset);
68 
69 }
70 
71 #endif
Definition: managed_surface.h:51
Definition: ambient.h:30
Definition: noncopyable.h:39
Definition: gfx_context.h:31
Definition: ustr.h:57
Definition: rect.h:45
Definition: gfx_context.h:45