metafun images in MkII, but I don't
> know if that is really needed in LMTX. In most cases, metapost processing
> does not have a significant processing delay.
> if images are the same one can use the reuseMPgraphic or uniqueMPgraphic
> featu
if
that is really needed in LMTX. In most cases, metapost processing does not have
a significant processing delay.
if images are the same one can use the reuseMPgraphic or uniqueMPgraphic
features .. plenty of examples can be found, but as Aditya poined out mp
is quite fast (but reuse saves on file
cture cross;
> cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
> draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle
> scaled .8pt ;
> \stopuniqueMPgraphic
>
> \defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
>
> \define[1]\cancel{%
>
;
\stopuniqueMPgraphic
\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
\define[1]\cancel{%
\ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\fi%
}
Maybe something else is available nowadays
led 1mm ;
> drawoptions(withcolor .625yellow) ;
> draw llcorner p -- lrcorner p ;
> setbounds currentpicture to p ;
> \stopuniqueMPgraphic
>
> \defineoverlay[titled][\uniqueMPgraphic{titled}]
>
> \define[2]\ChapterCommand%
> {\setbox0=\hbox to \leftmarginwidth{#1\hss}
ght ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p -- lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\define[2]\ChapterCommand%
{\setbox0=\hbox to \leftmarginwidth{#1\hss}%
\hs
;
\stopuniqueMPgraphic
\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
\define[1]\cancel{%
\ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\fi%
}
\starttext
\dots E.g
scaled .8pt ;
\stopuniqueMPgraphic
\defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
\define[1]\cancel{%
\ifmmode
\mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\else%
\framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
\fi%
}
\starttext
ons scaled SCALE;
\stopuseMPgraphic
\startuseMPgraphic{HexGridBgGraphic}
% Define the grid background colour
color gridback;
gridback := (0.15, 0.18, 0.24);
fill unitsquare
xyscaled (OverlayWidth, OverlayHeight)
withcolor gridback;
\stopuseMPgraphic
\defineoverlay[HexGri
l.lft(100-s, (0, (s-2.5)*mm));
> > endfor;
> > \stopMPpage
> >
> > This used to work with previous LMTX versions.
> fixed in next upload
Is this related?
(regression: uniqueMPgraphic drops color)
\startuniqueMPgraphic{red}
draw textext("red?") withcolor red ;
\st
> > \startuniqueMPgraphic{concept}
> > draw fullcircle scaled 1cm shifted (10cm,10cm);
> > \stopuniqueMPgraphic
> > \defineoverlay[concept][\uniqueMPgraphic{concept}]
> > \setupbackgrounds[page][background=concept]
> > \starttext
> > .
> > \stoptext
> >
ay[concept][\uniqueMPgraphic{concept}]
\setupbackgrounds[page][background=concept]
\starttext
.
\stoptext
How should the metapost background figure be positioned correctly?
\startuniqueMPgraphic{concept}
StartPage;
draw fullcircle scaled 1cm shifted (10cm,10cm);
draw Page withpen
Dear List,
The following code draws a circle at the center of the page, ignoring the
"shifted" part.
\startuniqueMPgraphic{concept}
draw fullcircle scaled 1cm shifted (10cm,10cm);
\stopuniqueMPgraphic
\defineoverlay[concept][\uniqueMPgraphic{concept}]
\setupbackgrounds[page][backgrou
,0) -- (\MPvar{width},\MPvar{height}) ;
)
withpen pencircle scaled \MPvar{line}
withcolor \MPvar{color} ;
\stopuniqueMPgraphic
\definesymbol
[MyRedCross]
[\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=red,line=.2ex}]
\definesymbol
[MyGreenCross]
[\uni
context.stopxrow()
> end
> context.stopxtable()
>
> end
> \stopluacode
>
> \startuniqueMPgraphic{cross}{width,height,depth,color,line}
> draw image (
> draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ;
> draw (\MPvar{d
end
\stopluacode
\startuniqueMPgraphic{cross}{width,height,depth,color,line}
draw image (
draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ;
draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ;
)
withpen pencircle scaled \MPvar{line}
withcolor \MPv
entpicture to OverlayBox;
\stopuseMPgraphic
\defineoverlay[booktabs_bottom] [\uniqueMPgraphic{booktabs_bottom}]
\installbottomframerenderer{booktabs}{\uniqueMPgraphic{booktabs_bottom}}
\startsetups booktabs
\setupTABLE[each][each][frame=off, rulethickness=1.2bp]
\setupTABLE[row][first][topframe=
{blueShade}
draw lmt_shade [
path = fullsquare xyscaled (OverlayWidth,OverlayHeight) ,
direction = "up",
alternative = "linear",
colors = { "red", "blue" },
] ;
\stopuniqueMPgraphic
\defineoverlay [mybg] [\uniqueMPgraphic{blueShade
] ;
\stopuniqueMPgraphic
\defineoverlay [mybg] [\uniqueMPgraphic{blueShade}]
\setupbackgrounds [page] [background=mybg]
\starttext
\startMPpage
StartPage ;
% Result Left
draw lmt_shade [
path= unitsquare xscaled 2cm yscaled PaperHeight,
direction
=\paperheight] % let the layer cover the full paper
\startuniqueMPgraphic{blueShade}
draw lmt_shade [
path = fullsquare xyscaled(PaperWidth,PaperHeight),
direction = "up",
alternative = "linear",
colors = { "red", "blue" },
];
\stopuniqueMPgraphic
\s
OverlayWidth
yscaled 2.5 OverlayHeight ;
draw p withcolor red ;
setbounds currentpicture to p topenlarged 6mm ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
\bTR
\bTD[nx=2,align=middle,background=triangle] \dontleavehmode a\crlf
,
this MWE is a simplified version of a real case:
\startuseMPgraphic{cell:triangle}
path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth
yscaled 2.5 OverlayHeight ;
draw p withcolor red ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=of
;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
\bTR
\bTD[nx=2,background=triangle,align=middle] \dontleavehmode
a\crlf text \eTD
\eTR
\bTR[toffset=1mm]
\bTD left \eTD
\bTD right \eTD
\eTR
\eTABLE
\stoptext
][{\uniqueMPgraphic{cell:triangle}}]
\starttext
\bTABLE[frame=off]
\bTR
\bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf
text \eTD
\eTR
\bTR[toffset=1mm]
\bTD left \eTD
\bTD right \eTD
\eTR
\eTABLE
\stoptext
here's a very ugly solution
\startuseMPgraphic
Hello list,
this MWE is a simplified version of a real case:
\startuseMPgraphic{cell:triangle}
path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth
yscaled 2.5 OverlayHeight ;
draw p withcolor red ;
\stopuseMPgraphic
\defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle
} ) ;
\stopuniqueMPgraphic
\setupMPvariables
[meta:hash]
[gap=.25\bodyfontsize,
angle=45,
linewidth=\overlaylinewidth,
linecolor=\overlaylinecolor]
\def\metahashoverlay#1{\uniqueMPgraphic{meta:hash}{angle=#1}}
\defineoverlay[meta:hash:right]
[\metahashoverlay{ +45}]
\defineoverlay[meta:hash:left
][\uniqueMPgraphic{cancel}]
\defineframed[cancel]
[background=cancel,frame=off,offset=0pt,location=low]
\starttext
\startformula
6 \frac{3}{8} \div 4 \frac{1}{2} = \frac{27}{4} \div \frac{9}{2} =
\frac{\cancel{27}^3}{\cancel{4}^2} \times \frac{\cancel{2}^1}{\cancel{9}^1} =
\frac{3}{2} = 1 \frac{1}{2
phic{0}
fill fullcircle scaled 1cm withcolor red ;
\stopuniqueMPgraphic
\startuniqueMPgraphic{1}
fill fullcircle scaled 1cm withcolor green ;
\stopuniqueMPgraphic
\definesymbol[YES][\uniqueMPgraphic{1}]
\definesymbol[NOP][\uniqueMPgraphic{0}]
\setupfield[WHATEVER][width=20mm,height=20mm,fra
>
>> \definecolor[color-1][.5(red,green)]
>> \definecolor[color-2][.5(green,blue)]
>> \definecolor[color-3][.5(blue,red)]
>> \definecolor[color-4][.5(white,black)]
>> \definecolor[color-5][.5(white,color-4)]
>>
>> \startuniqueMPgraphic{frame}
>> fill O
ck)]
> \definecolor[color-5][.5(white,color-4)]
>
> \startuniqueMPgraphic{frame}
> fill OverlayBox withcolor \MPcolor{color-1} ;
> \stopuniqueMPgraphic
>
> \startuniqueMPgraphic{contrast}
> fill OverlayBox withcolor \MPcolor{color-2} ;
> \stopuniqueMPgraphic
>
>
} ;
\stopuniqueMPgraphic
\startuniqueMPgraphic{contrast}
fill OverlayBox withcolor \MPcolor{color-2} ;
\stopuniqueMPgraphic
\defineoverlay[frame] [\uniqueMPgraphic{frame}]
\defineoverlay[contrast][\uniqueMPgraphic{contrast}]
\definecolumnset[example][n=2]
%\setupcolumnsetstart[example][1][1][2
][\uniqueMPgraphic{column:bg}]
\definecolumnset[TOC][n=4]
%\setupcolumnset[TOC][background=columnbg]% works ok
\setupcolumnset[TOC][1][background=columnbg]% any indexed setup fails
% in my real world example the complete third argument is printed instead
\starttext
\startcolumnset[TOC]
\input tufte.tex
arbitrary
shapes, maybe even letters (like drop shadows e.g. in InDesign do).
\startuniqueMPgraphic{mpnewshadow}{offset}
MyOffset := \MPvar{offset} ;
...
... OverlayWidth ...
\defineoverlay[newshadow][\uniqueMPgraphic{mpnewshadow}{offset=.3em}]
you use unique graphics ... so you need to make
withcolor darkred ;
setbounds currentpicture to boundingbox p ;
\stopuniqueMPgraphic
\defineoverlay[half circle][\uniqueMPgraphic{half circle}]
\starttext
\framed[background=half circle,frame=off]{Text width half circle.}
\stoptext
Well, if you really want a tear down
darkred ;
setbounds currentpicture to boundingbox p ;
\stopuniqueMPgraphic
\defineoverlay[half circle][\uniqueMPgraphic{half circle}]
\starttext
\framed[background=half circle,frame=off]{Text width half circle.}
\stoptext
>
> My greatest problems seem to be in the e
linecap := squared ;
> > drawoptions(withcolor \MPcolor{darkred}) ;
> > draw ulcorner p -- urcorner p ;
> > setbounds currentpicture to p ;
> > \stopuniqueMPgraphic
> >
> > \defineoverlay[titled][\uniqueMPgraphic{titled}]
> >
> > \startuseMPgrap
caled \overlaywidth yscaled \overlayheight ;
> pickup pencircle scaled 1mm ;
> linecap := squared ;
> drawoptions(withcolor \MPcolor{darkred}) ;
> draw ulcorner p -- urcorner p ;
> setbounds currentpicture to p ;
> \stopuniqueMPgraphic
>
> \defineoverlay[titled
caled \overlaywidth yscaled \overlayheight ;
> pickup pencircle scaled 1mm ;
> linecap := squared ;
> drawoptions(withcolor \MPcolor{darkred}) ;
> draw ulcorner p -- urcorner p ;
> setbounds currentpicture to p ;
> \stopuniqueMPgraphic
>
> \defineoverlay[titled
scaled 1mm ;
linecap := squared ;
drawoptions(withcolor \MPcolor{darkred}) ;
draw ulcorner p -- urcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\startuseMPgraphic{triangledone}
fill lltriangle scaled 4cm withcolor darkred
encircle withcolor \MPcolor{red}) ;
>> draw .5[llcorner p, lrcorner p]--.5[ulcorner p, urcorner p] ;
>> setbounds currentpicture to p ;
>>
>> \stopuniqueMPgraphic
>>
>> \defineoverlay[Vertical][\uniqueMPgraphic{Vertical}]
>>
>> \startsetups[table:initi
t; linecap:=squared ;
> path p ; p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
> drawoptions (withpen pencircle withcolor \MPcolor{red}) ;
> draw .5[llcorner p, lrcorner p]--.5[ulcorner p, urcorner p] ;
> setbounds currentpicture to p ;
>
>\stopuniqueMPgraphic
[llcorner p, lrcorner p]--.5[ulcorner p, urcorner p] ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[Vertical][\uniqueMPgraphic{Vertical}]
\startsetups[table:initialize]
\setupTABLE[start]
[align={middle,lohi},offset=0.5ex,width=1.5cm,
foregroundstyle
Pcolor{\overlaycolor} ;
> draw p withcolor \MPcolor{\overlaylinecolor} ;
> \stopuniqueMPgraphic
> \setuplayout[grid=yes]
> \defineoverlay[MyBackgroundLayer][\uniqueMPgraphic{MyShape}]
>
> \define[1]\MyExoCommand{%
> \lower\strutdepth\hbox{\startframed
> [backgroun
pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
\setuplayout[grid=yes]
\defineoverlay[MyBackgroundLayer][\uniqueMPgraphic{MyShape}]
\define[1]\MyExoCommand{%
\lower\strutdepth
][\uniqueMPgraphic{MyShape}]
\define[1]\MyExoCommand{%
\startframed
[background=MyBackgroundLayer,
frame=off,
width=3cm,
backgroundcolor=darkred]
{\white Exercice #1}
\stopframed
mbering[location=footer]
>>
>> \startusableMPgraphic{NumberHead}
>> picture r ;
>> r := image ( graphictext
>> \MPstring{chapter}
>> scaled 4pt
>> withfillcolor \MPcolor{lightgray}
>> withpen pencircle scal
ad}
> picture r ;
> r := image ( graphictext
> \MPstring{chapter}
> scaled 4pt
> withfillcolor \MPcolor{lightgray}
> withpen pencircle scaled 1pt ; ) ;
> draw r ;
> \stopusableMPgraphic
>
> \defineoverlay[NumberHead
footer]
\startusableMPgraphic{NumberHead}
picture r ;
r := image ( graphictext
\MPstring{chapter}
scaled 4pt
withfillcolor \MPcolor{lightgray}
withpen pencircle scaled 1pt ; ) ;
draw r ;
\stopusableMPgraphic
\defineoverlay[NumberHead][\uniqueMPg
\defineoverlay[NumberHead][\uniqueMPgraphic{NumberHead}]
\def\processMPheadnumber#1%
{\setMPtext{chapter}{\bf#1}
\useMPgraphic{NumberHead}}
\unexpanded\def\HeadTitle#1#2%
{\framed
[frame=off,
bottomframe=on,
width=broad,
align={broad,nothyphenated,left}]
{#1\blank
1cm smoothed 1.2 ;
\stopuseMPgraphic
\defineoverlay[head][\uniqueMPgraphic{head}]
\def\Headed#1%
{\framed
[background=head,frame=off,offset=overlay]
{\color[white]{#1}}}
\unexpanded\def\HeadTitle#1#2%
{\framed
[frame=off,
bottomframe=on,
width=broad,
align={broad
xtBackground][\uniqueMPgraphic{TextBackground}]
\setuppapersize[A4]
\setuppagenumbering[state=none]
\setupbackgrounds[text][text][background=TextBackground]
\starttext
\input knuth
\stoptext
BTW: It’s rude to crosspost without mentioning this
(http://tex.stackexchange.com/questions/296037/is-t
currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\define[2]\ChapterCommand
{\setbox\scratchbox\hbox to \leftmarginwidth{#1\hss}%
\hskip-\dimexpr\leftmarginwidth+\leftmargindistance\relax
\framed
[background=titled,frame=off,offset=0pt]
{\box
:= unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p--lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\def\ChapterCommand#1#2
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\def\ChapterCommand#1#2%
{\setbox0=\hbox to \leftmarginwidth{#1\hss}%
\hskip-\leftmarginwidth
\hskip-\leftmargindistance
\framed
[background=titled,frame=off,offset=0pt]
{\box0
\hskip\leftmargindistance
#2}}
\setuphead
currentpicture to p ;
\stopuniqueMPgraphic
\defineoverlay[titled][\uniqueMPgraphic{titled}]
\def\ChapterCommand#1#2%
{\setbox0=\hbox to \leftmarginwidth{#1\hss}%
\hskip-\leftmarginwidth
\hskip-\leftmargindistance
\framed
[background=titled,frame=off,offset=0pt]
{\box0
p, q;
h := \overlayheight;
w := \overlaywidth;
% imagine this is more complex
p = (0, 0) -- (w, .5h);
q = (0, h) -- (w, 0);
draw p;
draw q;
z0 = p intersectionpoint q;
% btex \def\Z{ ypart z0 } etex;
\stopuniqueMPgraphic
\defineoverlay[canon][\uniqueMPgraphic
}{text2}{text3},
2. and four \Bolha[size=4cm]{text1}{text2}{text3}, but text1, text2 and
text3 is not updated in every call;
Use useMPgraphic instead of uniqueMPgraphic.
uniqueMPgraphic recomputes the graphic only when the dimensions of
figure has changed; otherwise, it reuses the previously drawn
below, If I have \startitemize[columns,two] then metapost
draw:
1. \Bolha[size=6cm]{text1}{text2}{text3},
2. and four \Bolha[size=4cm]{text1}{text2}{text3}, but text1, text2 and
text3 is not updated in every call;
Use useMPgraphic instead of uniqueMPgraphic.
uniqueMPgraphic recomputes
]{text1}{text2}{text3}, but text1, text2 and
text3 is not updated in every call;
Use useMPgraphic instead of uniqueMPgraphic.
uniqueMPgraphic recomputes the graphic only when the dimensions of figure
has changed; otherwise, it reuses the previously drawn graphic. This
behavior was useful
][\uniqueMPgraphic{borderline}]
\defineframedtext
[Myframed]
[width=0.6\textwidth,
foregroundstyle={\switchtobodyfont[10pt]},
align={high,flushleft},
frame=off,
framecolor=0.625white,
background=borderline,
location=middle,
offset=.5ex]
\starttext
\startbuffer
Ingrédients
=0.00, y=0.00, k=0.25]
\startuniqueMPgraphic{borderline}
path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic
\defineoverlay[borderline][\uniqueMPgraphic{borderline
\overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic
\defineoverlay[borderline][\uniqueMPgraphic{borderline}]
\startxtable[frame=off]
\startxrow
\startxcell[align=normal]
Compléter chacun des algorithmes ci-dessous afin qu'ils
;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic
\defineoverlay[borderline][\uniqueMPgraphic{borderline}]
\placefigure[right,none]{}{
\start
\switchtobodyfont[7pt]
\startMPcode
numeric u;
u=0.7cm;
z0=(0,0) ;
z1=(2.5u,0) ;
z2=(2.5u,2.5u) ;
z3
currentpicture to p ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=fit,
align={right},
framecolor
} ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=0.5\textwidth,
align={right},
framecolor=mycolor,
rulethickness=1.5pt,
backgroundcolor=white
withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
draw (20,0)--(20,h) withcolor red ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=0.5
;
\stopuniqueMPgraphic
\defineoverlay[line][{\uniqueMPgraphic{line}}]
and using it in \framed, but placing the line correctly is elusive.
Just a quick and dirty solution. The trick is to draw the extra line as
part of the graphic and then fake the boundingbox. This is also limited
to a few
;
\stopuniqueMPgraphic
\defineoverlay[line][{\uniqueMPgraphic{line}}]
and using it in \framed, but placing the line correctly is elusive.
Just a quick and dirty solution. The trick is to draw the extra line as
part of the graphic and then fake the boundingbox. This is also limited
to a few
][{\uniqueMPgraphic{line}}]
and using it in \framed, but placing the line correctly is elusive.
Look at chapter 5 in the metafun manual.
Wolfgang
___
If your question is of interest to others as well, please add an entry
of the rectangles? I have
played with:
\startuniqueMPgraphic{line}
path a;
a:=(0,0)--(0,3cm);
draw a withpen pencircle scaled 3pt withcolor green;
\stopuniqueMPgraphic
\defineoverlay[line][{\uniqueMPgraphic{line}}]
and using it in \framed, but placing the line correctly is elusive
\defineoverlay[whatever][\uniqueMPgraphic{whatever}]
\framed
[background=whatever,
backgroundcolor=green,
frame=off,
width=\textwidth]
{test}%
Thank you for this interesting solution! I didn’t know one could do
that with Metapost. This does
leftenlarged BackSpace
rightenlarged CutSpace
withcolor OverlayColor ;
setbounds currentpicture to OverlayBox
enlarged max(BackSpace,CutSpace) ;
\stopuniqueMPgraphic
\defineoverlay[whatever][\uniqueMPgraphic{whatever}]
\framed
] := (0.5, 0.8, 0.5) ;
path p ;
p := unitsquare scaled 2cm ;
for i=1 upto 3:
fill p shifted (i*2.5cm, 0) withcolor transparent
(1,0.3,mycolor[round(uniformdeviate(i))]) ;
endfor ;
\stopuniqueMPgraphic
\starttext
\uniqueMPgraphic{colortest}
\stoptext
Is there a better approach? The selection
) ;
mycolor[2] := (0.6, 0.6, 0.4) ;
mycolor[3] := (0.5, 0.8, 0.5) ;
path p ;
p := unitsquare scaled 2cm ;
for i=1 upto 3:
fill p shifted (i*2.5cm, 0) withcolor transparent
(1,0.3,mycolor[round(uniformdeviate(i))]) ; endfor ;
\stopuniqueMPgraphic
\starttext
\uniqueMPgraphic{colortest
=\CoeffBlue
]
\starttext
\uniqueMPgraphic{colortest}
\startcolor[RandomColor]\bf This is a RandomColor \stopcolor
\stoptext
Best regards: OK
On 19 févr. 2014, at 11:10, Schmitz Thomas A. thomas.schm...@uni-bonn.de
wrote:
Hi all,
I would like to have mp choose a (transparent) color randomly
currentpicture to boundingbox q;
\stopuniqueMPgraphic
\starttext
\ctxlua{metapost.showlog = true}
\uniqueMPgraphic{Dcaron}
\ctxlua{inspect(metapost.variables[Dcaron])}
\stoptext
___
If your question is of interest to others
, OverlayHeight) -- (OverlayWidth, OverlayHeight)
-- (OverlayWidth, 0) -- cycle withcolor OverlayLineColor;
\stopuniqueMPgraphic
%% Define Overlay for NassiSimpleFrameBox
%%
\defineoverlay[NassiSimpleFrameBox][\uniqueMPgraphic{NassiSimpleFrameBox
;
\stopuniqueMPgraphic
\defineoverlay[mytest][\uniqueMPgraphic{mytest}]
\startMPpage[offset=1pt]
fill fullcircle scaled 10cm withcolor red ;
draw textext(\framed[background=mytest]{bla}) ;
draw textext(test 1.1) xsized 8cm rotated 45 withcolor white/2 ;
draw
;
fill p withcolor green ;
\stopuniqueMPgraphic
\defineoverlay[mytest][\uniqueMPgraphic{mytest}]
\starttext
\framed[background=mytest]{this works}
\startFLOWchart[test]
\startFLOWcell
\name{test}
\text{test}
\connection[lr]{test}
% \comment[t:0.5]{\framed{this works}}
\comment[t
\defineoverlay[mytest][\uniqueMPgraphic{mytest}]
\starttext
\framed[background=mytest]{this works}
\startFLOWchart[test]
\startFLOWcell
\name{test}
\text{test}
\connection[lr]{test}
% \comment[t:0.5]{\framed{this works}}
\comment[t:0.5]{\framed[background=mytest]{bla
.
\startuniqueMPgraphic-\uniqueMPgraphic this graphic is calculated for each
distinctive case.
I fail to see in what respect startuseMPgraphic en startuniqueMPgraphic do
differ? Can someone please explain?
Hans van der Meer
-\reuseMPgraphic for graphics that don't change.
\startuniqueMPgraphic-\uniqueMPgraphic this graphic is calculated for each
distinctive case.
I fail to see in what respect startuseMPgraphic en startuniqueMPgraphic do
differ? Can someone please explain?
See:
http://www.mail-archive.com/ntg-context
:=\MPvar{unite}*cm ;
numeric n ; n:=\MPvar{sides};
rest of the code
\stopuniqueMPgraphic
\define[2]\polyreg
{\setupMPvariables[polygoneregulier][unite,sides]
\uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}}
You can define the command as
\define[2]\polyreg
{\setupMPvariables[polygoneregular
;
draw fullcircle scaled 6u withcolor blue;
\stopuniqueMPgraphic
%% \polyreg{number}
\define[1]\polyreg
{\setupMPvariables[polygoneregulier][sides=#1]%%
\uniqueMPgraphic{polygoneregulier}}
\starttext
\dontleavehmode
\dorecurse{9}{\polyreg\recurselevel\space}
\stoptext
You can extent
) ;
polygone[i]:=a[i-1]--a[i];
draw polygone[i]; endfor;
draw fullcircle scaled 6u withcolor blue;
\stopuniqueMPgraphic
%% \polyreg{number}
\define[1]\polyreg
{\setupMPvariables[polygoneregulier][sides=#1]%%
\uniqueMPgraphic{polygoneregulier}}
\starttext
\dontleavehmode
\dorecurse{9
(origin,i*360/n) ;
polygone[i]:=a[i-1]--a[i];
draw polygone[i]; endfor;
draw fullcircle scaled 6u withcolor blue;
\stopuniqueMPgraphic
%% \polyreg{number}
\define[1]\polyreg
{\setupMPvariables[polygoneregulier][sides=#1]%%
\uniqueMPgraphic{polygoneregulier}}
\define[1]\polyreg
:
a[i]:=a[0] rotatedaround(origin,i*360/n) ;
polygone[i]:=a[i-1]--a[i];
draw polygone[i]; endfor;
draw fullcircle scaled 6u withcolor blue;
\stopuniqueMPgraphic
%% \polyreg{number}
\define[1]\polyreg
{\setupMPvariables[polygoneregulier][sides=#1]%%
\uniqueMPgraphic{polygoneregulier}}
\define[1
};
rest of the code
\stopuniqueMPgraphic
\define[2]\polyreg
{\setupMPvariables[polygoneregulier][unite,sides]
\uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}}
You can define the command as
\define[2]\polyreg
{\setupMPvariables[polygoneregular][sides=#1,unite=#2]%
\uniqueMPgraphic
OverlayLineColor ;
\stopuniqueMPgraphic
\defineoverlay[LabelA][\uniqueMPgraphic{LabelA}]
\defineoverlay[LabelB][\uniqueMPgraphic{LabelB}]
\def\VariantA{\mframed[foregroundstyle=\tfc,frame=off,background=LabelA,backgroundoffset=3pt,backgroundcolor=red]}
\def\VariantB{\mframed[foregroundstyle=\tfc,frame
fullcircle scaled 1cm ;
\stopuniqueMPgraphic
\def\xxx{xx}
\useMPgraphic{x1}
\uniqueMPgraphic{x1}
\stoptext
this is seldom an issue, but for convenience I patched the definers and
resolvers so that the first argument gets expanded (next upload)
Hans
.8white;
\stopuniqueMPgraphic
\starttext
\defineoverlay[encadrement][\uniqueMPgraphic{essai}]
\framed[frame=off,background=encadrement]{\it\tfb\color[darkred]{Devoir de
mathématiques}}
\stoptext
___
If your question
';
pair B; B:=q intersectionpoint p';
pair C; C:=p intersectionpoint q;
pair D; D:=q'intersectionpoint p;
path s; s:= A--B--C--D--cycle;
fill s withcolor .8white;
\stopuniqueMPgraphic
\defineoverlay
[encadrement]
[\uniqueMPgraphic{essai}]
\defineframed
[boxframed]
[frame=off
On Tue, Feb 26, 2013 at 10:01 PM, Marco Patzer home...@lavabit.com wrote:
Hi Mikael,
your original example works for me with a current beta if you
replace uniqueMPgraphic with useMPgraphic.
Marco
___
If your
';
pair A; A:=q'intersectionpoint p';
pair B; B:=q intersectionpoint p';
pair C; C:=p intersectionpoint q;
pair D; D:=q'intersectionpoint p;
path s; s:= A--B--C--D--cycle;
fill s withcolor .8white;
\stopuniqueMPgraphic
\defineoverlay
[encadrement]
[\uniqueMPgraphic{essai}]
\defineframed
On Mon, Feb 18, 2013 at 10:53 AM, Marco Patzer home...@lavabit.com wrote:
On 2013–02–18 Mikael P. Sundqvist wrote:
Thank you Marco for giving a better example.
I thought that uniqueMPgraphic meant it was redrawn everytime while
useMPgraphic meant it was done once and then gave the same
On 2/26/2013 4:46 PM, Mikael P. Sundqvist wrote:
On Mon, Feb 18, 2013 at 10:53 AM, Marco Patzer home...@lavabit.com wrote:
On 2013–02–18 Mikael P. Sundqvist wrote:
Thank you Marco for giving a better example.
I thought that uniqueMPgraphic meant it was redrawn everytime while
useMPgraphic
On 2013–02–26 Hans Hagen wrote:
Hans, is this a bug? Has something changed?
I don't know .. no example
I provided an example in
http://www.ntg.nl/pipermail/ntg-context/2013/071552.html
However, it seems to be fixed in a recent beta. At least it works
for me.
Marco
signature.asc
Hi Mikael,
your original example works for me with a current beta if you
replace uniqueMPgraphic with useMPgraphic.
Marco
signature.asc
Description: Digital signature
___
If your question is of interest to others
/projects/contextrev/
wiki : http://contextgarden.net
___
Thank you Marco for giving a better example.
I thought that uniqueMPgraphic meant it was redrawn everytime while
useMPgraphic meant it was done once and then gave
On 2013–02–18 Mikael P. Sundqvist wrote:
Thank you Marco for giving a better example.
I thought that uniqueMPgraphic meant it was redrawn everytime while
useMPgraphic meant it was done once and then gave the same result
everytime used.
http://thread.gmane.org/gmane.comp.tex.context/79507
1 - 100 of 247 matches
Mail list logo