Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #552 > unrolled thread

How can I stretch a Postscript image, vertically only??

Started byRamon F Herrera <ramon@conexus.net>
First post2012-01-09 11:35 -0800
Last post2013-08-14 23:46 -0700
Articles 12 — 6 participants

Back to article view | Back to comp.lang.postscript


Contents

  How can I stretch a Postscript image, vertically only?? Ramon F Herrera <ramon@conexus.net> - 2012-01-09 11:35 -0800
    Re: How can I stretch a Postscript image, vertically only?? Helge Blischke <h.blischke@acm.org> - 2012-01-09 21:10 +0100
      Re: How can I stretch a Postscript image, vertically only?? Ramon F Herrera <ramon@conexus.net> - 2012-01-09 12:44 -0800
        Re: How can I stretch a Postscript image, vertically only?? luser- -droog <mijoryx@yahoo.com> - 2012-01-09 13:27 -0800
          Re: How can I stretch a Postscript image, vertically only?? luser- -droog <mijoryx@yahoo.com> - 2012-01-10 00:25 -0800
            Re: How can I stretch a Postscript image, vertically only?? Helge Blischke <h.blischke@acm.org> - 2012-01-10 12:50 +0100
              Re: How can I stretch a Postscript image, vertically only?? luser- -droog <mijoryx@yahoo.com> - 2012-09-13 21:34 -0700
            Re: How can I stretch a Postscript image, vertically only?? helmwo@gmail.com - 2012-09-24 09:16 -0700
              Re: How can I stretch a Postscript image, vertically only?? "luser.droog" <luser.droog@gmail.com> - 2012-09-24 18:25 -0500
      Re: How can I stretch a Postscript image, vertically only?? Ramon F Herrera <ramon@conexus.net> - 2012-01-09 12:54 -0800
    Re: How can I stretch a Postscript image, vertically only?? Mark Carroll <mtbc@bcs.org> - 2013-08-03 09:39 +0100
      Re: How can I stretch a Postscript image, vertically only?? luser- -droog <mijoryx@yahoo.com> - 2013-08-14 23:46 -0700

#552 — How can I stretch a Postscript image, vertically only??

FromRamon F Herrera <ramon@conexus.net>
Date2012-01-09 11:35 -0800
SubjectHow can I stretch a Postscript image, vertically only??
Message-ID<621c6264-3d28-42d0-81b6-65d0f4eb934e@m11g2000yqe.googlegroups.com>
See my thread "Need minimum/tutorial Postscript code".

In essence, I need to multiply the vertical dimensions by a factor of
3.

TIA,

-Ramon

[toc] | [next] | [standalone]


#553

FromHelge Blischke <h.blischke@acm.org>
Date2012-01-09 21:10 +0100
Message-ID<9n0vt8Fpp4U1@mid.individual.net>
In reply to#552
Ramon F Herrera wrote:

> 
> See my thread "Need minimum/tutorial Postscript code".
> 
> In essence, I need to multiply the vertical dimensions by a factor of
> 3.
> 
> TIA,
> 
> -Ramon

What about

1 3 scale

?

Helge

[toc] | [prev] | [next] | [standalone]


#554

FromRamon F Herrera <ramon@conexus.net>
Date2012-01-09 12:44 -0800
Message-ID<bb086a9a-f4b7-43d3-9f1b-ba9691542b65@k28g2000yqn.googlegroups.com>
In reply to#553
On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
> Ramon F Herrera wrote:
>
> > See my thread "Need minimum/tutorial Postscript code".
>
> > In essence, I need to multiply the vertical dimensions by a factor of
> > 3.
>
> > TIA,
>
> > -Ramon
>

 > What about
 >
 > 1 3 scale
 >
 > ?
 >
 > Helge

Thanks Helge!

I tried it, but it doesn't work. It scales the traces, making the
horizontal lines thicker:

http://patriot.net/~ramon/misc/Trace-Scale.png

What I need is to make the cells 3 times taller, in order to see the
inner rhombus more clearly.

-Ramon

[toc] | [prev] | [next] | [standalone]


#557

Fromluser- -droog <mijoryx@yahoo.com>
Date2012-01-09 13:27 -0800
Message-ID<5f5084db-e002-401d-8a8d-072e0592db75@q17g2000yqh.googlegroups.com>
In reply to#554
On Jan 9, 2:44 pm, Ramon F Herrera <ra...@conexus.net> wrote:
> On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
>
> > Ramon F Herrera wrote:
>
> > > See my thread "Need minimum/tutorial Postscript code".
>
> > > In essence, I need to multiply the vertical dimensions by a factor of
> > > 3.
>
> > > TIA,
>
> > > -Ramon
>
>  > What about
>  >
>  > 1 3 scale
>  >
>  > ?
>  >
>  > Helge
>
> Thanks Helge!
>
> I tried it, but it doesn't work. It scales the traces, making the
> horizontal lines thicker:
>

That's not fatal! You just need to *un*scale before you `stroke`.


matrix currentmatrix  % get a copy of the 'current' matrix
1 3 scale
    %create path (moveto's and lineto's)
setmatrix  % reinstall the saved matrix
stroke  % draw the lines with the "normal" pen-shape.


In a pinch, you can use
    matrix defaultmatrix setmatrix
to reset the pen-shape. But this is a bad habit; it destroys
modularity; and it's illegal in EPS. Because you can't *embed*
the program fragment anymore.

[toc] | [prev] | [next] | [standalone]


#559

Fromluser- -droog <mijoryx@yahoo.com>
Date2012-01-10 00:25 -0800
Message-ID<1f50f327-f97f-496f-971b-c1d2996b41e1@r5g2000yqc.googlegroups.com>
In reply to#557
On Jan 9, 3:27 pm, luser- -droog <mijo...@yahoo.com> wrote:
> On Jan 9, 2:44 pm, Ramon F Herrera <ra...@conexus.net> wrote:
>
>
>
> > On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
>
> > > Ramon F Herrera wrote:
>
> > > > See my thread "Need minimum/tutorial Postscript code".
>
> > > > In essence, I need to multiply the vertical dimensions by a factor of
> > > > 3.
>
> > > > TIA,
>
> > > > -Ramon
>
> >  > What about
> >  >
> >  > 1 3 scale
> >  >
> >  > ?
> >  >
> >  > Helge
>
> > Thanks Helge!
>
> > I tried it, but it doesn't work. It scales the traces, making the
> > horizontal lines thicker:
>
> That's not fatal! You just need to *un*scale before you `stroke`.
>
> matrix currentmatrix  % get a copy of the 'current' matrix
> 1 3 scale
>     %create path (moveto's and lineto's)
> setmatrix  % reinstall the saved matrix
> stroke  % draw the lines with the "normal" pen-shape.
>
> In a pinch, you can use
>     matrix defaultmatrix setmatrix
> to reset the pen-shape. But this is a bad habit; it destroys
> modularity; and it's illegal in EPS. Because you can't *embed*
> the program fragment anymore.

This is an aspect of postscript that took me a looooong time even
to notice. For line-drawing, postscript uses the Current
Transformation
Matrix /twice/! It transforms user coordinates through the CTM and
stores the current path in device-space points (so currentpoint
uses itransform to present the point in the current user-space).

Then, when you stroke, it uses the CTM a second time to define the
shape of the virtual pen (brush) that performs the drawing.

A nifty special effect is to use some crazy /skewed/ pen to draw
an otherwise static picture. It can "liven things up".

% construct path (moveto's and lineto's)
[ 1 .5  5 30 0 0 ] setmatrix stroke

[toc] | [prev] | [next] | [standalone]


#561

FromHelge Blischke <h.blischke@acm.org>
Date2012-01-10 12:50 +0100
Message-ID<9n2n0jF1f1U1@mid.individual.net>
In reply to#559
luser- -droog wrote:

> On Jan 9, 3:27 pm, luser- -droog <mijo...@yahoo.com> wrote:
>> On Jan 9, 2:44 pm, Ramon F Herrera <ra...@conexus.net> wrote:
>>
>>
>>
>> > On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
>>
>> > > Ramon F Herrera wrote:
>>
>> > > > See my thread "Need minimum/tutorial Postscript code".
>>
>> > > > In essence, I need to multiply the vertical dimensions by a factor
>> > > > of 3.
>>
>> > > > TIA,
>>
>> > > > -Ramon
>>
>> > > What about
>> > >
>> > > 1 3 scale
>> > >
>> > > ?
>> > >
>> > > Helge
>>
>> > Thanks Helge!
>>
>> > I tried it, but it doesn't work. It scales the traces, making the
>> > horizontal lines thicker:
>>
>> That's not fatal! You just need to *un*scale before you `stroke`.
>>
>> matrix currentmatrix  % get a copy of the 'current' matrix
>> 1 3 scale
>> %create path (moveto's and lineto's)
>> setmatrix  % reinstall the saved matrix
>> stroke  % draw the lines with the "normal" pen-shape.
>>
>> In a pinch, you can use
>> matrix defaultmatrix setmatrix
>> to reset the pen-shape. But this is a bad habit; it destroys
>> modularity; and it's illegal in EPS. Because you can't *embed*
>> the program fragment anymore.
"illegal" is a hard statement. The core of the restrictions the PLRM states 
on EPS files is that an EPS must not generate any unwanted side effects that 
may have influence of the environment that includes the EPS. But if you use 
e.g. setmatrix as shown above it is perfectly legal.

