about summary refs log tree commit diff
path: root/converter/other/pamtopng.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-07-26 00:38:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-07-26 00:38:56 +0000
commite821db62a988c16efdf2256928a3c68fb7cdf9d3 (patch)
tree15e64121ccc4a660f52a1e9f7dcafd2980057442 /converter/other/pamtopng.c
parenta507d475a249a41fe3452279c21fa5d595f39289 (diff)
downloadnetpbm-mirror-e821db62a988c16efdf2256928a3c68fb7cdf9d3.tar.gz
netpbm-mirror-e821db62a988c16efdf2256928a3c68fb7cdf9d3.tar.xz
netpbm-mirror-e821db62a988c16efdf2256928a3c68fb7cdf9d3.zip
Implement -itxt
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2611 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pamtopng.c')
-rw-r--r--converter/other/pamtopng.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c
index 685e4e15..528184b2 100644
--- a/converter/other/pamtopng.c
+++ b/converter/other/pamtopng.c
@@ -452,57 +452,54 @@ doSrgbChunk(struct pngx *   const pngxP,
 
 
 static void
-doTextChunk(struct pngx * const pngxP,
-            const char *  const textFileName) {
+doTextChunkSet(struct pngx * const pngxP,
+               const char *  const textFileName) {
+
+    bool const ztxt = true;
+    bool const itxt = false;
 
     FILE * tfP;
 
     tfP = pm_openr(textFileName);
     
-    pngtxt_read(pngxP, tfP, false, verbose);
+    pngtxt_addChunk(pngxP, tfP, ztxt, itxt, verbose);
     
-    if (verbose)
-        pm_message("writing tEXt chunk");
-
     pm_close(tfP);
 }
 
 
 
 static void
-doZtxtChunk(struct pngx * const pngxP,
-            const char *  const textFileName) {
+doZtxtChunkSet(struct pngx * const pngxP,
+               const char *  const textFileName) {
+
+    bool const ztxt = true;
+    bool const itxt = false;
 
     FILE * tfP;
 
     tfP = pm_openr(textFileName);
     
-    pngtxt_read(pngxP, tfP, true, verbose);
+    pngtxt_addChunk(pngxP, tfP, ztxt, itxt, verbose);
     
-    if (verbose)
-        pm_message("writing zTXt chunk");
-
     pm_close(tfP);
-    
 }
 
 
 
 
 static void
-doItxtChunk (struct pngx * const pngxP,
-             const char *  const textFileName) {
+doItxtChunkSet(struct pngx * const pngxP,
+               const char *  const textFileName) {
+
+    bool const ztxt = true;
+    bool const itxt = true;
 
     FILE * tfP;
 
     tfP = pm_openr(textFileName);
 
-    pm_error("Code to handle an ITXT chunk has not been written yet");
-
-    /* pngtxt_read(pngxP, tfP, true, true, verbose); */
-
-    if (verbose)
-        pm_message("writing iTXt chunk");
+    pngtxt_addChunk(pngxP, tfP, ztxt, itxt, verbose);
 }
 
 
@@ -669,13 +666,13 @@ writePng(const struct pam * const pamP,
         doSrgbChunk(pngxP, cmdline.srgbintent);
 
     if (cmdline.textSpec)
-        doTextChunk(pngxP, cmdline.text);
+        doTextChunkSet(pngxP, cmdline.text);
 
     if (cmdline.ztxtSpec)
-        doZtxtChunk(pngxP, cmdline.ztxt);
+        doZtxtChunkSet(pngxP, cmdline.ztxt);
 
     if (cmdline.itxtSpec)
-        doItxtChunk(pngxP, cmdline.itxt);
+        doItxtChunkSet(pngxP, cmdline.itxt);
 
     if (cmdline.backgroundSpec)
         doBkgdChunk(pamP, pngxP, cmdline.background);