summaryrefslogtreecommitdiff
path: root/support/dktools/dk4bifa.h
blob: 60c73fabee2a58f1a4f43e4e376ad49947e16633 (plain)
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
94
95
96
97
/*
Copyright (C) 2017-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4bifa.ctr
*/

#ifndef DK4BIFA_H_INCLUDED
/** Avoid multiple inclusions. */
#define DK4BIFA_H_INCLUDED 1


#line 9 "dk4bifa.ctr"

/**	@file	dk4bifa.h	Bitmap image file analysis.
*/

#ifndef	DK4CONF_H_INCLUDED
#if	DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
#else
#include <dktools-4/dk4conf.h>
#endif
#endif

#ifndef	DK4ERROR_H_INCLUDED
#if	DK4_BUILDING_DKTOOLS4
#include "dk4error.h"
#else
#include <dktools-4/dk4error.h>
#endif
#endif

#ifndef	DK4BIFTY_H_INCLUDED
#if	DK4_BUILDING_DKTOOLS4
#include "dk4bifty.h"
#else
#include <dktools-4/dk4bifty.h>
#endif
#endif

#ifdef	__cplusplus
extern "C" {
#endif

/**	Analyze bitmap image file, apply the following tests:
	- If the image is RGB or CMYK, if R=G=B or C=M=Y for each pixel,
	  writing gray output is sufficient.
	- If the image contains an alpha channel and alpha data indicates
	  full opacity for all pixels, we can ignore the alpha channel.
	- If we can reduce the number of bits per component (bits per sample)
	  for all samples of all pixels without quality loss, do so.
	
	@param	pcs	Address of color space variable (in/out).
	@param	pbd	Address of bit depth (in/out).
	@param	bif	Bitmap image file.
	@param	anb	Flag: Analyze bit depth.
	@param	anc	Flag: Analyze color usage.
	@param	ana	Flag: Analyze alpha channel usage.
	@param	erp	Error report, may be NULL.
	@return	1 on success, 0 on error.

	Error codes:
	- DK4_E_INVALID_ARGUMENTS<br>
	  if:
	  - bif is NULL,
	  - pcs is NULL while color or alpha analysis is requested, or
	  - pbd is NULL while bit depth analysis is requested.
	- DK4_E_SYNTAX<br>
	  if an error occured while retrieving a pixel.
*/

int
dk4bif_analyze(
	int							*pcs,
	dk4_px_bit_depth_t			*pbd,
	dk4_bif_t			const	*bif,
	int							 anb,
	int							 anc,
	int							 ana,
	dk4_er_t					*erp
);

#ifdef	__cplusplus
}
#endif

/* vim: set ai sw=4 ts=4 : */


#endif