[gs-cvs] rev 9313 - trunk/gs/base

mvrhel at ghostscript.com mvrhel at ghostscript.com
Sat Jan 3 14:45:50 PST 2009


Author: mvrhel
Date: 2009-01-03 14:45:50 -0800 (Sat, 03 Jan 2009)
New Revision: 9313

Modified:
   trunk/gs/base/gxblend.c
   trunk/gs/base/gxblend.h
Log:
Debug raw dumping code that I have found useful in my debug of transparency and overprint issues.  

DETAILS : Open images with Photoshop in the raw format with the dimensions given in the file name.

EXPECTED DIFFERENCES :  None





Modified: trunk/gs/base/gxblend.c
===================================================================
--- trunk/gs/base/gxblend.c	2009-01-03 19:51:08 UTC (rev 9312)
+++ trunk/gs/base/gxblend.c	2009-01-03 22:45:50 UTC (rev 9313)
@@ -20,6 +20,10 @@
 
 typedef int art_s32;
 
+#if RAW_DUMP
+extern unsigned char global_index;
+#endif
+
 void
 art_blend_luminosity_rgb_8(int n_chan, byte *dst, const byte *backdrop,
 			   const byte *src)
@@ -1216,4 +1220,48 @@
     *dst_alpha_g = alpha_g_i;
 }
 
+#if RAW_DUMP
 
+/* Debug dump of buffer data from pdf14 device.  Saved in
+   planar form with global indexing and tag information in
+   file name */
+
+void
+dump_raw_buffer(int num_rows, int width, int n_chan,
+                int plane_stride, int rowstride, 
+                char filename[],byte *Buffer)
+
+{
+    char full_file_name[50];
+    FILE *fid;
+    int z,y;
+    byte *buff_ptr;
+
+    buff_ptr = Buffer;
+
+    sprintf(full_file_name,"%d)%s_%dx%dx%d.raw",global_index,filename,width,num_rows,n_chan);
+    fid = fopen(full_file_name,"wb");
+
+    for (z = 0; z < n_chan; ++z) {
+
+        /* grab pointer to the next plane */
+
+        buff_ptr = &(Buffer[z*plane_stride]);
+    
+        for ( y = 0; y < num_rows; y++ ) {
+
+            /* write out each row */
+            fwrite(buff_ptr,sizeof(unsigned char),width,fid);
+
+            buff_ptr += rowstride;
+
+        }
+
+    }
+
+	fclose(fid);
+
+}
+
+
+#endif

Modified: trunk/gs/base/gxblend.h
===================================================================
--- trunk/gs/base/gxblend.h	2009-01-03 19:51:08 UTC (rev 9312)
+++ trunk/gs/base/gxblend.h	2009-01-03 22:45:50 UTC (rev 9313)
@@ -20,6 +20,8 @@
 #include "gxcvalue.h"
 #include "gxfrac.h"
 
+#define RAW_DUMP 0
+
 /* #define DUMP_TO_PNG */
 
 #define	PDF14_MAX_PLANES GX_DEVICE_COLOR_MAX_COMPONENTS
@@ -360,4 +362,11 @@
 		      int planestride, int rowstride,
 		      int x0, int y0, int width, int height, int num_comp, byte bg);
 
+#if RAW_DUMP
+
+void dump_raw_buffer(int num_rows, int width, int n_chan,
+                    int plane_stride, int rowstride, 
+                    char filename[],byte *Buffer);
+#endif
+
 #endif /* gxblend_INCLUDED */



More information about the gs-cvs mailing list