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

Last change on this file since 555 was 555, checked in by Sam Hocevar, 8 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: 1.5 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{
20  unsigned char *fdat;
21  int nc;
22public :
23  filter(int colors=256);
24  filter(palette *from, palette *to);     // creates a conversion filter from one palette to another
25  void set(int color_num, char change_to);
26  unsigned char get_mapping(int color_num) { return fdat[color_num]; }
27  void apply(image *im);
28  void max_threshold(int minv, char blank=0);
29  void min_threshold(int maxv, char blank=0);
30  void put_image(image *screen, image *im, short x, short y, char transparent=0);
31  void clear();
32  ~filter() { free(fdat); }
33} ;
34
35class color_filter
36{
37  unsigned char *color_table;
38public:
39  int size();
40  int write(bFILE *fp);
41  color_filter(spec_entry *e, bFILE *fp);
42  color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL);
43  unsigned char lookup_color(int r, int g, int b)
44   { return color_table[r*32*32+g*32+b]; }
45  unsigned char *table() { return color_table; }
46  int total_colors() { return 32; }
47  unsigned char *get_table() { return color_table; }
48  ~color_filter() { free(color_table); }
49} ;
50
51#endif
52
53
54
55
Note: See TracBrowser for help on using the repository browser.