* Why do I see the outline of the green box in this METAPOST code?
@ 2020-03-14 15:29 Gerben Wierda
2020-03-16 8:32 ` Taco Hoekwater
0 siblings, 1 reply; 2+ messages in thread
From: Gerben Wierda @ 2020-03-14 15:29 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1157 bytes --]
Code:
vardef Foo(expr w, h, lh) =
save pth; path pth;
save pthtwo; path pthtwo;
save pththree; path pththree;
save pic; picture pic;
pth = fullsquare xysized (w, h);
pthtwo = fullsquare xysized (2*lh, lh) shifted (-w/2, 2.5*lh);
pththree = fullsquare xysized (2*lh, lh) shifted (-w/2, lh);
fill pth withcolor green;
fill pthtwo withcolor yellow;
fill pththree withcolor yellow;
pic := image (
draw pth;
draw pthtwo;
draw pththree;
);
% setbounds pic to pth;
pic
enddef ;
Call:
\startMPpage
picture s ; s := Foo(8cm, 2cm, 0.25cm);
draw s;
drawdot center leftboundary s withpen pencircle scaled 2 withcolor green;
drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;
drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;
drawdot origin withpen pencircle scaled 4 withcolor red;
\stopMPpage
Output:
Why is the outline of the green box visible in the yellow boxes? And how can I prevent this from happening?
[-- Attachment #1.2.1: Type: text/html, Size: 5185 bytes --]
[-- Attachment #1.2.2: PastedGraphic-1.pdf --]
[-- Type: application/pdf, Size: 4268 bytes --]
[-- Attachment #1.2.3: Type: text/html, Size: 386 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Why do I see the outline of the green box in this METAPOST code?
2020-03-14 15:29 Why do I see the outline of the green box in this METAPOST code? Gerben Wierda
@ 2020-03-16 8:32 ` Taco Hoekwater
0 siblings, 0 replies; 2+ messages in thread
From: Taco Hoekwater @ 2020-03-16 8:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
Move the fills to within the image(), and build it up in
stacking order.
> On 14 Mar 2020, at 16:29, Gerben Wierda <gerben.wierda@rna.nl> wrote:
>
> Code:
>
> vardef Foo(expr w, h, lh) =
> save pth; path pth;
> save pthtwo; path pthtwo;
> save pththree; path pththree;
> save pic; picture pic;
> pth = fullsquare xysized (w, h);
> pthtwo = fullsquare xysized (2*lh, lh) shifted (-w/2, 2.5*lh);
> pththree = fullsquare xysized (2*lh, lh) shifted (-w/2, lh);
> fill pth withcolor green;
> fill pthtwo withcolor yellow;
> fill pththree withcolor yellow;
> pic := image (
> draw pth;
> draw pthtwo;
> draw pththree;
> );
> % setbounds pic to pth;
> pic
> enddef ;
>
>
> Call:
>
> \startMPpage
>
> picture s ; s := Foo(8cm, 2cm, 0.25cm);
>
> draw s;
>
> drawdot center leftboundary s withpen pencircle scaled 2 withcolor green;
> drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;
> drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;
> drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;
> drawdot origin withpen pencircle scaled 4 withcolor red;
>
> \stopMPpage
>
>
> Output:
>
> <PastedGraphic-1.pdf>
>
> Why is the outline of the green box visible in the yellow boxes? And how can I prevent this from happening?
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
Taco Hoekwater
Elvenkind BV
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-16 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-14 15:29 Why do I see the outline of the green box in this METAPOST code? Gerben Wierda
2020-03-16 8:32 ` Taco Hoekwater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).