From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/53673 Path: news.gmane.org!not-for-mail From: Peter Rolf Newsgroups: gmane.comp.tex.context Subject: Re: How do you position/move a MPgraphic? Date: Sun, 25 Oct 2009 11:09:23 +0100 Message-ID: <4AE423D3.4080604@gmx.net> References: <4AE1674C.2010400@vicitra.se> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040303030907010305010703" X-Trace: ger.gmane.org 1256465382 24067 80.91.229.12 (25 Oct 2009 10:09:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2009 10:09:42 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 25 11:09:35 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1N202Z-0008J5-4g for gctc-ntg-context-518@m.gmane.org; Sun, 25 Oct 2009 11:09:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2189AC9AD9; Sun, 25 Oct 2009 11:08:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id b+4cF6oANTB6; Sun, 25 Oct 2009 11:08:27 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C81E0C9AAF; Sun, 25 Oct 2009 11:08:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D0402C9AAF for ; Sun, 25 Oct 2009 11:08:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id epJTCJddRZcC for ; Sun, 25 Oct 2009 11:08:22 +0100 (CET) Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by balder.ntg.nl (Postfix) with SMTP id EEC8BC9AAA for ; Sun, 25 Oct 2009 11:08:21 +0100 (CET) Original-Received: (qmail invoked by alias); 25 Oct 2009 10:09:25 -0000 Original-Received: from i577BE568.versanet.de (EHLO [192.168.1.3]) [87.123.229.104] by mail.gmx.net (mp066) with SMTP; 25 Oct 2009 11:09:25 +0100 X-Authenticated: #24293357 X-Provags-ID: V01U2FsdGVkX1+iG88ceOmiI8H05AYBOuBcAuRv1JNjh3EMf1zvFI jXVL91HrkmaVgZ User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <4AE1674C.2010400@vicitra.se> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.57,0.6 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:53673 Archived-At: This is a multi-part message in MIME format. --------------040303030907010305010703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > --------------040303030907010305010703 Content-Type: text/plain; name="test.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="test.tex" \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 --------------040303030907010305010703 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --------------040303030907010305010703--