• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

pngdib.h

Go to the documentation of this file.
00001 // pngdib.h
00002 
00003 #ifndef __PNGDIB_H__
00004 #define __PNGDIB_H__
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #define PNGDIB_HEADER_VERSION          20200
00011 #define PNGDIB_HEADER_VERSION_STRING   "2.2.0"
00012 
00013 
00014 // error codes returned by read_png_to_dib() and/or
00015 //   write_dib_to_png()
00016 
00017 #define PNGD_E_SUCCESS   0
00018 #define PNGD_E_ERROR     1   // unspecified error
00019 #define PNGD_E_VERSION   2   // struct size problem
00020 #define PNGD_E_NOMEM     3   // could not alloc memory
00021 #define PNGD_E_UNSUPP    4   // unsupported image type
00022 #define PNGD_E_LIBPNG    5   // libpng error (corrupt PNG?)
00023 #define PNGD_E_BADBMP    6   // corrupt or unsupported DIB
00024 #define PNGD_E_BADPNG    7   // corrupt or unsupported PNG
00025 #define PNGD_E_READ      8   // couldn't read PNG file
00026 #define PNGD_E_WRITE     9   // couldn't write PNG file
00027 
00028 struct PNGD_COLOR_struct {
00029     unsigned char red, green, blue, reserved;
00030 };
00031 
00032 typedef struct PNGD_D2PINFO_struct {
00033     DWORD           structsize;      // sizeof(PNGD_D2PINFO)
00034     DWORD           flags;
00035 #define PNGD_INTERLACED        0x00000001
00036 #define PNGD_NO_GAMMA_LABEL    0x00000002
00037 
00038     const char*     pngfn;          // PNG filename to write
00039 
00040     LPBITMAPINFOHEADER    lpdib;
00041     int             dibsize;        // can be 0
00042 
00043     VOID*           lpbits;         // can be NULL
00044     int             bitssize;       // can be 0
00045 
00046     char*           software;       // (NULL==don't include)
00047 // added in v2.0
00048     char*           errmsg;          // user can set to null or 100-char buffer
00049 } PNGD_D2PINFO;
00050 
00051 
00052 typedef struct PNGD_IMAGEINFO_struct {
00053     DWORD           structsize;    // sizeof(PNGD_IMAGEINFO)
00054     DWORD           flags;
00055 
00056 } PNGD_IMAGEINFO;
00057 
00058 typedef struct PNGD_P2DINFO_struct {
00059     DWORD           structsize;      // sizeof(PNGD_P2DINFO)
00060 
00061     DWORD           flags;           // combination of below:
00062 #define PNGD_USE_BKGD          0x00000001
00063 #define PNGD_USE_CUSTOM_BG     0x00000002
00064 #define PNGD_GAMMA_CORRECTION  0x00000004
00065 #define PNGD_USE_HEAPALLOC     0x00000008
00066 
00067 #define PNGD_BG_RETURNED     0x00010000 // return value only
00068 #define PNGD_RES_RETURNED    0x00020000 // set if xres,yres,res_units are valid
00069 #define PNGD_GAMMA_RETURNED  0x00040000 // set if file_gamma is valid
00070 
00071     const char*     pngfn;           // PNG filename to read
00072 
00073     LPBITMAPINFOHEADER    lpdib;     // return value only
00074     int             dibsize;         // return value only
00075     int             palette_offs;    // return value only
00076     int             bits_offs;       // return value only
00077     RGBQUAD*        palette;         // return value only
00078     int             palette_colors;  // return value only
00079     VOID*           lpbits;          // return value only
00080 // added in v2.0  (size=48)
00081     struct PNGD_COLOR_struct bgcolor; // IN OUT
00082     char*           errmsg;          // user can set to null or 100-char buffer
00083 // added in v2.1  (size=88)
00084     int             color_type;
00085     int             bits_per_sample;
00086     int             bits_per_pixel;
00087     int             interlace;
00088     int             res_x,res_y;
00089     int             res_units;
00090     int             reserved1;
00091     double          file_gamma;
00092 // added in v2.2   (size=96)
00093     HANDLE          heap;
00094     int             reserved2;
00095 
00096 } PNGD_P2DINFO;
00097 
00098 
00099 
00100 int read_png_to_dib(PNGD_P2DINFO *p2dinfo);
00101 
00102 int write_dib_to_png(PNGD_D2PINFO *d2pinfo);
00103 
00104 char* pngdib_get_version_string(void);
00105 int pngdib_get_version(void);
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* __PNGDIB_H__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1