🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #917

Re: Snap to Pixel Question

#917
From: Ned Batchelder
Date: Wed, 23 Aug 1989 17:36
20 lines
1433 bytes
The problem you are having is that you are using snap with relative
operators. The snap procedures you are using think that they are dealing
with *locations*,
but the pair of numbers you are giving them are destined for the
r-flavor operators, so they are *displacements*. I think if you augment
your snap procedures with some relative versions, the problem will be fixed:

	/snap  {  transform 2 { round exch } repeat  itransform } def
	/rsnap { dtransform 2 { round exch } repeat idtransform } def

"snap" uses transform and itransform, which (from the Red Book) "...
transform the user space coordinate (x,y) ...". Rsnap uses dtransform
and idtransform, which "... transform the distance vector (dx, dy) ...".
The transform and dtransform operators exactly parallel the lineto and
rlineto operators, and now, the snap and rsnap procedures.

If you make sure to use snap for coordinates, and rsnap for
displacements, you should be ok.

Ned Batchelder, Digital Equipment Corp., BatchelderN@Hannah.DEC.com
Technical Details
Message-ID: <4287@shlump.nac.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!decuac!shlump.nac.dec.com!level.dec.com!batcheldern
References: <134400007@cdp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!decuac!shlump.nac.dec.com!level.dec.com!batcheldern
From: batcheldern@level.dec.com (Ned Batchelder)
Newsgroups: comp.lang.postscript
Subject: Re: Snap to Pixel Question
Message-ID: <4287@shlump.nac.dec.com>
Date: 23 Aug 89 17:36:51 GMT
References: <134400007@cdp>
Sender: news@shlump.nac.dec.com
Organization: DEC
Lines: 20