[GRASS-SVN] r43927 - grass/trunk/raster/r.out.png
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 15 06:18:16 EDT 2010
Author: glynn
Date: 2010-10-15 03:18:16 -0700 (Fri, 15 Oct 2010)
New Revision: 43927
Modified:
grass/trunk/raster/r.out.png/main.c
Log:
Use functions rather than direct acess to the info struct
Modified: grass/trunk/raster/r.out.png/main.c
===================================================================
--- grass/trunk/raster/r.out.png/main.c 2010-10-15 09:59:25 UTC (rev 43926)
+++ grass/trunk/raster/r.out.png/main.c 2010-10-15 10:18:16 UTC (rev 43927)
@@ -233,10 +233,12 @@
png_info_init(info_ptr);
#endif
png_init_io(png_ptr, fp);
- info_ptr->width = win.cols;
- info_ptr->height = win.rows;
- info_ptr->bit_depth = depth;
+ png_set_IHDR(png_ptr, info_ptr, win.cols, win.rows, depth,
+ do_alpha ? PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB,
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
+ PNG_FILTER_TYPE_DEFAULT);
+
/* explicit filter-type (or none) required */
if ((filter >= 0) && (filter <= 4)) {
png_set_filter(png_ptr, 0, filter);
@@ -244,7 +246,7 @@
png_set_compression_level(png_ptr, png_compr);
- if(do_alpha) {
+ if (do_alpha) {
png_color_16 background_color;
background_color.red = (png_uint_16)def_red;
background_color.green = (png_uint_16)def_grn;
@@ -274,11 +276,6 @@
/*if(!gscale->answer){ *//* 24BIT COLOR IMAGE */
if (TRUE) {
- if (do_alpha)
- info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
- else
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
-
/* write the png-info struct */
png_write_info(png_ptr, info_ptr);
More information about the grass-commit
mailing list