> 
> This is an aspect of postscript that took me a looooong time even
> to notice. For line-drawing, postscript uses the Current
> Transformation
> Matrix /twice/! It transforms user coordinates through the CTM and
> stores the current path in device-space points (so currentpoint
> uses itransform to present the point in the current user-space).
> 
> Then, when you stroke, it uses the CTM a second time to define the
> shape of the virtual pen (brush) that performs the drawing.
> 
> A nifty special effect is to use some crazy /skewed/ pen to draw
> an otherwise static picture. It can "liven things up".
> 
> % construct path (moveto's and lineto's)
> [ 1 .5  5 30 0 0 ] setmatrix stroke

[toc] | [prev] | [next] | [standalone]


#959

Fromluser- -droog <mijoryx@yahoo.com>
Date2012-09-13 21:34 -0700
Message-ID<e7dc0339-bd5f-4bfa-a25c-caacf7fd4b31@googlegroups.com>
In reply to#561
On Tuesday, January 10, 2012 5:50:38 AM UTC-6, Helge Blischke wrote:
> luser- -droog wrote:
> 
> 
> 
> > On Jan 9, 3:27 pm, luser- -droog <mijo...@yahoo.com> wrote:
> 
> >> On Jan 9, 2:44 pm, Ramon F Herrera <ra...@conexus.net> wrote:
> 
> >>
> 
> >>
> 
> >>
> 
> >> > On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
> 
> >>
> 
> >> > > Ramon F Herrera wrote:
> 
> >>
> 
> >> > > > See my thread "Need minimum/tutorial Postscript code".
> 
> >>
> 
> >> > > > In essence, I need to multiply the vertical dimensions by a factor
> 
> >> > > > of 3.
> 
> >>
> 
> >> > > > TIA,
> 
> >>
> 
> >> > > > -Ramon
> 
> >>
> 
> >> > > What about
> 
> >> > >
> 
> >> > > 1 3 scale
> 
> >> > >
> 
> >> > > ?
> 
> >> > >
> 
> >> > > Helge
> 
> >>
> 
> >> > Thanks Helge!
> 
> >>
> 
> >> > I tried it, but it doesn't work. It scales the traces, making the
> 
> >> > horizontal lines thicker:
> 
> >>
> 
> >> That's not fatal! You just need to *un*scale before you `stroke`.
> 
> >>
> 
> >> matrix currentmatrix  % get a copy of the 'current' matrix
> 
> >> 1 3 scale
> 
> >> %create path (moveto's and lineto's)
> 
> >> setmatrix  % reinstall the saved matrix
> 
> >> stroke  % draw the lines with the "normal" pen-shape.
> 
> >>
> 
> >> In a pinch, you can use
> 
> >> matrix defaultmatrix setmatrix
> 
> >> to reset the pen-shape. But this is a bad habit; it destroys
> 
> >> modularity; and it's illegal in EPS. Because you can't *embed*
> 
> >> the program fragment anymore.
> 
> "illegal" is a hard statement. The core of the restrictions the PLRM states 
> 
> on EPS files is that an EPS must not generate any unwanted side effects that 
> 
> may have influence of the environment that includes the EPS. But if you use 
> 
> e.g. setmatrix as shown above it is perfectly legal.
> 
> 
> 

Finally looked this one up.
PLRM 2ed, Appendix I Guidelines for Specific Operators
===
setmatrix
Should be used with a matrix that was previously obtained
using the currentmatrix operator or its equivalent. It can
be used for drawing objects such as ovals:

   matrix currentmatrix
   rx ry scale
   0 0 1 0 360 arc
   setmatrix
   stroke
