UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
src
utils
pam.h
Go to the documentation of this file.
1
10
/*
11
* Copyright (c) 2013-2023, CESNET z.s.p.o.
12
*
13
* All rights reserved.
14
*
15
* Redistribution and use in source and binary forms, with or without
16
* modification, are permitted provided that the following conditions are met:
17
*
18
* * Redistributions of source code must retain the above copyright
19
* notice, this list of conditions and the following disclaimer.
20
*
21
* * Redistributions in binary form must reproduce the above copyright
22
* notice, this list of conditions and the following disclaimer in the
23
* documentation and/or other materials provided with the distribution.
24
*
25
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*/
37
38
#ifndef PAM_H_7E23A609_963A_45A8_88E2_ED4D3FDFF69F
39
#define PAM_H_7E23A609_963A_45A8_88E2_ED4D3FDFF69F
40
41
#ifdef __cplusplus
42
#include <cstddef>
43
#else
44
#include <stdbool.h>
45
#include <stddef.h>
46
#endif
47
48
#ifdef __cplusplus
49
extern
"C"
{
50
#endif
51
52
struct
pam_metadata
{
53
int
width
;
54
int
height
;
55
int
depth
;
// == channel count
56
int
maxval
;
57
bool
bitmap_pbm
;
// bitmap data is stored in PBM format (1 bit per pixel, line aligned to whole byte, 1 is black /"ink on"/),
58
// otherwise 1 byte per pixel, 1 is white "light on"); if .depth != 1 || .maxval != 1, this value is undefined
59
};
60
61
bool
pam_read
(
const
char
*filename,
struct
pam_metadata
*info,
unsigned
char
**data,
void
*(*allocator)(
size_t
));
62
bool
pam_write
(
const
char
*filename,
unsigned
int
width,
unsigned
int
height,
int
depth
,
int
maxval,
const
unsigned
char
*data,
bool
pnm);
63
64
#ifdef __cplusplus
65
}
// extern "C"
66
#endif
67
68
#endif
// defined PAM_H_7E23A609_963A_45A8_88E2_ED4D3FDFF69F
pam_read
bool pam_read(const char *filename, struct pam_metadata *info, unsigned char **data, void *(*allocator)(size_t))
Definition
pam.c:141
pam_write
bool pam_write(const char *filename, unsigned int width, unsigned int height, int depth, int maxval, const unsigned char *data, bool pnm)
Definition
pam.c:204
pam_metadata
Definition
pam.h:52
pam_metadata::maxval
int maxval
Definition
pam.h:56
pam_metadata::depth
int depth
Definition
pam.h:55
pam_metadata::width
int width
Definition
pam.h:53
pam_metadata::height
int height
Definition
pam.h:54
pam_metadata::bitmap_pbm
bool bitmap_pbm
Definition
pam.h:57
depth
depth
Definition
types.h:125
Generated on Wed Sep 25 2024 14:27:19 for UltraGrid by
1.12.0