From 99a59c83cf845bc2859589f59ca709b92268df11 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 16 Apr 2011 21:22:04 +0000 Subject: Don't directly access private pnginfo members git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1474 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pngx.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) (limited to 'converter/other/pngx.c') diff --git a/converter/other/pngx.c b/converter/other/pngx.c index f9d2491f..f1afd39e 100644 --- a/converter/other/pngx.c +++ b/converter/other/pngx.c @@ -144,3 +144,160 @@ pngx_writeEnd(struct pngx * const pngxP) { +png_byte +pngx_colorType(struct pngx * const pngxP) { + + return png_get_color_type(pngxP->png_ptr, pngxP->info_ptr); +} + + + +void +pngx_setGama(struct pngx * const pngxP, + float const fileGamma) { + + png_set_gAMA(pngxP->png_ptr, pngxP->info_ptr, fileGamma); +} + + + +void +pngx_setChrm(struct pngx * const pngxP, + struct pngx_chroma const chroma) { + + png_set_cHRM(pngxP->png_ptr, pngxP->info_ptr, + chroma.wx, chroma.wy, + chroma.rx, chroma.ry, + chroma.gx, chroma.gy, + chroma.bx, chroma.by); +} + + + +void +pngx_setPhys(struct pngx * const pngxP, + struct pngx_phys const phys) { + + png_set_pHYs(pngxP->png_ptr, pngxP->info_ptr, + phys.x, phys.y, phys.unit); +} + + + +void +pngx_setTime(struct pngx * const pngxP, + png_time const timeArg) { + + png_time time; + + time = timeArg; + + png_set_tIME(pngxP->png_ptr, pngxP->info_ptr, &time); +} + + + +void +pngx_setSbit(struct pngx * const pngxP, + png_color_8 const sbitArg) { + + png_color_8 sbit; + + sbit = sbitArg; + + png_set_sBIT(pngxP->png_ptr, pngxP->info_ptr, &sbit); +} + + + +void +pngx_setInterlaceHandling(struct pngx * const pngxP) { + + png_set_interlace_handling(pngxP->png_ptr); +} + + + +void +pngx_setPlte(struct pngx * const pngxP, + png_color * const palette, + unsigned int const paletteSize) { + + png_set_PLTE(pngxP->png_ptr, pngxP->info_ptr, palette, paletteSize); +} + + + +void +pngx_setTrnsPalette(struct pngx * const pngxP, + const png_byte * const transPalette, + unsigned int const paletteSize) { + + png_set_tRNS(pngxP->png_ptr, pngxP->info_ptr, + (png_byte *)transPalette, paletteSize, NULL); +} + + + +void +pngx_setTrnsValue(struct pngx * const pngxP, + png_color_16 const transColorArg) { + + png_color_16 transColor; + + transColor = transColorArg; + + png_set_tRNS(pngxP->png_ptr, pngxP->info_ptr, + NULL, 0, &transColor); +} + + + +void +pngx_setHist(struct pngx * const pngxP, + png_uint_16 * const histogram) { + + png_set_hIST(pngxP->png_ptr, pngxP->info_ptr, histogram); +} + + + +struct pngx_trans +pngx_getTrns(struct pngx * const pngxP) { + + struct pngx_trans retval; + + png_get_tRNS(pngxP->png_ptr, pngxP->info_ptr, + &retval.trans, &retval.numTrans, &retval.transColorP); + + return retval; +} + + + +void +pngx_setBkgdPalette(struct pngx * const pngxP, + unsigned int const backgroundIndex) { + + png_color_16 background; + + background.index = backgroundIndex; + + png_set_bKGD(pngxP->png_ptr, pngxP->info_ptr, &background); +} + + + +void +pngx_setBkgdRgb(struct pngx * const pngxP, + png_color_16 const backgroundArg) { + + png_color_16 background; + + background = backgroundArg; + + png_set_bKGD(pngxP->png_ptr, pngxP->info_ptr, &background); +} + + + -- cgit 1.4.1