source: abuse/trunk/src/imlib/include/filter.hpp @ 56

Last change on this file since 56 was 56, checked in by Sam Hocevar, 15 years ago
  • Add licensing terms to most C / C++ files (Ref #5).
File size: 1.4 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#ifndef _FILTER_HPP
11#define _FILTER_HPP
12#include "image.hpp"
13#include "palette.hpp"
14#include "specs.hpp"
15#include "jmalloc.hpp"
16
17class filter
18{
19  unsigned char *fdat;
20  int nc;
21public :
22  filter(int colors=256);
23  filter(palette *from, palette *to);     // creates a conversion filter from one palette to another
24  void set(int color_num, char change_to);
25  unsigned char get_mapping(int color_num) { return fdat[color_num]; }
26  void apply(image *im);
27  void max_threshold(int minv, char blank=0);
28  void min_threshold(int maxv, char blank=0);
29  void put_image(image *screen, image *im, short x, short y, char transparent=0);
30  void clear();
31  ~filter() { jfree(fdat); }
32} ;
33
34class color_filter
35{
36  unsigned char *color_table;
37public:
38  int size();
39  int write(bFILE *fp);
40  color_filter(spec_entry *e, bFILE *fp);
41  color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL);
42  unsigned char lookup_color(int r, int g, int b)
43   { return color_table[r*32*32+g*32+b]; }
44  unsigned char *table() { return color_table; }
45  int total_colors() { return 32; }
46  unsigned char *get_table() { return color_table; }
47  ~color_filter() { jfree(color_table); }
48} ;
49
50#endif
51
52
53
54
Note: See TracBrowser for help on using the repository browser.