source: abuse/trunk/src/imlib/transimage.h @ 555

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

ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.

  • Property svn:keywords set to Id
File size: 2.3 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]5 *
6 *  This software was released into the Public Domain. As with most public
[555]7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
[56]9 */
10
[532]11#ifndef __TIMAGE_HPP__
12#define __TIMAGE_HPP__
[2]13
[481]14#include "image.h"
15#include "palette.h"
16#include "filter.h"
[2]17
[532]18/*  Data is stored in the following format:
19 *
20 *   uint8_t skip;       // transparent pixel count
21 *   uint8_t size;       // solid pixel count
22 *   uint8_t data[size]; // solid pixel values
23 *   ...
24 *   (no scan line wraps allowed, there can be a last skip value)
25 */
[2]26
[541]27class TransImage
[2]28{
[527]29public:
[541]30    TransImage(image *im, char const *name);
31    ~TransImage();
[124]32
[532]33    inline vec2i Size() { return m_size; }
34    inline uint8_t *Data() { return m_data; }
[527]35
[532]36    image *ToImage();
[531]37
[533]38    void PutImage(image *screen, vec2i pos);
39    void PutRemap(image *screen, vec2i pos, uint8_t *map);
40    void PutDoubleRemap(image *screen, vec2i pos, uint8_t *map, uint8_t *map2);
[541]41    void PutFade(image *screen, vec2i pos, int amount, int nframes,
[532]42                 color_filter *f, palette *pal);
[541]43    void PutFadeTint(image *screen, vec2i pos, int amount, int nframes,
[532]44                     uint8_t *tint, color_filter *f, palette *pal);
[533]45    void PutColor(image *screen, vec2i pos, uint8_t color);
46    void PutFilled(image *screen, vec2i pos, uint8_t color);
47    void PutPredator(image *screen, vec2i pos);
48    void PutBlend(image *screen, vec2i pos, image *blend, vec2i bpos,
[532]49                  int blend_amount, color_filter *f, palette *pal);
[533]50    void PutScanLine(image *screen, vec2i pos, int line);
[2]51
[541]52    size_t DiskUsage();
[520]53
54private:
[533]55    uint8_t *ClipToLine(image *screen, vec2i pos1, vec2i pos2,
56                        vec2i &posy, int &ysteps);
[2]57
[532]58    enum PutMode { NORMAL, REMAP, REMAP2, FADE, FADE_TINT, COLOR,
59                   FILLED, PREDATOR, BLEND, SCANLINE };
60    template<int N>
[533]61    void PutImageGeneric(image *dest, vec2i pos, uint8_t color,
62                         image *blend, vec2i bpos,
[532]63                         uint8_t *map1, uint8_t *map2, int amount,
[541]64                         int nframes, uint8_t *tint,
[532]65                         color_filter *f, palette *pal);
[528]66
[532]67    vec2i m_size;
68    uint8_t *m_data;
[527]69};
[2]70
71#endif
72
Note: See TracBrowser for help on using the repository browser.