iPXE
Data Structures | Defines | Enumerations | Functions
png.h File Reference

Portable Network Graphics (PNG) format. More...

#include <stdint.h>
#include <byteswap.h>
#include <ipxe/image.h>

Go to the source code of this file.

Data Structures

struct  png_signature
 A PNG file signature. More...
struct  png_chunk_header
 A PNG chunk header. More...
struct  png_chunk_footer
 A PNG chunk footer. More...
struct  png_image_header
 A PNG image header. More...
struct  png_palette_entry
 A PNG palette entry. More...
struct  png_palette
 A PNG palette chunk. More...

Defines

#define PNG_SIGNATURE   { { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' } }
 PNG file signature.
#define PNG_TYPE(first, second, third, fourth)   ( ( (first) << 24 ) | ( (second) << 16 ) | ( (third) << 8 ) | (fourth) )
 Define a canonical PNG chunk type.
#define PNG_TYPE_IHDR   PNG_TYPE ( 'I', 'H', 'D', 'R' )
 PNG image header chunk type.
#define PNG_COLOUR_TYPE_MASK   0x07
 PNG colour type mask.
#define PNG_TYPE_PLTE   PNG_TYPE ( 'P', 'L', 'T', 'E' )
 PNG palette chunk type.
#define PNG_PALETTE_COUNT   256
 Maximum number of PNG palette entries.
#define PNG_TYPE_IDAT   PNG_TYPE ( 'I', 'D', 'A', 'T' )
 PNG image data chunk type.
#define PNG_TYPE_IEND   PNG_TYPE ( 'I', 'E', 'N', 'D' )
 PNG image end chunk type.

Enumerations

enum  png_chunk_type_bits { PNG_CHUNK_ANCILLARY = 0x20000000UL, PNG_CHUNK_PRIVATE = 0x00200000UL, PNG_CHUNK_RESERVED = 0x00002000UL, PNG_CHUNK_SAFE = 0x00000020UL }
 PNG chunk type property bits. More...
enum  png_colour_type { PNG_COLOUR_TYPE_PALETTE = 0x01, PNG_COLOUR_TYPE_RGB = 0x02, PNG_COLOUR_TYPE_ALPHA = 0x04 }
 PNG colour type bits. More...
enum  png_compression_method { PNG_COMPRESSION_DEFLATE = 0x00, PNG_COMPRESSION_UNKNOWN = 0x01 }
 PNG compression methods. More...
enum  png_filter_method { PNG_FILTER_BASIC = 0x00, PNG_FILTER_UNKNOWN = 0x01 }
 PNG filter methods. More...
enum  png_interlace_method { PNG_INTERLACE_NONE = 0x00, PNG_INTERLACE_ADAM7 = 0x01, PNG_INTERLACE_UNKNOWN = 0x02 }
 PNG interlace methods. More...
enum  png_basic_filter_type {
  PNG_FILTER_BASIC_NONE = 0, PNG_FILTER_BASIC_SUB = 1, PNG_FILTER_BASIC_UP = 2, PNG_FILTER_BASIC_AVERAGE = 3,
  PNG_FILTER_BASIC_PAETH = 4
}
 PNG basic filter types. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static uint32_t png_canonical_type (uint32_t type)
 Canonicalise PNG chunk type.
struct image_type png_image_type __image_type (PROBE_NORMAL)

Detailed Description

Portable Network Graphics (PNG) format.

Definition in file png.h.


Define Documentation

#define PNG_SIGNATURE   { { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' } }

PNG file signature.

Definition at line 23 of file png.h.

#define PNG_TYPE (   first,
  second,
  third,
  fourth 
)    ( ( (first) << 24 ) | ( (second) << 16 ) | ( (third) << 8 ) | (fourth) )

Define a canonical PNG chunk type.

Parameters:
firstFirst letter (in upper case)
secondSecond letter (in upper case)
thirdThird letter (in upper case)
fourthFourth letter (in upper case)
Return values:
typeCanonical chunk type

Definition at line 72 of file png.h.

#define PNG_TYPE_IHDR   PNG_TYPE ( 'I', 'H', 'D', 'R' )

PNG image header chunk type.

Definition at line 76 of file png.h.

#define PNG_COLOUR_TYPE_MASK   0x07

PNG colour type mask.

Definition at line 107 of file png.h.

#define PNG_TYPE_PLTE   PNG_TYPE ( 'P', 'L', 'T', 'E' )

PNG palette chunk type.

Definition at line 136 of file png.h.

#define PNG_PALETTE_COUNT   256

Maximum number of PNG palette entries.

Definition at line 155 of file png.h.

#define PNG_TYPE_IDAT   PNG_TYPE ( 'I', 'D', 'A', 'T' )

