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


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

Re: Anticlip

Started byjdaw1 <jdawiseman@gmail.com>
First post2015-08-31 15:55 -0700
Last post2015-09-01 22:38 +0200
Articles 3 — 2 participants

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Anticlip jdaw1 <jdawiseman@gmail.com> - 2015-08-31 15:55 -0700
    Re: Anticlip jdaw1 <jdawiseman@gmail.com> - 2015-08-31 16:27 -0700
    Re: Anticlip Carlos <angus@quovadis.com.ar> - 2015-09-01 22:38 +0200

#2331 — Re: Anticlip

Fromjdaw1 <jdawiseman@gmail.com>
Date2015-08-31 15:55 -0700
SubjectRe: Anticlip
Message-ID<9bb78240-1232-4a4e-b5b0-0f3dc7a6fc56@googlegroups.com>
Because I still want it, please allow me to re-ask this 10¼ years later. 

The Problem

• There is a background that cannot be re-painted. Just assume that it cannot be re-painted.

• There a currentpath, easily regeneratable. Or, equivalently, there is accessible code that generates the currentpath.

• What is wanted is to do the partial stroke of this path that is ≤6pt from the path, but >5pt.

• To make matters worse, the path is typically generated by charpath, so might be complicated, and its strokepath is sure to be nastily self-intersecting.

◊ If the background were certain to be empty white (but it isn’t), this could be done with 
gsave 12 setlinewidth 0 setgray stroke grestore 10 setlinewidth 1 setgray stroke
which is how it is currently done, quite unsatisfactorily. 

◊ If there were an anticlip operator (but there isn’t), it could be done with
gsave 10 setlinewidth strokepath anticlip regeneratepath 12 setlinewidth 0 setgray stroke grestore newpath 

••• But, neither of these cases applies. Please, have you any ideas as to how to achieve this over a non-repaintable background?

[toc] | [next] | [standalone]


#2333

Fromjdaw1 <jdawiseman@gmail.com>
Date2015-08-31 16:27 -0700
Message-ID<28603ac0-3e39-4db3-a240-238d03daa2cb@googlegroups.com>
In reply to#2331
Example of the problem with white-over-background: 
http://www.jdawiseman.com/2015/20150831_anticlip_need.pdf
http://www.jdawiseman.com/2015/20150831_anticlip_need.png

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


#2334

FromCarlos <angus@quovadis.com.ar>
Date2015-09-01 22:38 +0200
Message-ID<20150901223833.219fe870@samara.DOMA>
In reply to#2331
[jdaw1 <jdawiseman@gmail.com>, 2015-08-31 15:55]
> Because I still want it, please allow me to re-ask this 10¼ years
> later. 
> 
> The Problem
> 
> • There is a background that cannot be re-painted. Just assume that
> it cannot be re-painted.
> 
> • There a currentpath, easily regeneratable. Or, equivalently, there
> is accessible code that generates the currentpath.
> 
> • What is wanted is to do the partial stroke of this path that is
> ≤6pt from the path, but >5pt.
> 
> • To make matters worse, the path is typically generated by charpath,
> so might be complicated, and its strokepath is sure to be nastily
> self-intersecting.
> 
> ◊ If the background were certain to be empty white (but it isn’t),
> this could be done with gsave 12 setlinewidth 0 setgray stroke
> grestore 10 setlinewidth 1 setgray stroke which is how it is
> currently done, quite unsatisfactorily. 
> 
> ◊ If there were an anticlip operator (but there isn’t), it could be
> done with gsave 10 setlinewidth strokepath anticlip regeneratepath 12
> setlinewidth 0 setgray stroke grestore newpath 
> 
> ••• But, neither of these cases applies. Please, have you any ideas
> as to how to achieve this over a non-repaintable background?

Ghostscript supports PDF transparency. Here is an example; it requires
the background to be painted after the foreground.

HTH

%!

/W 200 def
/H 150 def

<< /PageSize [ W H ] >> setpagedevice

/draw-bg {
    4 20 H {
        10 20 W {
            2 copy  mul  W H mul  div  0.5 0.6 sethsbcolor
            1 index
            8 0 360 arc
            fill
        } for
    } for
} def

/draw-fg {
    30 30 moveto  W 30 sub  H 30 sub  lineto
    W  H 2 div   W  0   W 2 div  H 2 div  curveto
    0  H   0  H 2 div   30  30  curveto
    closepath
} def

% no transparency
gsave
    draw-bg
    draw-fg
    gsave 12 setlinewidth  0 setgray  stroke  grestore
    10 setlinewidth 1 setgray stroke
grestore

showpage

% transparency
gsave
    draw-fg
    gsave 12 setlinewidth  0 setgray  stroke  grestore
    10 setlinewidth 1 setgray stroke
    /Darken .setblendmode
    draw-bg
grestore

showpage


-- 

[toc] | [prev] | [standalone]


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


csiph-web