* [NTG-context] MetaPost background
@ 2024-07-23 18:29 alan.caruanambom
2024-07-23 18:43 ` [NTG-context] " Otared Kavian
2024-07-23 18:45 ` Wolfgang Schuster
0 siblings, 2 replies; 4+ messages in thread
From: alan.caruanambom @ 2024-07-23 18:29 UTC (permalink / raw)
To: ntg-context
Hello, I need the background (lines and points) to be inside (tangent) of the frame, I don't know how to do it
\startuseMPgraphic{fullheightbackground}
fill unitsquare xyscaled (OverlayWidth, OverlayHeight) withcolor "gray" ;
w := MakeupWidth;
h := OverlayHeight;
draw (0,0)--(MakeupWidth,0) withpen pencircle scaled 2pt withcolor green;
draw (0,OverlayHeight)--(MakeupWidth,OverlayHeight) withpen pencircle scaled 2pt withcolor green;
drawdot (0,0) withpen pencircle scaled 8pt withcolor red;
drawdot (MakeupWidth,OverlayHeight) withpen pencircle scaled 8pt withcolor red;
\stopuseMPgraphic
\defineoverlay
[fullheightbackground]
[\useMPgraphic{fullheightbackground}]
\setupframedtexts
[background=fullheightbackground,
backgroundoffset=0pt,
frame=on]
\starttext
\startframedtext[width=\textwidth,align=left]
\input knuth
\stopframedtext
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: MetaPost background
2024-07-23 18:29 [NTG-context] MetaPost background alan.caruanambom
@ 2024-07-23 18:43 ` Otared Kavian
2024-07-23 18:45 ` Wolfgang Schuster
1 sibling, 0 replies; 4+ messages in thread
From: Otared Kavian @ 2024-07-23 18:43 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 2032 bytes --]
Hi,
If you change
drawdot (0,0) withpen pencircle scaled 8pt withcolor red;
into
drawdot (6pt,6pt) withpen pencircle scaled 8pt withcolor red ;
you get what you want (at least for the red dot on the lower left corner).
Here 6pt = 2pt (with of the pen used for the frame) + 4pt (half the diameter of the pen used for the dot).
Best regards: Otared
> On 23 Jul 2024, at 20:29, alan.caruanambom@gmail.com wrote:
>
> Hello, I need the background (lines and points) to be inside (tangent) of the frame, I don't know how to do it
>
> \startuseMPgraphic{fullheightbackground}
> fill unitsquare xyscaled (OverlayWidth, OverlayHeight) withcolor "gray" ;
>
> w := MakeupWidth;
> h := OverlayHeight;
>
> draw (0,0)--(MakeupWidth,0) withpen pencircle scaled 2pt withcolor green;
> draw (0,OverlayHeight)--(MakeupWidth,OverlayHeight) withpen pencircle scaled 2pt withcolor green;
>
> drawdot (0,0) withpen pencircle scaled 8pt withcolor red;
> drawdot (MakeupWidth,OverlayHeight) withpen pencircle scaled 8pt withcolor red;
> \stopuseMPgraphic
>
> \defineoverlay
> [fullheightbackground]
> [\useMPgraphic{fullheightbackground}]
>
> \setupframedtexts
> [background=fullheightbackground,
> backgroundoffset=0pt,
> frame=on]
>
> \starttext
>
> \startframedtext[width=\textwidth,align=left]
> \input knuth
> \stopframedtext
>
> \stoptext
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
Otared Kavian
e-mail: otared@gmail.com
Phone: +33 6 88 26 70 95
[-- Attachment #1.2: Type: text/html, Size: 4277 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: MetaPost background
2024-07-23 18:29 [NTG-context] MetaPost background alan.caruanambom
2024-07-23 18:43 ` [NTG-context] " Otared Kavian
@ 2024-07-23 18:45 ` Wolfgang Schuster
2024-07-23 19:13 ` alan.caruanambom
1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2024-07-23 18:45 UTC (permalink / raw)
To: mailing list for ConTeXt users, alan.caruanambom
alan.caruanambom@gmail.com schrieb am 23.07.2024 um 20:29:
> Hello, I need the background (lines and points) to be inside (tangent) of the frame, I don't know how to do it
>
> \startuseMPgraphic{fullheightbackground}
> fill unitsquare xyscaled (OverlayWidth, OverlayHeight) withcolor "gray" ;
>
> w := MakeupWidth;
> h := OverlayHeight;
>
> draw (0,0)--(MakeupWidth,0) withpen pencircle scaled 2pt withcolor green;
> draw (0,OverlayHeight)--(MakeupWidth,OverlayHeight) withpen pencircle scaled 2pt withcolor green;
Add offset value to the horizontal/vertical dimensions.
draw (0,1pt+OverlayLineWidth)--(MakeupWidth,1pt+OverlayLineWidth)
withpen pencircle scaled 2pt withcolor green;
draw
(0,OverlayHeight-1pt-OverlayLineWidth)--(MakeupWidth,OverlayHeight-1pt-OverlayLineWidth)
withpen pencircle scaled 2pt withcolor green;
> drawdot (0,0) withpen pencircle scaled 8pt withcolor red;
> drawdot (MakeupWidth,OverlayHeight) withpen pencircle scaled 8pt withcolor red;
Set a bounding box size for the image to ensure the image isn't
stretched to fill the available space.
setbounds currentpicture to OverlayBox;
> \stopuseMPgraphic
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: MetaPost background
2024-07-23 18:45 ` Wolfgang Schuster
@ 2024-07-23 19:13 ` alan.caruanambom
0 siblings, 0 replies; 4+ messages in thread
From: alan.caruanambom @ 2024-07-23 19:13 UTC (permalink / raw)
To: ntg-context
The frame is only for reference, what I need is that the background is not wider than or higher than the frame, changing the coordinates of the points can be done but I remember seeing an example in which using "shifted" it could be done move to a corner, without worrying about the coordinates or point size
\startuseMPgraphic{fullheightbackground}
fill unitsquare xyscaled (OverlayWidth, OverlayHeight) withcolor "gray" ;
w := MakeupWidth;
h := OverlayHeight;
draw (0,0)--(w,0) withpen pencircle scaled 2pt withcolor green;
draw (0,h)--(w,h) withpen pencircle scaled 2pt withcolor green;
drawdot (0,0) withpen pencircle scaled 8pt withcolor red;
drawdot (w,h) withpen pencircle scaled 8pt withcolor red;
\stopuseMPgraphic
\defineoverlay
[fullheightbackground]
[\useMPgraphic{fullheightbackground}]
\setupframedtexts
[background=fullheightbackground,
backgroundoffset=0pt,
frame=off]
\starttext
\startframedtext[width=\textwidth,align=left]
\input knuth
\stopframedtext
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-23 19:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-23 18:29 [NTG-context] MetaPost background alan.caruanambom
2024-07-23 18:43 ` [NTG-context] " Otared Kavian
2024-07-23 18:45 ` Wolfgang Schuster
2024-07-23 19:13 ` alan.caruanambom
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).