summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorRalf Stephan <ralf@ark.in-berlin.de>2006-06-22 14:26:10 +0000
committerrwst <rwst@users.sourceforge.net>2006-06-22 14:26:10 +0000
commit2bef43626ceb10288cf4e289dad406608c588eaf (patch)
tree2068eaf3d22e88a66cd17bd8a5e107497660292e /src/helper
parentremove setDoc(), part of fix for #1509854 (diff)
downloadinkscape-2bef43626ceb10288cf4e289dad406608c588eaf.tar.gz
inkscape-2bef43626ceb10288cf4e289dad406608c588eaf.zip
apply patch 1498946 by zbsz (fixes #1492545 "PNG resolution value export")
(bzr r1262)
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/png-write.cpp7
-rw-r--r--src/helper/png-write.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp
index 21eca1efa..c90121860 100644
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
@@ -53,18 +53,18 @@ sp_png_get_block_stripe (const guchar **rows, int row, int num_rows, void *data)
}
int
-sp_png_write_rgba (const gchar *filename, const guchar *px, int width, int height, int rowstride)
+sp_png_write_rgba (const gchar *filename, const guchar *px, int width, int height, double xdpi, double ydpi, int rowstride)
{
SPPNGBD bd;
bd.px = px;
bd.rowstride = rowstride;
- return sp_png_write_rgba_striped (filename, width, height, sp_png_get_block_stripe, &bd);
+ return sp_png_write_rgba_striped (filename, width, height, xdpi, ydpi, sp_png_get_block_stripe, &bd);
}
int
-sp_png_write_rgba_striped (const gchar *filename, int width, int height,
+sp_png_write_rgba_striped (const gchar *filename, int width, int height, double xdpi, double ydpi,
int (* get_rows) (const guchar **rows, int row, int num_rows, void *data),
void *data)
{
@@ -151,6 +151,7 @@ sp_png_write_rgba_striped (const gchar *filename, int width, int height,
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
/* note that if sRGB is present the cHRM chunk must be ignored
* on read and must be written in accordance with the sRGB profile */
+ png_set_pHYs(png_ptr, info_ptr, unsigned(xdpi / 0.0254 + 0.5), unsigned(ydpi / 0.0254 + 0.5), PNG_RESOLUTION_METER);
/* Write the file header information. REQUIRED */
png_write_info(png_ptr, info_ptr);
diff --git a/src/helper/png-write.h b/src/helper/png-write.h
index 2d2c16544..f8011f53e 100644
--- a/src/helper/png-write.h
+++ b/src/helper/png-write.h
@@ -14,9 +14,9 @@
#include <glib/gtypes.h>
-int sp_png_write_rgba(gchar const *filename, guchar const *px, int width, int height, int rowstride);
+int sp_png_write_rgba(gchar const *filename, guchar const *px, int width, int height, double xdpi, double ydpi, int rowstride);
-int sp_png_write_rgba_striped(gchar const *filename, int width, int height,
+int sp_png_write_rgba_striped(gchar const *filename, int width, int height, double xdpi, double ydpi,
int (* get_rows) (guchar const **rows, int row, int num_rows, void *data),
void *data);