ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How do you position/move a MPgraphic?
@ 2009-10-23  8:20 Daniel Bundzik
  2009-10-25  9:49 ` Taco Hoekwater
  2009-10-25 10:09 ` Peter Rolf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Bundzik @ 2009-10-23  8:20 UTC (permalink / raw)
  To: ntg-context

Hi!

How do you position/move a MPgraphic?

Let us us say that you have the MPgraphics "somebackground" and 
"somecolorcircle" (See example below). These MPgraphics are both framed 
and used as a background,  upon which "sometext" is written on. How can 
you freely move or position "somecolorcircle"? ( I want to move 
"somecolorcircle" below "sometext") Naturally, I have read Metafun and 
tried "shifted (x,y)", \definelayer, \setlayer, register, \setMPlayer, 
\getMPlayer...

In general, if you have defined two or more MPgraphics how do you 
position them (In my case "somebackground" is fixed while 
"somecolorcircle" could be anywhere on "somebackground")?

How would you solve this?

Regards,
Daniel

\setupcolors[state=start]
\setuppapersize[S6][S6]
\setuplayout [width=fit,
rightmargin=0cm,
leftmargin=0cm,
leftmargindistance=0pt,
rightmargindistance=0pt,
height=fit,
topspace=0cm,
header=0pt,
footer=0cm,
bottomspace=0cm,
backspace=0cm,
location=singlesided]

\definecolor[Orange][r=1.,g=.47,b=.0] % dark orange
\setupinteractionscreen[option=max]

\startbuffer[sometext]
\switchtobodyfont[sansserif,1.0cm]
\midaligned{\white \bf This is the text}
\stopbuffer

\starttext

\startuseMPgraphic{somebackground}
    fill fullsquare
        scaled 10cm
        withcolor .625red ;
    fill fullsquare
        scaled 10cm
        shifted (10cm,0)
        withcolor black ;
    fill fullsquare
        scaled 10cm
        shifted (20cm,0)
        withcolor \MPcolor{Orange} ;
    currentpicture := currentpicture 
xysized(OverlayWidth+.5pt,OverlayHeight+.5pt) ;
\stopuseMPgraphic

\startuseMPgraphic{somecolorcircle} % How do you move "somecolorcircle". 
I want this to be below "sometext"
    colorcircle(2cm,white,.625red,\MPcolor{Orange}) ;
\stopuseMPgraphic

\startTEXpage

\defineoverlay[somebackground][\useMPgraphic{somebackground}]
\defineoverlay[somecolorcircle][\useMPgraphic{somecolorcircle}]

\framed
  [background={somebackground,somecolorcircle},height=12cm,frame=off]
  {\getbuffer[sometext] }

\stopTEXpage

\stoptext
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How do you position/move a MPgraphic?
  2009-10-23  8:20 How do you position/move a MPgraphic? Daniel Bundzik
@ 2009-10-25  9:49 ` Taco Hoekwater
  2009-10-25 10:09 ` Peter Rolf
  1 sibling, 0 replies; 3+ messages in thread
From: Taco Hoekwater @ 2009-10-25  9:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Daniel Bundzik wrote:
> Hi!
> 
> How do you position/move a MPgraphic?

You move the graphic inside the overlay:

\defineoverlay
   [somecolorcircle]
   [\vbox{\kern 5cm\useMPgraphic{somecolorcircle}}]

Best wishes,
Taco
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How do you position/move a MPgraphic?
  2009-10-23  8:20 How do you position/move a MPgraphic? Daniel Bundzik
  2009-10-25  9:49 ` Taco Hoekwater
@ 2009-10-25 10:09 ` Peter Rolf
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2009-10-25 10:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

Daniel Bundzik schrieb:
> Hi!
>
> How do you position/move a MPgraphic?
>
> Let us us say that you have the MPgraphics "somebackground" and 
> "somecolorcircle" (See example below). These MPgraphics are both 
> framed and used as a background,  upon which "sometext" is written on. 
> How can you freely move or position "somecolorcircle"? ( I want to 
> move "somecolorcircle" below "sometext") Naturally, I have read 
> Metafun and tried "shifted (x,y)", \definelayer, \setlayer, register, 
> \setMPlayer, \getMPlayer...
>
> In general, if you have defined two or more MPgraphics how do you 
> position them (In my case "somebackground" is fixed while 
> "somecolorcircle" could be anywhere on "somebackground")?
>
Hi Daniel,

I attached a working example which uses layers. You should take a look 
at the 'details.pdf' manual; link and more information can be found on
http://wiki.contextgarden.net/Layers

Just play around with the layer parameters and see what happens.
'height/width' (for layer definition), 'corner/location' (important to 
understand!) and 'x/y' should be sufficient for most needs. 
'hoffset/voffset' can be handy too, if you want relative positioning.


[pack-lyr.mkii]

\def\dodefinelayer[#1][#2]% \zeropoint ipv \!!zeropoint
  {\setuplayer
     [#1]
     [\c!doublesided=,\c!preset=,
      \c!state=\v!start,\c!direction=\v!normal,\c!option=,
      \c!x=\zeropoint,\c!y=\zeropoint,\c!position=\v!no,
      \c!line=0,\c!column=0,
      \c!width=\nextboxwd,\c!height=\nextboxht,
      \c!offset=\zeropoint,\c!rotation=, % geen 0 !
      \c!hoffset=\zeropoint,\c!voffset=\zeropoint,
      \c!dx=\zeropoint,\c!dy=\zeropoint,
      \c!location=rb,\c!position=\v!no,\c!page=,
      \c!method=\v!overlay,
      \c!sx=1,\c!sy=1,\c!corner=,#2]%
   \doifvalue{\??ll#1\c!doublesided}\v!yes
     {\dopresetlayerbox{\v!left #1}%
      \dopresetlayerbox{\v!right#1}}%
   \dopresetlayerbox{#1}%
   \defineoverlay[#1][\composedlayer{#1}]}


Best wishes,  Peter

> How would you solve this?
>
> Regards,
> Daniel
>


[-- Attachment #2: test.tex --]
[-- Type: text/plain, Size: 1265 bytes --]

\setupcolors[state=start]
\setuppapersize[S6][S6]
\setuplayout [width=fit,
rightmargin=0cm,
leftmargin=0cm,
leftmargindistance=0pt,
rightmargindistance=0pt,
height=fit,
topspace=0cm,
header=0pt,
footer=0cm,
bottomspace=0cm,
backspace=0cm,
location=singlesided]

\definecolor[Orange][r=1.,g=.47,b=.0] % dark orange
\setupinteractionscreen[option=max]

\startbuffer[sometext]
\switchtobodyfont[sansserif,1.0cm]
\midaligned{\white \bf This is the text}
\stopbuffer

\starttext

\startuseMPgraphic{somebackground}
   fill fullsquare
       scaled 10cm
       withcolor .625red ;
   fill fullsquare
       scaled 10cm
       shifted (10cm,0)
       withcolor black ;
   fill fullsquare
       scaled 10cm
       shifted (20cm,0)
       withcolor \MPcolor{Orange} ;
   currentpicture := currentpicture xysized(OverlayWidth+.5pt,OverlayHeight+.5pt) ;
\stopuseMPgraphic

\startuseMPgraphic{somecolorcircle}
   colorcircle(2cm,white,.625red,\MPcolor{Orange}) ;
\stopuseMPgraphic

\startTEXpage


\definelayer[somelayer]%[width=600pt,height=450pt]

\setlayer[somelayer]
{\useMPgraphic{somebackground}}

\setlayer[somelayer][x=9.6cm,y=7.5cm]
{\useMPgraphic{somecolorcircle}}

\setlayer[somelayer][y=6cm]
{\getbuffer[sometext]}

\flushlayer[somelayer]

\stopTEXpage

\stoptext

[-- Attachment #3: Type: text/plain, Size: 486 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-25 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-23  8:20 How do you position/move a MPgraphic? Daniel Bundzik
2009-10-25  9:49 ` Taco Hoekwater
2009-10-25 10:09 ` Peter Rolf

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).