--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: gs: ImageType3 renders incorrectly in certain cases. Patch included.
- From: Len Sorensen <lsorense@opengraphics.com>
- Date: Fri, 09 May 2003 11:03:28 -0400
- Message-id: <E19E9PE-0003jG-00@arrow.opengraphics.com>
Package: gs
Version: 7.06-1.1
Severity: normal
The following postscript renders incorrectly in every version of
ghostscript I have tried it on, 7.04 (aladdin), 7.05.06 (ESP) and 7.06
(gnu): It leaves a blank line on line 258 of the output, due to the
mask data and image daa being out of sync (and scaled differently)
%!PS-Adobe-3.0
%
% This program demonstrates a bug in Ghoscript's Masked Image rendering.
% To reproduce the bug, use the following command-line:
%
% gs -r371 -g100x800 gsbug.ps
%
% You should notice a one-pixel horizontal white line near the top of
% the picture. To save the bad result to a file, use the following
% command-line:
%
% gs -q -r371 -g100x800 -sDEVICE=ppmraw -dBATCH -dNOPAUSE -sOutputFile=gsbug.ppm gsbug.ps
%
/ImageDataDictionary <<
/ImageType 1
/Width 1
/Height 1000
/BitsPerComponent 8
/DataSource <ff108080>
/MultipleDataSources false
/ImageMatrix [ 1 0 0 -1483 0 1000 ]
/Decode [ 0 1 0 1 0 1 ]
>> def
/ImageMaskDictionary <<
/ImageType 1
/Width 1
/Height 1000
/BitsPerComponent 8
/MultipleDataSources false
/ImageMatrix [ 1 0 0 -1483 0 1000 ]
/Decode [ 1 0 ]
>> def
/MaskedImageDictionary <<
/ImageType 3
/InterleaveType 1
/MaskDict ImageMaskDictionary
/DataDict ImageDataDictionary
>> def
[100 0 0 -1484.00012 0 1000] setmatrix
/DeviceRGB setcolorspace
MaskedImageDictionary image
showpage
The following patch (made by Jeong Kim from ghostscript.com) fixes
the problem:
Log:
When scaling factors of /ImageMatrix in a image mask for ImageType3 are
negative, translation offset values for image mask rendering are
incorrect and it makes abnormal output (eg. white lines).
This patch fixes this bug #686843. Thanks to Len Sorensen for the analysis.
diff -C2 -r1.11 gximage3.c
*** src/gximage3.c 25 Oct 2002 00:27:10 -0000 1.11
--- src/gximage3.c 9 May 2003 05:47:30 -0000
***************
*** 328,334 ****
(code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
)
! return code;
! origin.x = (int)floor(mrect.p.x);
! origin.y = (int)floor(mrect.p.y);
code = make_mid(&mdev, dev, (int)ceil(mrect.q.x) - origin.x,
(int)ceil(mrect.q.y) - origin.y, mem);
--- 328,336 ----
(code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
)
! return code;
!
! origin.x = (mrect.p.x < 0) ? (int)ceil(mrect.p.x) : (int)floor(mrect.p.x);
! origin.y = (mrect.p.y < 0) ? (int)ceil(mrect.p.y) : (int)floor(mrect.p.y);
!
code = make_mid(&mdev, dev, (int)ceil(mrect.q.x) - origin.x,
(int)ceil(mrect.q.y) - origin.y, mem);
The line numbers may be slightly off, but the some code change is needed
in all ghostscript versions to fix the issue.
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux arrow 2.4.20-p2-smp-og #1 SMP Tue Dec 17 10:35:41 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gs depends on:
ii gs-common 0.3.3.1 Common files for different Ghostsc
ii libc6 2.3.1-17 GNU C Library: Shared libraries an
ii libgimpprint1 4.2.5-3 Gimp-Print printer drivers - core
ii libpaper1 1.1.13 Library for handling paper charact
ii libpng12-0 1.2.5.0-2 PNG library - runtime
ii xlibs 4.2.1-6 X Window System client libraries
ii zlib1g 1:1.1.4-11 compression library - runtime
-- debconf information:
* gs/previewer: true
* gs/substitute: true
* gs/printer: true
--- End Message ---