File: quantise.h

package info (click to toggle)
vips 8.16.1-2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 51,940 kB
  • sloc: ansic: 169,179; cpp: 11,890; python: 4,620; xml: 4,353; sh: 732; perl: 40; makefile: 19
file content (93 lines) | stat: -rw-r--r-- 3,120 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* common defs for image quantisation
 */

/*

	Copyright (C) 1991-2005 The National Gallery

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
	02110-1301  USA

 */

/*

	These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk

 */

#ifndef VIPS_QUANTISE_H
#define VIPS_QUANTISE_H

#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/

#if defined(HAVE_IMAGEQUANT)
#define HAVE_QUANTIZATION

#include <libimagequant.h>

#define VipsQuantiseAttr liq_attr
#define VipsQuantiseImage liq_image
#define VipsQuantiseResult liq_result
#define VipsQuantisePalette liq_palette
#define VipsQuantiseError liq_error

#elif defined(HAVE_QUANTIZR)
#define HAVE_QUANTIZATION

#include <quantizr.h>

#define VipsQuantiseAttr QuantizrOptions
#define VipsQuantiseImage QuantizrImage
#define VipsQuantiseResult QuantizrResult
#define VipsQuantisePalette QuantizrPalette
#define VipsQuantiseError QuantizrError
#endif

#ifdef HAVE_QUANTIZATION
VipsQuantiseAttr *vips__quantise_attr_create();
VipsQuantiseError vips__quantise_set_max_colors(VipsQuantiseAttr *attr,
	int colors);
VipsQuantiseError vips__quantise_set_quality(VipsQuantiseAttr *attr,
	int minimum, int maximum);
VipsQuantiseError vips__quantise_set_speed(VipsQuantiseAttr *attr, int speed);
VipsQuantiseImage *vips__quantise_image_create_rgba(const VipsQuantiseAttr *attr,
	const void *bitmap, int width, int height, double gamma);
VipsQuantiseError vips__quantise_image_quantize(VipsQuantiseImage *input_image,
	VipsQuantiseAttr *options, VipsQuantiseResult **result_output);
VipsQuantiseError vips__quantise_image_quantize_fixed(VipsQuantiseImage *input_image,
	VipsQuantiseAttr *options, VipsQuantiseResult **result_output);
VipsQuantiseError vips__quantise_set_dithering_level(VipsQuantiseResult *res,
	float dither_level);
const VipsQuantisePalette *vips__quantise_get_palette(VipsQuantiseResult *result);
VipsQuantiseError vips__quantise_write_remapped_image(VipsQuantiseResult *result,
	VipsQuantiseImage *input_image, void *buffer, size_t buffer_size);
void vips__quantise_result_destroy(VipsQuantiseResult *result);
void vips__quantise_image_destroy(VipsQuantiseImage *img);
void vips__quantise_attr_destroy(VipsQuantiseAttr *attr);
#endif /*HAVE_QUANTIZATION*/

int vips__quantise_image(VipsImage *in,
	VipsImage **index_out, VipsImage **palette_out,
	int colours, int Q, double dither, int effort,
	gboolean threshold_alpha);

#ifdef __cplusplus
}
#endif /*__cplusplus*/

#endif /*VIPS_QUANTISE_H*/