source: abuse/trunk/src/imlib/timage.h @ 531

Last change on this file since 531 was 531, checked in by Sam Hocevar, 11 years ago

imlib: simplify trans_image::make_image and rewrite the constructor.

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11#ifndef __TIMAGE_HPP_
12#define __TIMAGE_HPP_
13
14#include "image.h"
15#include "palette.h"
16#include "filter.h"
17
18/* data is stored in the following format
19
20  skip amount, data size, data  // no scan line wraps allowed
21
22*/
23
24
25class trans_image       // transpernet image
26{
27public:
28  trans_image(image *im, char const *name);
29  ~trans_image();
30
31  inline vec2i Size() { return m_size; }
32  inline uint8_t *Data() { return m_data; }
33
34  image *ToImage();
35
36  void PutImage(image *screen, int x, int y); // always transparent
37  void PutRemap(image *screen, int x, int y, uint8_t *remap);
38  void PutDoubleRemap(image *screen, int x, int y,
39                      uint8_t *remap, uint8_t *remap2);
40  void PutFade(image *screen, int x, int y, int amount, int total_frames,
41               color_filter *f, palette *pal);
42  void PutFadeTint(image *screen, int x, int y, int amount, int total_frames,
43                   uint8_t *tint, color_filter *f, palette *pal);
44  void PutColor(image *screen, int x, int y, uint8_t color);
45  void PutFilled(image *screen, int x, int y, uint8_t color);
46  void PutPredator(image *screen, int x, int y);
47  void PutBlend(image *screen, int x, int y, image *blend, int bx, int by,
48                int blend_amount, color_filter *f, palette *pal);
49
50  void put_scan_line(image *screen, int x, int y, int line);   // always transparent
51  size_t MemUsage();
52
53private:
54  uint8_t *ClipToLine(image *screen, int x1, int y1, int x2, int y2,
55                      int x, int &y, int &ysteps);
56
57  enum PutMode { NORMAL, REMAP, DOUBLE_REMAP, FADE, FADE_TINT, COLOR,
58                 FILLED, PREDATOR, BLEND };
59  template<int N>
60  void PutImageGeneric(image *dest, int x, int y, uint8_t color,
61                       image *blend, int bx, int by,
62                       uint8_t *map1, uint8_t *map2, int amount,
63                       int total_frames, uint8_t *tint,
64                       color_filter *f, palette *pal);
65
66  vec2i m_size;
67  uint8_t *m_data;
68};
69
70#endif
71
Note: See TracBrowser for help on using the repository browser.