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

Last change on this file since 481 was 481, checked in by Sam Hocevar, 11 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

  • Property svn:keywords set to Id
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
13#include "image.h"
14#include "palette.h"
15#include "specs.h"
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() { free(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() { free(color_table); }
48} ;
49
50#endif
51
52
53
54
Note: See TracBrowser for help on using the repository browser.