source: abuse/branches/lol/src/imlib/palette.h @ 724

Last change on this file since 724 was 724, checked in by Sam Hocevar, 9 years ago

build: merge all static libraries into a single one.

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2013 Sam Hocevar <sam@hocevar.net>
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, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef _PALETTE_H_
12#define _PALETTE_H_
13
14#include "imlib/specs.h"
15
16class Palette
17{
18public:
19    Palette(int number_colors=256);
20    Palette(SpecEntry *e, bFILE *fp);
21    Palette(bFILE *fp);
22
23    /* FIXME: this should actually be "Active()" or "SetActive()" */
24    void Load();
25    static Palette *LastLoaded();
26
27    Palette *Copy() const;
28
29    int Count() const { return m_colors.Count(); }
30    u8vec3 *Data() { return m_colors.Data(); }
31    u8vec3 const *Data() const { return m_colors.Data(); }
32
33    u8vec3 GetColor(int x) const;
34    uint8_t GetGray(int x) const;
35    void SetColor(int x, u8vec3 color);
36
37    int FindColor(u8vec3 color) const;
38    int FindClosest(u8vec3 color) const;
39    int FindBrightest(int all = 0) const;
40    int FindDarkest(int all = 0, int noblack = 1) const;
41
42    void FadeTo(int total_fades, int fade_on, u8vec3 dest);
43
44private:
45    Array<u8vec3> m_colors;
46    Array<uint8_t> m_used;
47    int bg;
48
49public :
50    uint32_t getquad(int x);
51    void shift(int amount);
52
53    void defaults();
54    void set_rgbs();
55    void make_black_white();
56    void black_white();
57
58    int used(int color_num);
59    void set_all_used();
60    void set_all_unused();
61    int write(bFILE *fp);
62    int size();
63};
64
65#endif
66
Note: See TracBrowser for help on using the repository browser.