Re: Fix for 687294 psdcmyk device does not writeresolution correctly to PSD files

"Igor V. Melichev" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Dan,

I can't review your algorithm because I have no knowledge about the  PSD
format.
The syntax looks perfect.

Don't know where it's fine to assume that HWResolution is an integer.
I would code

    (int) (pdev->HWResolution[0] * 0x10000 + 0.5);


Igor.

----- Original Message ----- 
From: "Dan Coby" <[email protected]>
To: "Gs-Code-Review" <[email protected]>
Sent: Saturday, February 14, 2004 11:37 AM
Subject: [gs-code-review] Fix for 687294 psdcmyk device does not
writeresolution correctly to PSD files


>
> Fix for 687294 psdcmyk device does not write resolution correctly to PSD
> files.
> This change adds a 'ResolutionInfo structure' into the 'Image Resources'
> section of the output file.  This structure specifies the horizontal and
> vertical
> resolution of the image.  (Note:  Adobe's support of asymetric resolutions
> is
> poor.)
>
>
> DETAILS.
> Index: src/gdevpsd.c
> ===================================================================
> RCS file: /cvs/ghostscript/gs/src/gdevpsd.c,v
> retrieving revision 1.5
> diff -u -r1.5 gdevpsd.c
> --- src/gdevpsd.c       10 Jul 2003 22:32:04 -0000      1.5
> +++ src/gdevpsd.c       14 Feb 2004 08:31:26 -0000
> @@ -999,7 +999,8 @@
>         chan_names_len += (separation_name->size + 1);
>      }
>      psd_write_32(xc, 12 + (chan_names_len + (chan_names_len % 2))
> -                       + (12 + (14*xc->n_extra_channels)));
> +                       + (12 + (14*xc->n_extra_channels))
> +                       + 28);
>      psd_write(xc, (const byte *)"8BIM", 4);
>      psd_write_16(xc, 1006); /* 0x03EE */
>      psd_write_16(xc, 0); /* PString */
> @@ -1035,6 +1036,19 @@
>         psd_write_8(xc, 2); /* Don't know */
>         psd_write_8(xc, 0); /* Padding - Always Zero */
>      }
> +    /* Image resolution */
> +    psd_write(xc, (const byte *)"8BIM", 4);
> +    psd_write_16(xc, 1005); /* 0x03ED */
> +    psd_write_16(xc, 0); /* PString */
> +    psd_write_32(xc, 16); /* Length */
> +               /* Resolution is specified as a fixed 16.16 bits */
> +    psd_write_32(xc, (int) (pdev->HWResolution[0] * 0x10000));
> +    psd_write_16(xc, 1);       /* width:  1 --> resolution is pixels per
> inch */
> +    psd_write_16(xc, 1);       /* width:  1 --> resolution is pixels per
> inch */
> +    psd_write_32(xc, (int) (pdev->HWResolution[1] * 0x10000));
> +    psd_write_16(xc, 1);       /* height:  1 --> resolution is pixels per
> inch */
> +    psd_write_16(xc, 1);       /* height:  1 --> resolution is pixels per
> inch */
> +
>      /* Layer and Mask information */
>      psd_write_32(xc, 0);
>
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.