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

Last change on this file since 521 was 494, checked in by Sam Hocevar, 12 years ago

style: remove trailing spaces, fix copyright statements.

  • Property svn:keywords set to Id
File size: 1.4 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]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 or
8 *  Jonathan Clark.
9 */
10
[2]11#ifndef _FILTER_HPP
12#define _FILTER_HPP
[129]13
[481]14#include "image.h"
15#include "palette.h"
16#include "specs.h"
[2]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();
[129]32  ~filter() { free(fdat); }
[2]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);
[124]43  unsigned char lookup_color(int r, int g, int b)
[2]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; }
[129]48  ~color_filter() { free(color_table); }
[2]49} ;
50
51#endif
52
53
54
55
Note: See TracBrowser for help on using the repository browser.