Author: rmottola
Date: Mon Apr 24 12:42:32 2017
New Revision: 40491
URL: http://svn.gna.org/viewcvs/gnustep?rev=40491&view=rev
Log:
Support for writing resolution
Modified:
libs/gui/trunk/ChangeLog
libs/gui/trunk/Source/NSBitmapImageRep.m
libs/gui/trunk/Source/tiff.m
Modified: libs/gui/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=40491&r1=40490&r2=40491&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog (original)
+++ libs/gui/trunk/ChangeLog Mon Apr 24 12:42:32 2017
@@ -1,3 +1,9 @@
+2017-04-24 Riccardo Mottola <[email protected]>
+
+ * Source/tiff.m
+ * Source/NSBitmapImageRep.m
+ Support for writing resolution.
+
2017-04-22 Fred Kiefer <[email protected]>
* Version: Correct required base version that has been off for a year.
Modified: libs/gui/trunk/Source/NSBitmapImageRep.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSBitmapImageRep.m?rev=40491&r1=40490&r2=40491&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSBitmapImageRep.m (original)
+++ libs/gui/trunk/Source/NSBitmapImageRep.m Mon Apr 24 12:42:32 2017
@@ -2,7 +2,7 @@
<abstract>Bitmap image representation.</abstract>
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
Author: Adam Fedor <[email protected]>
Date: Feb 1996
@@ -2015,6 +2015,16 @@
info->bitsPerSample = _bitsPerSample;
info->samplesPerPixel = _numColors;
+ // resolution/density
+ if (_pixelsWide != (int)(_size.width) || _pixelsHigh != (int)(_size.height))
+ {
+ float x_density, y_density;
+ x_density = _pixelsWide * 72 / _size.width;
+ y_density = _pixelsHigh * 72 / _size.height;
+ info->xdpi = x_density;
+ info->ydpi = y_density;
+ }
+
if (_isPlanar)
info->planarConfig = PLANARCONFIG_SEPARATE;
else
Modified: libs/gui/trunk/Source/tiff.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/tiff.m?rev=40491&r1=40490&r2=40491&view=diff
==============================================================================
--- libs/gui/trunk/Source/tiff.m (original)
+++ libs/gui/trunk/Source/tiff.m Mon Apr 24 12:42:32 2017
@@ -3,7 +3,7 @@
Functions for dealing with tiff images.
- Copyright (C) 1996,1999-2010 Free Software Foundation, Inc.
+ Copyright (C) 1996,1999-2010, 2017 Free Software Foundation, Inc.
Author: Adam Fedor <[email protected]>
Date: Feb 1996
@@ -488,6 +488,12 @@
TIFFSetField(image, TIFFTAG_IMAGEWIDTH, info->width);
TIFFSetField(image, TIFFTAG_IMAGELENGTH, info->height);
+ if (info->xdpi && info->ydpi)
+ {
+ TIFFSetField(image, TIFFTAG_XRESOLUTION, info->xdpi);
+ TIFFSetField(image, TIFFTAG_YRESOLUTION, info->ydpi);
+ TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, 2);
+ }
TIFFSetField(image, TIFFTAG_COMPRESSION, info->compression);
if (info->compression == COMPRESSION_JPEG)
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs