source: abuse/branches/lol/src/imlib/filter.h @ 724

Last change on this file since 724 was 724, checked in by Sam Hocevar, 9 years ago

build: merge all static libraries into a single one.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2013 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, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef _FILTER_HPP
12#define _FILTER_HPP
13
14#include "imlib/image.h"
15#include "imlib/palette.h"
16#include "imlib/specs.h"
17
18class Filter
19{
20public :
21    Filter(int colors = 256);
22    Filter(Palette *from, Palette *to);
23    ~Filter();
24
25    void Set(int color_num, int change_to);
26    int GetMapping(int color_num) { return m_table[color_num]; }
27    void Apply(AImage *im);
28    void PutImage(AImage *screen, AImage *im, ivec2 pos);
29
30private:
31    Array<uint8_t> m_table;
32};
33
34class ColorFilter
35{
36public:
37    ColorFilter(SpecEntry *e, bFILE *fp);
38    ColorFilter(Palette *pal, int color_bits);
39    ~ColorFilter();
40
41    size_t DiskUsage();
42    int Write(bFILE *fp);
43    int Lookup(u8vec3 c)
44    {
45        return m_table[(c.r * m_size + c.g) * m_size + c.b];
46    }
47
48private:
49    Array<uint8_t> m_table;
50    int m_size;
51};
52
53#endif
54
Note: See TracBrowser for help on using the repository browser.