about summary refs log tree commit diff
path: root/converter/other/pngx.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-06-30 20:05:55 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-06-30 20:05:55 +0000
commit81ba0303f29b08507cccad29eecf2b30b012df63 (patch)
tree981bdae8afd0d4fac5e4834ae2c0b3b9a0462d5a /converter/other/pngx.c
parentd9c9d6a198247612248ad094ed7d40dcd4fa9031 (diff)
downloadnetpbm-mirror-81ba0303f29b08507cccad29eecf2b30b012df63.tar.gz
netpbm-mirror-81ba0303f29b08507cccad29eecf2b30b012df63.tar.xz
netpbm-mirror-81ba0303f29b08507cccad29eecf2b30b012df63.zip
Promote current Development release as Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3289 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pngx.c')
-rw-r--r--converter/other/pngx.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/converter/other/pngx.c b/converter/other/pngx.c
index a5171066..dfc74485 100644
--- a/converter/other/pngx.c
+++ b/converter/other/pngx.c
@@ -270,15 +270,39 @@ pngx_trns(struct pngx * const pngxP) {
 
 uint32_t
 pngx_xPixelsPerMeter(struct pngx * const pngxP) {
-
+/*----------------------------------------------------------------------------
+  Horizontal pixel density in pixel per meter; 0 if unknown.
+-----------------------------------------------------------------------------*/
     return png_get_x_pixels_per_meter(pngxP->png_ptr, pngxP->info_ptr);
 }
 
 
 
+float
+pngx_pixelAspectRatio(struct pngx * const pngxP) {
+/*----------------------------------------------------------------------------
+  Aspect ratio - y/x.  0.0 if unknown
+-----------------------------------------------------------------------------*/
+    return png_get_pixel_aspect_ratio(pngxP->png_ptr, pngxP->info_ptr);
+}
+
+
+
+bool
+pngx_pixelAspectRatioIsKnown(struct pngx * const pngxP) {
+/*----------------------------------------------------------------------------
+  There is pixel aspect ratio information in the PNG image.
+-----------------------------------------------------------------------------*/
+    return png_get_pixel_aspect_ratio(pngxP->png_ptr, pngxP->info_ptr) != 0.0;
+}
+
+
+
 uint32_t
 pngx_yPixelsPerMeter(struct pngx * const pngxP) {
-
+/*----------------------------------------------------------------------------
+  Vertical pixel density in pixel per meter; 0 if unknown.
+-----------------------------------------------------------------------------*/
     return png_get_y_pixels_per_meter(pngxP->png_ptr, pngxP->info_ptr);
 }
 
@@ -323,7 +347,7 @@ void
 pngx_setChrm(struct pngx *      const pngxP,
              struct pngx_chroma const chroma) {
 
-    png_set_cHRM(pngxP->png_ptr, pngxP->info_ptr, 
+    png_set_cHRM(pngxP->png_ptr, pngxP->info_ptr,
                  chroma.wx, chroma.wy,
                  chroma.rx, chroma.ry,
                  chroma.gx, chroma.gy,
@@ -460,7 +484,7 @@ void
 pngx_setPhys(struct pngx *    const pngxP,
              struct pngx_phys const phys) {
 
-    png_set_pHYs(pngxP->png_ptr, pngxP->info_ptr, 
+    png_set_pHYs(pngxP->png_ptr, pngxP->info_ptr,
                  phys.x, phys.y, phys.unit);
 }
 
@@ -664,7 +688,7 @@ pngx_readStart(struct pngx * const pngxP,
                FILE *        const ifP) {
 
     size_t sigByteCt;
-            
+
     verifyFileIsPng(ifP, &sigByteCt);
 
     /* Declare that we already read the signature bytes */
@@ -711,7 +735,7 @@ pngx_writeRow(struct pngx *    const pngxP,
 void
 pngx_readEnd(struct pngx * const pngxP) {
 
-    /* Note that some of info_ptr is not defined until png_read_end() 
+    /* Note that some of info_ptr is not defined until png_read_end()
        completes.  That's because it comes from chunks that are at the
        end of the stream.  In particular, text and time chunks may
        be at the end.  Furthermore, they may be in both places, in