summaryrefslogtreecommitdiff
path: root/support/dktools/dk4bifap.h
blob: c2afcb8b39dc8552c82c574f782791d5103eba96 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
Copyright (C) 2018-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: dk4bifap.ctr
*/

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


#line 7 "dk4bifap.ctr"


/**	@file	dk4bifap.h	Bitmap image file handling with application support.
*/

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

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

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


#ifdef	__cplusplus
extern "C" {
#endif

/**	Open bitmap image file by name.
	@param	fn		Input file name.
	@param	honly	Flag: Read image header only.
	@param	pcsctx	Color space conversion context, may be NULL.
	@param	app		Application structure for diagnostics, may be NULL.
	@return	Valid pointer to bitmap image file on success, NULL on error.
*/

dk4_bif_t *
dk4bif_open_app(
	dkChar				const	*fn,
	int							 honly,
	dk4_cs_conv_ctx_t	const	*pcsctx,
	dk4_app_t					*app
);


/**	Open bitmap image file by opened FILE.
	@param	fipo	File, opened for binary reading.
	@param	fn		File name containing the bitmap image.
					Provide a dummy file name here when processing stdin.
	@param	ty		Image file type (PNG, JPEG or TIFF).
	@param	honly	Flag: Read image header only.
	@param	pcsctx	Color space conversion context, may be NULL.
	@param	app		Application structure for diagnostics, may be NULL.
	@return	Valid pointer to bitmap image file on success, NULL on error.
*/

dk4_bif_t *
dk4bif_open_file_app(
	FILE						*fipo,
	dkChar				const	*fn,
	int							 ty,
	int							 honly,
	dk4_cs_conv_ctx_t	const	*pcsctx,
	dk4_app_t					*app
);


/**	Find bitmap image file type for file name based on suffix.
	@param	fn	File name to find type for.
	@param	app	Application structure for diagnostics, may be NULL.
*/

int
dk4bif_type_for_suffix_app(
	dkChar		const	*fn,
	dk4_app_t			*app
);


/**	Issue warning about aspect ratio change.
	@param	bif		Bitmap image file containing data about old resolution.
	@param	xres	New x resolution.
	@param	yres	New y resolution.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4bif_warn_aspect_ratio_change(
	dk4_bif_t		*bif,
	double			 xres,
	double			 yres,
	dk4_app_t		*app
);


/**	Set image resolution.
	@param	bif		Bitmap image file.
	@param	xres	New x resolution.
	@param	yres	New y resolution.
	@param	app		Application structure for diagnostics, may be NULL.
	@return	1 on success, 0 on error.
*/

int
dk4bif_set_res_app(
	dk4_bif_t			*bif,
	double				 xres,
	double				 yres,
	dk4_app_t			*app
);

#ifdef	__cplusplus
}
#endif

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

#endif