source: abuse/trunk/src/imlib/filter.h @ 682

Last change on this file since 682 was 682, checked in by Sam Hocevar, 8 years ago

core: rename vec2i to ivec2 and update matrix.h from Lol Engine.

  • 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-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, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef _FILTER_HPP
12#define _FILTER_HPP
13
14#include "image.h"
15#include "palette.h"
16#include "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(image *im);
28    void PutImage(image *screen, image *im, ivec2 pos);
29
30private:
31    int m_size;
32    uint8_t *m_table;
33};
34
35class ColorFilter
36{
37public:
38    ColorFilter(spec_entry *e, bFILE *fp);
39    ColorFilter(palette *pal, int color_bits);
40    ~ColorFilter();
41
42    size_t DiskUsage();
43    int Write(bFILE *fp);
44    int Lookup(int r, int g, int b)
45    {
46        return m_table[(r * m_size + g) * m_size + b];
47    }
48
49private:
50    int m_size;
51    uint8_t *m_table;
52};
53
54#endif
55
Note: See TracBrowser for help on using the repository browser.