PNG image data chunk type.

Definition at line 158 of file png.h.

#define PNG_TYPE_IEND   PNG_TYPE ( 'I', 'E', 'N', 'D' )

PNG image end chunk type.

Definition at line 175 of file png.h.

Referenced by png_pixbuf().


Enumeration Type Documentation

PNG chunk type property bits.

Enumerator:
PNG_CHUNK_ANCILLARY 

Chunk is ancillary.

PNG_CHUNK_PRIVATE 

Chunk is private.

PNG_CHUNK_RESERVED 

Reserved.

PNG_CHUNK_SAFE 

Chunk is safe to copy.

Definition at line 40 of file png.h.

                         {
        /** Chunk is ancillary */
        PNG_CHUNK_ANCILLARY = 0x20000000UL,
        /** Chunk is private */
        PNG_CHUNK_PRIVATE = 0x00200000UL,
        /** Reserved */
        PNG_CHUNK_RESERVED = 0x00002000UL,
        /** Chunk is safe to copy */
        PNG_CHUNK_SAFE = 0x00000020UL,
};

PNG colour type bits.

Enumerator:
PNG_COLOUR_TYPE_PALETTE 

Palette is used.

PNG_COLOUR_TYPE_RGB 

RGB colour is used.

PNG_COLOUR_TYPE_ALPHA 

Alpha channel is used.

Definition at line 97 of file png.h.

                     {
        /** Palette is used */
        PNG_COLOUR_TYPE_PALETTE = 0x01,
        /** RGB colour is used */
        PNG_COLOUR_TYPE_RGB = 0x02,
        /** Alpha channel is used */
        PNG_COLOUR_TYPE_ALPHA = 0x04,
};

PNG compression methods.

Enumerator:
PNG_COMPRESSION_DEFLATE 

DEFLATE compression with 32kB sliding window.

PNG_COMPRESSION_UNKNOWN 

First unknown compression method.

Definition at line 110 of file png.h.

                            {
        /** DEFLATE compression with 32kB sliding window */
        PNG_COMPRESSION_DEFLATE = 0x00,
        /** First unknown compression method */
        PNG_COMPRESSION_UNKNOWN = 0x01,
};

PNG filter methods.

Enumerator:
PNG_FILTER_BASIC 

Adaptive filtering with five basic types.

PNG_FILTER_UNKNOWN 

First unknown filter method.

Definition at line 118 of file png.h.

                       {
        /** Adaptive filtering with five basic types */
        PNG_FILTER_BASIC = 0x00,
        /** First unknown filter method */
        PNG_FILTER_UNKNOWN = 0x01,
};

PNG interlace methods.

Enumerator:
PNG_INTERLACE_NONE 

No interlacing.

PNG_INTERLACE_ADAM7 

Adam7 interlacing.

PNG_INTERLACE_UNKNOWN 

First unknown interlace method.

Definition at line 126 of file png.h.

                          {
        /** No interlacing */
        PNG_INTERLACE_NONE = 0x00,
        /** Adam7 interlacing */
        PNG_INTERLACE_ADAM7 = 0x01,
        /** First unknown interlace method */
        PNG_INTERLACE_UNKNOWN = 0x02,
};

PNG basic filter types.

Enumerator:
PNG_FILTER_BASIC_NONE 

No filtering.

PNG_FILTER_BASIC_SUB 

Left byte used as predictor.

PNG_FILTER_BASIC_UP 

Above byte used as predictor.

PNG_FILTER_BASIC_AVERAGE 

Above and left bytes used as predictors.

PNG_FILTER_BASIC_PAETH 

Paeth filter.

Definition at line 161 of file png.h.

                           {
        /** No filtering */
        PNG_FILTER_BASIC_NONE = 0,
        /** Left byte used as predictor */
        PNG_FILTER_BASIC_SUB = 1,
        /** Above byte used as predictor */
        PNG_FILTER_BASIC_UP = 2,
        /** Above and left bytes used as predictors */
        PNG_FILTER_BASIC_AVERAGE = 3,
        /** Paeth filter */
        PNG_FILTER_BASIC_PAETH = 4,
};

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static uint32_t png_canonical_type ( uint32_t  type) [inline, static]

Canonicalise PNG chunk type.

Parameters:
typeRaw chunk type
Return values:
typeCanonicalised chunk type (excluding property bits)

Definition at line 58 of file png.h.

References htonl, PNG_CHUNK_ANCILLARY, PNG_CHUNK_PRIVATE, PNG_CHUNK_RESERVED, and PNG_CHUNK_SAFE.

struct image_type png_image_type __image_type ( PROBE_NORMAL  ) [read]