ScummVM API documentation
te_image.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 TETRAEDGE_TE_TE_IMAGE_H
23 #define TETRAEDGE_TE_TE_IMAGE_H
24 
25 #include "common/fs.h"
26 #include "common/ptr.h"
27 #include "common/stream.h"
28 #include "common/types.h"
29 #include "common/path.h"
30 
31 #include "graphics/managed_surface.h"
32 
33 #include "tetraedge/te/te_color.h"
34 #include "tetraedge/te/te_palette.h"
35 #include "tetraedge/te/te_vector2s32.h"
36 #include "tetraedge/te/te_resource.h"
37 
38 #include "tetraedge/tetraedge.h"
39 
40 namespace Tetraedge {
41 
43 public:
44  TeImage();
45  TeImage(const TeImage &other);
46 
47  virtual ~TeImage() {
48  destroy();
49  };
50 
51  enum SaveType {
52  PNG
53  };
54 
55  void copy(TeImage &dest, const TeVector2s32 &vec1, const TeVector2s32 &vec2,
56  const TeVector2s32 &vec3) const;
57  uint64 countPixelsOfColor(const TeColor &col) const;
58  // void create(); // never used?
59  void createImg(uint xsize, uint ysize, Common::SharedPtr<TePalette> &palette, const Graphics::PixelFormat &newformat) {
60  createImg(xsize, ysize, palette, newformat, xsize, ysize);
61  }
62  void createImg(uint xsize, uint ysize, Common::SharedPtr<TePalette> &pal,
63  const Graphics::PixelFormat &format, uint bufxsize, uint bufysize);
64  void deserialize(Common::ReadStream &stream);
65  void destroy();
66  void drawPlot(int x, int y, const TeColor &col) {
67  drawPlot(getPixels(), x, y, bufSize(), col);
68  }
69  void drawPlot(void *outbuf, int x, int y, const TeVector2s32 &bufsize, const TeColor &col);
70  void fill(byte val);
71  void fill(byte r, byte g, byte b, byte a);
72  void getBuff(uint x, uint y, byte *pout, uint w, uint h);
73  bool isExtensionSupported(const Common::Path &path);
74  bool load(const TetraedgeFSNode &node);
75  bool load(Common::SeekableReadStream &stream, const Common::String &type);
76  bool save(const Common::Path &path, enum SaveType type);
77  int serialize(Common::WriteStream &stream);
78  TeVector2s32 bufSize() const {
79  return TeVector2s32(pitch / format.bytesPerPixel, h);
80  }
81 };
82 
83 } // end namespace Tetraedge
84 
85 #endif // TETRAEDGE_TE_TE_IMAGE_H
Definition: managed_surface.h:51
Definition: te_image.h:42
Definition: str.h:59
int16 & w
Definition: managed_surface.h:131
Definition: detection.h:27
Definition: stream.h:77
Definition: pixelformat.h:138
int32 & pitch
Definition: managed_surface.h:133
Definition: te_resource.h:31
Definition: tetraedge.h:65
Definition: te_color.h:30
Definition: path.h:52
Definition: stream.h:745
int16 & h
Definition: managed_surface.h:132
void * getPixels()
Definition: managed_surface.h:268
Definition: te_vector2s32.h:31
Definition: stream.h:385
PixelFormat & format
Definition: managed_surface.h:134
Definition: ptr.h:159
byte bytesPerPixel
Definition: pixelformat.h:139