File: filter.hpp

package info (click to toggle)
abuse 2.00-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 12,708 kB
  • ctags: 15,389
  • sloc: ansic: 115,852; cpp: 6,792; lisp: 2,066; sh: 1,734; makefile: 1,601; asm: 264
file content (45 lines) | stat: -rw-r--r-- 1,181 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _FILTER_HPP
#define _FILTER_HPP
#include "image.hpp"
#include "palette.hpp"
#include "specs.hpp"
#include "jmalloc.hpp"

class filter
{
  unsigned char *fdat;
  int nc;
public :
  filter(int colors=256);
  filter(palette *from, palette *to);     // creates a conversion filter from one palette to another
  void set(int color_num, char change_to);
  unsigned char get_mapping(int color_num) { return fdat[color_num]; }
  void apply(image *im);
  void max_threshold(int minv, char blank=0);
  void min_threshold(int maxv, char blank=0);
  void put_image(image *screen, image *im, short x, short y, char transparent=0);
  void clear();
  ~filter() { jfree(fdat); }
} ;

class color_filter
{
  unsigned char *color_table;
public:
  int size();
  int write(bFILE *fp);
  color_filter(spec_entry *e, bFILE *fp);
  color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL);
  unsigned char lookup_color(int r, int g, int b) 
   { return color_table[r*32*32+g*32+b]; }
  unsigned char *table() { return color_table; }
  int total_colors() { return 32; }
  unsigned char *get_table() { return color_table; }
  ~color_filter() { jfree(color_table); }
} ;

#endif