Krita Source Code Documentation
Loading...
Searching...
No Matches
palette.h
Go to the documentation of this file.
1
/* Palette-manipulation functions functions for xcftools
2
*
3
* This file was written by Henning Makholm <henning@makholm.net>
4
* It is hereby in the public domain.
5
*
6
* In jurisdictions that do not recognise grants of copyright to the
7
* public domain: I, the author and (presumably, in those jurisdictions)
8
* copyright holder, hereby permit anyone to distribute and use this code,
9
* in source code or binary form, with or without modifications. This
10
* permission is world-wide and irrevocable.
11
*
12
* Of course, I will not be liable for any errors or shortcomings in the
13
* code, since I give it away without asking any compenstations.
14
*
15
* If you use or distribute this code, I would appreciate receiving
16
* credit for writing it, in whichever way you find proper and customary.
17
*/
18
19
#ifndef PALETTE_H
20
#define PALETTE_H
21
22
#include "
xcftools.h
"
23
#include "
pixels.h
"
24
25
#define MAX_PALETTE 256
26
extern
rgba
palette
[
MAX_PALETTE
] ;
27
extern
unsigned
paletteSize
;
28
29
typedef
uint8_t
index_t
;
30
31
void
init_palette_hash
(
void
);
32
33
/* lookup_or_intern() returns a negative number if there is no room
34
* for the color in the palette.
35
*/
36
int
lookup_or_intern
(
rgba
color);
37
38
/* palettify_row will convert a row of 'rgba' values into a packed row
39
* of 'uint8_t' indces. If it succeeds without running out of colormap
40
* entries, it returns nonzero. On the other hand if it does run out
41
* of colormap entries it returns zero _and_ undoes the conversions
42
* already done, so that the row is still a full row of 'rgba' values
43
* afterwards.
44
*/
45
int
palettify_row
(
rgba
*row,
unsigned
ncols);
46
47
/* palettify_rows is like palettify_rows, but works on several
48
* rows at a time.
49
*/
50
int
palettify_rows
(
rgba
*rows[],
unsigned
ncols,
unsigned
nlines);
51
52
#endif
/* PALETTE_H */
paletteSize
unsigned paletteSize
Definition
palette.c:34
init_palette_hash
void init_palette_hash(void)
Definition
palette.c:40
palettify_row
int palettify_row(rgba *row, unsigned ncols)
Definition
palette.c:80
lookup_or_intern
int lookup_or_intern(rgba color)
Definition
palette.c:51
MAX_PALETTE
#define MAX_PALETTE
Definition
palette.h:25
index_t
uint8_t index_t
Definition
palette.h:29
palette
rgba palette[MAX_PALETTE]
Definition
palette.c:35
palettify_rows
int palettify_rows(rgba *rows[], unsigned ncols, unsigned nlines)
Definition
palette.c:97
pixels.h
rgba
uint32_t rgba
Definition
pixels.h:44
xcftools.h
plugins
impex
xcf
3rdparty
xcftools
palette.h
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52