|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| static int | pnm_ascii (struct image *image, struct pnm_context *pnm) |
| | Extract PNM ASCII value. More...
|
| |
| static int | pnm_binary (struct image *image, struct pnm_context *pnm) |
| | Extract PNM binary value. More...
|
| |
| static int | pnm_scale (struct image *image, struct pnm_context *pnm, unsigned int value) |
| | Scale PNM scalar value. More...
|
| |
| static uint32_t | pnm_bitmap (uint32_t composite, unsigned int index) |
| | Convert PNM bitmap composite value to RGB. More...
|
| |
| static uint32_t | pnm_greymap (uint32_t composite, unsigned int index __unused) |
| | Convert PNM greymap composite value to RGB. More...
|
| |
| static uint32_t | pnm_pixmap (uint32_t composite, unsigned int index __unused) |
| | Convert PNM pixmap composite value to RGB. More...
|
| |
| static int | pnm_data (struct image *image, struct pnm_context *pnm, struct pixel_buffer *pixbuf) |
| | Extract PNM pixel data. More...
|
| |
| static struct pnm_type * | pnm_type (struct image *image) |
| | Determine PNM image type. More...
|
| |
| static int | pnm_pixbuf (struct image *image, struct pixel_buffer **pixbuf) |
| | Convert PNM image to pixel buffer. More...
|
| |
| static int | pnm_probe (struct image *image) |
| | Probe PNM image. More...
|
| |
| struct image_type pnm_image_type | __image_type (PROBE_NORMAL) |
| | PNM image type. More...
|
| |
Portable anymap format (PNM)
Definition in file pnm.c.
Extract PNM ASCII value.
- Parameters
-
| image | PNM image |
| pnm | PNM context |
- Return values
-
| value | Value, or negative error |
Definition at line 47 of file pnm.c.
78 if (
len > (
sizeof ( buf ) - 1 ) )
79 len = (
sizeof ( buf ) - 1 );
85 pnm->
offset += ( endp - buf );
90 DBGC (
image,
"PNM %s invalid ASCII integer\n",
#define EINVAL
Invalid argument.
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
const void * data
Read-only data.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
pseudo_bit_t value[0x00020]
size_t ascii_len
Maximum length of ASCII values.
size_t len
Length of raw file image.
int isspace(int character)
Check to see if character is a space.
size_t offset
Current byte offset.
References pnm_context::ascii_len, ch, image::data, DBGC, EINVAL, isspace(), image::len, len, memcpy(), image::name, pnm_context::offset, strtoul(), and value.
Referenced by pnm_pixbuf().
Extract PNM pixel data.
- Parameters
-
| image | PNM image |
| pnm | PNM context |
| pixbuf | Pixel buffer |
- Return values
-
Definition at line 188 of file pnm.c.
191 unsigned int pixels = pixbuf->
pixels;
192 unsigned int index = 0;
193 unsigned int xpos = 0;
199 while (
index < pixels ) {
203 for ( i = 0 ; i <
type->depth ; i++ ) {
210 composite = ( ( composite << 8 ) |
scalar );
214 for ( i = 0 ; i <
type->packing ; i++ ) {
215 if (
index >= pixels ) {
216 DBGC (
image,
"PNM %s has too many pixels\n",
221 if ( ++xpos == pixbuf->
width ) {
#define EINVAL
Invalid argument.
int(* scalar)(struct image *image, struct pnm_context *pnm)
Extract scalar value.
uint32_t type
Operating system type.
unsigned int pixels
Total number of pixels.
uint32_t * data
32-bit (8:8:8:8) xRGB pixel data, in host-endian order
struct pnm_type * type
PNM type.
static int pnm_scale(struct image *image, struct pnm_context *pnm, unsigned int value)
Scale PNM scalar value.
References pixel_buffer::data, DBGC, EINVAL, index, image::name, pixel_buffer::pixels, pnm_scale(), pnm_type::scalar, type, pnm_context::type, and pixel_buffer::width.
Referenced by pnm_pixbuf().
Convert PNM image to pixel buffer.
- Parameters
-
| image | PNM image |
| pixbuf | Pixel buffer to fill in |
- Return values
-
Definition at line 311 of file pnm.c.
341 pnm.max = ( ( 1 << pnm.type->packing ) - 1 );
350 if ( pnm.max == 0 ) {
351 DBGC (
image,
"PNM %s has invalid maximum value 0\n",
356 DBGC (
image,
"PNM %s is type %c width %d height %d max %d\n",
357 image->
name, pnm.type->type, width, height, pnm.max );
363 goto err_alloc_pixbuf;
373 pixbuf_put ( *pixbuf );
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
struct pixel_buffer * alloc_pixbuf(unsigned int width, unsigned int height)
Allocate pixel buffer.
#define PNM_ASCII_LEN
Default maximum length of ASCII values.
static struct pnm_type * pnm_type(struct image *image)
Determine PNM image type.
#define ENOTSUP
Operation not supported.
#define ENOMEM
Not enough space.
static int pnm_ascii(struct image *image, struct pnm_context *pnm)
Extract PNM ASCII value.
static int pnm_data(struct image *image, struct pnm_context *pnm, struct pixel_buffer *pixbuf)
Extract PNM pixel data.
References alloc_pixbuf(), pnm_context::ascii_len, DBGC, EINVAL, ENOMEM, ENOTSUP, pnm_type::flags, pnm_context::max, max, image::name, pnm_context::offset, pnm_type::packing, pnm_ascii(), PNM_ASCII_LEN, PNM_BITMAP, pnm_data(), pnm_type(), rc, pnm_context::type, and pnm_type::type.