📄 libmng_chunks.h
字号:
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_chunks.h copyright (c) 2000-2004 G.Juyn * */
/* * version : 1.0.7 * */
/* * * */
/* * purpose : Chunk structures (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of known chunk structures * */
/* * * */
/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */
/* * - put in some extra comments * */
/* * 0.5.1 - 05/06/2000 - G.Juyn * */
/* * - fixed layout for sBIT, PPLT * */
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed write callback definition * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - fixed layout for PPLT again (missed deltatype ?!?) * */
/* * * */
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
/* * - removed useless definition (contributed by Tim Rowley) * */
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
/* * - fixed makeup for Linux gcc compile * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 11/28/2002 - G.Juyn * */
/* * - fixed definition of iMethodX/Y for MAGN chunk * */
/* * * */
/* * 1.0.6 - 05/25/2003 - G.R-P * */
/* * added MNG_SKIPCHUNK_cHNK footprint optimizations * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * * */
/* * 1.0.7 - 03/24/2004 - G.R-P * */
/* * - added conditional around MNG_NO_DELTA_PNG support * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_chunks_h_
#define _libmng_chunks_h_
/* ************************************************************************** */
#ifdef MNG_SWAP_ENDIAN
#define PNG_SIG 0x474e5089L
#define JNG_SIG 0x474e4a8bL
#define MNG_SIG 0x474e4d8aL
#define POST_SIG 0x0a1a0a0dL
#else
#define PNG_SIG 0x89504e47L
#define JNG_SIG 0x8b4a4e47L
#define MNG_SIG 0x8a4d4e47L
#define POST_SIG 0x0d0a1a0aL
#endif
/* ************************************************************************** */
typedef mng_retcode (*mng_createchunk) (mng_datap pData,
mng_chunkp pHeader,
mng_chunkp* ppChunk);
typedef mng_retcode (*mng_cleanupchunk) (mng_datap pData,
mng_chunkp pHeader);
typedef mng_retcode (*mng_readchunk) (mng_datap pData,
mng_chunkp pHeader,
mng_uint32 iRawlen,
mng_uint8p pRawdata,
mng_chunkp* pChunk);
typedef mng_retcode (*mng_writechunk) (mng_datap pData,
mng_chunkp pChunk);
typedef mng_retcode (*mng_assignchunk) (mng_datap pData,
mng_chunkp pChunkto,
mng_chunkp pChunkfrom);
/* ************************************************************************** */
typedef struct { /* generic header */
mng_chunkid iChunkname;
mng_createchunk fCreate;
mng_cleanupchunk fCleanup;
mng_readchunk fRead;
mng_writechunk fWrite;
mng_assignchunk fAssign;
mng_chunkp pNext; /* for double-linked list */
mng_chunkp pPrev;
} mng_chunk_header;
typedef mng_chunk_header * mng_chunk_headerp;
/* ************************************************************************** */
typedef struct { /* IHDR */
mng_chunk_header sHeader;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_uint8 iBitdepth;
mng_uint8 iColortype;
mng_uint8 iCompression;
mng_uint8 iFilter;
mng_uint8 iInterlace;
} mng_ihdr;
typedef mng_ihdr * mng_ihdrp;
/* ************************************************************************** */
typedef struct { /* PLTE */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iEntrycount;
mng_rgbpaltab aEntries;
} mng_plte;
typedef mng_plte * mng_pltep;
/* ************************************************************************** */
typedef struct { /* IDAT */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iDatasize;
mng_ptr pData;
} mng_idat;
typedef mng_idat * mng_idatp;
/* ************************************************************************** */
typedef struct { /* IEND */
mng_chunk_header sHeader;
} mng_iend;
typedef mng_iend * mng_iendp;
/* ************************************************************************** */
typedef struct { /* tRNS */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_bool bGlobal;
mng_uint8 iType; /* colortype (0,2,3) */
mng_uint32 iCount;
mng_uint8arr aEntries;
mng_uint16 iGray;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
mng_uint32 iRawlen;
mng_uint8arr aRawdata;
} mng_trns;
typedef mng_trns * mng_trnsp;
/* ************************************************************************** */
typedef struct { /* gAMA */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iGamma;
} mng_gama;
typedef mng_gama * mng_gamap;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_cHRM
typedef struct { /* cHRM */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iWhitepointx;
mng_uint32 iWhitepointy;
mng_uint32 iRedx;
mng_uint32 iRedy;
mng_uint32 iGreenx;
mng_uint32 iGreeny;
mng_uint32 iBluex;
mng_uint32 iBluey;
} mng_chrm;
typedef mng_chrm * mng_chrmp;
#endif
/* ************************************************************************** */
typedef struct { /* sRGB */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iRenderingintent;
} mng_srgb;
typedef mng_srgb * mng_srgbp;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iCCP
typedef struct { /* iCCP */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iNamesize;
mng_pchar zName;
mng_uint8 iCompression;
mng_uint32 iProfilesize;
mng_ptr pProfile;
} mng_iccp;
typedef mng_iccp * mng_iccpp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tEXt
typedef struct { /* tEXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_text;
typedef mng_text * mng_textp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_zTXt
typedef struct { /* zTXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint8 iCompression;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_ztxt;
typedef mng_ztxt * mng_ztxtp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iTXt
typedef struct { /* iTXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint8 iCompressionflag;
mng_uint8 iCompressionmethod;
mng_uint32 iLanguagesize;
mng_pchar zLanguage;
mng_uint32 iTranslationsize;
mng_pchar zTranslation;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_itxt;
typedef mng_itxt * mng_itxtp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_bKGD
typedef struct { /* bKGD */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iType; /* 3=indexed, 0=gray, 2=rgb */
mng_uint8 iIndex;
mng_uint16 iGray;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -