iPXE
include
ipxe
pnm.h
Go to the documentation of this file.
1
#ifndef _IPXE_PNM_H
2
#define _IPXE_PNM_H
3
4
/** @file
5
*
6
* Portable anymap format (PNM)
7
*
8
*/
9
10
FILE_LICENCE
( GPL2_OR_LATER_OR_UBDL );
11
12
#include <
stdint.h
>
13
#include <
ipxe/image.h
>
14
15
/** PNM signature */
16
struct
pnm_signature
{
17
/** Magic byte ('P') */
18
char
magic
;
19
/** PNM type */
20
char
type
;
21
/** Whitespace */
22
char
space
;
23
}
__attribute__
(( packed ));
24
25
/** PNM magic byte */
26
#define PNM_MAGIC 'P'
27
28
/** PNM context */
29
struct
pnm_context
{
30
/** PNM type */
31
struct
pnm_type
*
type
;
32
/** Current byte offset */
33
size_t
offset
;
34
/** Maximum length of ASCII values */
35
size_t
ascii_len
;
36
/** Maximum pixel value */
37
unsigned
int
max
;
38
};
39
40
/** Default maximum length of ASCII values */
41
#define PNM_ASCII_LEN 16
42
43
/** PNM type */
44
struct
pnm_type
{
45
/** PNM type */
46
char
type
;
47
/** Number of scalar values per pixel */
48
uint8_t
depth
;
49
/** Number of pixels per composite value */
50
uint8_t
packing
;
51
/** Flags */
52
uint8_t
flags
;
53
/** Extract scalar value
54
*
55
* @v image PNM image
56
* @v pnm PNM context
57
* @ret value Value, or negative error
58
*/
59
int ( *
scalar
) (
struct
image
*
image
,
struct
pnm_context
*pnm );
60
/** Convert composite value to 24-bit RGB
61
*
62
* @v composite Composite value
63
* @v index Pixel index within this composite value
64
* @ret rgb 24-bit RGB value
65
*/
66
uint32_t
( *
rgb
) (
uint32_t
composite,
unsigned
int
index
);
67
};
68
69
/** PNM flags */
70
enum
pnm_flags
{
71
/** Bitmap format
72
*
73
* If set, this flag indicates that:
74
*
75
* - the maximum scalar value is predefined as being equal to
76
* (2^packing-1), and is not present within the file, and
77
*
78
* - the maximum length of ASCII values is 1.
79
*/
80
PNM_BITMAP
= 0x01,
81
};
82
83
extern
struct
image_type
pnm_image_type
__image_type
(
PROBE_NORMAL
);
84
85
#endif
/* _IPXE_PNM_H */
__attribute__
#define __attribute__(x)
Definition:
compiler.h:10
pnm_signature::space
char space
Whitespace.
Definition:
pnm.h:22
pnm_type::scalar
int(* scalar)(struct image *image, struct pnm_context *pnm)
Extract scalar value.
Definition:
pnm.h:59
pnm_type::flags
uint8_t flags
Flags.
Definition:
pnm.h:52
__image_type
struct image_type pnm_image_type __image_type(PROBE_NORMAL)
image_type
An executable image type.
Definition:
image.h:94
index
long index
Definition:
bigint.h:62
PROBE_NORMAL
#define PROBE_NORMAL
Normal image probe priority.
Definition:
image.h:155
pnm_signature::type
char type
PNM type.
Definition:
pnm.h:20
image
An executable image.
Definition:
image.h:23
pnm_context::max
unsigned int max
Maximum pixel value.
Definition:
pnm.h:37
FILE_LICENCE
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
pnm_flags
pnm_flags
PNM flags.
Definition:
pnm.h:70
image.h
Executable images.
pnm_context::ascii_len
size_t ascii_len
Maximum length of ASCII values.
Definition:
pnm.h:35
pnm_type::packing
uint8_t packing
Number of pixels per composite value.
Definition:
pnm.h:50
uint8_t
unsigned char uint8_t
Definition:
stdint.h:10
pnm_type
PNM type.
Definition:
pnm.h:44
uint32_t
unsigned int uint32_t
Definition:
stdint.h:12
pnm_context::type
struct pnm_type * type
PNM type.
Definition:
pnm.h:31
pnm_signature
PNM signature.
Definition:
pnm.h:16
pnm_type::type
char type
PNM type.
Definition:
pnm.h:46
pnm_signature::magic
char magic
Magic byte ('P')
Definition:
pnm.h:18
PNM_BITMAP
Bitmap format.
Definition:
pnm.h:80
stdint.h
pnm_type::depth
uint8_t depth
Number of scalar values per pixel.
Definition:
pnm.h:48
pnm_context::offset
size_t offset
Current byte offset.
Definition:
pnm.h:33
pnm_type::rgb
uint32_t(* rgb)(uint32_t composite, unsigned int index)
Convert composite value to 24-bit RGB.
Definition:
pnm.h:66
pnm_context
PNM context.
Definition:
pnm.h:29
Generated by
1.8.15