source: abuse/branches/pd/imlib/include/filter.hpp @ 597

Last change on this file since 597 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
File size: 1.2 KB
Line 
1#ifndef _FILTER_HPP
2#define _FILTER_HPP
3#include "image.hpp"
4#include "palette.hpp"
5#include "specs.hpp"
6#include "jmalloc.hpp"
7
8class filter
9{
10  unsigned char *fdat;
11  int nc;
12public :
13  filter(int colors=256);
14  filter(palette *from, palette *to);     // creates a conversion filter from one palette to another
15  void set(int color_num, char change_to);
16  unsigned char get_mapping(int color_num) { return fdat[color_num]; }
17  void apply(image *im);
18  void max_threshold(int minv, char blank=0);
19  void min_threshold(int maxv, char blank=0);
20  void put_image(image *screen, image *im, short x, short y, char transparent=0);
21  void clear();
22  ~filter() { jfree(fdat); }
23} ;
24
25class color_filter
26{
27  unsigned char *color_table;
28public:
29  int size();
30  int write(bFILE *fp);
31  color_filter(spec_entry *e, bFILE *fp);
32  color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL);
33  unsigned char lookup_color(int r, int g, int b)
34   { return color_table[r*32*32+g*32+b]; }
35  unsigned char *table() { return color_table; }
36  int total_colors() { return 32; }
37  unsigned char *get_table() { return color_table; }
38  ~color_filter() { jfree(color_table); }
39} ;
40
41#endif
42
43
44
45
Note: See TracBrowser for help on using the repository browser.