This example ensures that the oval is drawn with an even 
stroke. However, do not use this operator to perform such 
operations as flipping the coordinate axes. Instead, use 
the concat operator and concatenate to the current 
transformation matrix. Ordinarily, Postscript programs
should modify the CTM (by using the translate, scale, rotate,
and concat operators rather than replacing it.
===

So `matrix defaultmatrix setmatrix` is definitely discouraged.
Doing this is not what one ordinarily should do.

[toc] | [prev] | [next] | [standalone]


#976

Fromhelmwo@gmail.com
Date2012-09-24 09:16 -0700
Message-ID<38c69c4c-26c4-4dc8-a31b-910acf96e55f@googlegroups.com>
In reply to#559
Am Dienstag, 10. Januar 2012 09:25:52 UTC+1 schrieb luser- -droog:
> ... For line-drawing, postscript uses the Current
> 
> Transformation
> 
> Matrix /twice/! 

You know that this is only "half true" what you say. The path construction uses the CTM to fix up where the points have to be.
If you now invoke something like "stroke" it has to "enhance" the path to make it "substantial" and it will do this by CTM at this moment. As a "normal path" has no dimensions regarding how "thick" is a line, this is done at the moment the line is drawn. The "stroke" operator knows how thick the line has to be. So, this is wanted behavior. Nothing big to mention.

Regards,
-Helmar

[toc] | [prev] | [next] | [standalone]


#977

From"luser.droog" <luser.droog@gmail.com>
Date2012-09-24 18:25 -0500
Message-ID<k3qq59$ttv$1@dont-email.me>
In reply to#976
helmwo@gmail.com wrote:

> Am Dienstag, 10. Januar 2012 09:25:52 UTC+1 schrieb luser- -droog:
>> ... For line-drawing, postscript uses the Current
>> 
>> Transformation
>> 
>> Matrix /twice/!
> 
> You know that this is only "half true" what you say. The path construction
> uses the CTM to fix up where the points have to be. If you now invoke
> something like "stroke" it has to "enhance" the path to make it
> "substantial" and it will do this by CTM at this moment. As a "normal
> path" has no dimensions regarding how "thick" is a line, this is done at
> the moment the line is drawn. The "stroke" operator knows how thick the
> line has to be. So, this is wanted behavior. Nothing big to mention.
> 
> Regards,
> -Helmar

Agreed. But this appeared to be the crucial missing fact for OP's program.

[toc] | [prev] | [next] | [standalone]


#556

FromRamon F Herrera <ramon@conexus.net>
Date2012-01-09 12:54 -0800
Message-ID<6b6e27a8-7a34-467d-aeb7-73af0993dc62@z12g2000yqm.googlegroups.com>
In reply to#553
On Jan 9, 2:10 pm, Helge Blischke <h.blisc...@acm.org> wrote:
> Ramon F Herrera wrote:
>
> > See my thread "Need minimum/tutorial Postscript code".
>
> > In essence, I need to multiply the vertical dimensions by a factor of
> > 3.
>
> > TIA,
>
> > -Ramon
>
> What about
>
> 1 3 scale
>
> ?
>
> Helge


Here's my current Postscript code (either one, is the same file):

http://patriot.net/~ramon/misc/brain-teaser.ps

http://patriot.net/~ramon/misc/brain-teaser.ps.txt

TIA,

-Ramon

[toc] | [prev] | [next] | [standalone]


#1571

FromMark Carroll <mtbc@bcs.org>
Date2013-08-03 09:39 +0100
Message-ID<871u6bqib5.fsf@ixod.org>
In reply to#552
Ramon F Herrera <ramon@conexus.net> writes:

> In essence, I need to multiply the vertical dimensions by a factor of
> 3.

An incredibly late reply, I know, but including a,
1 3 scale
should do that just fine.

Mark

[toc] | [prev] | [next] | [standalone]


#1578

Fromluser- -droog <mijoryx@yahoo.com>
Date2013-08-14 23:46 -0700
Message-ID<37b21e1a-417c-4ab2-9fa8-def97096bd33@googlegroups.com>
In reply to#1571
On Saturday, August 3, 2013 3:39:42 AM UTC-5, Mark Carroll wrote:
> Ramon F Herrera <ramon@conexus.net> writes:
> 
> 
> 
> > In essence, I need to multiply the vertical dimensions by a factor of
> 
> > 3.
> 
> 
> 
> An incredibly late reply, I know, but including a,
> 
> 1 3 scale
> 
> should do that just fine.
> 

I'm assuming your newsgroup interface isn't showing you the whole thread.
That was a good start, but it makes horizontal lines wider than vertical
lines. A workaround was to reset the matrix before stroking.

  matrix currentmatrix
  1 3 scale
  ...
  setmatrix stroke

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web