ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Stand-alone Graphic
@ 2001-10-16 13:27 Arun Mangalam
  2001-10-16 16:20 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Arun Mangalam @ 2001-10-16 13:27 UTC (permalink / raw)


Hello,

While I was reading the Metafun manual, I found I could create a 
MetaPost-based stand-alone pdf graphic [with the appropriate bounding 
box] using

   \startMPpage
   ...
   \stopMPpage

My question is: is it possible and, if so, how do I create a stand-alone 
pdf graphic for other graphics within ConTeXt? For example, I would like 
to create a stand-alone graphic for the following code [instead of a PDF 
page]:
     \startbuffer[sample]
         \framed
             [align=middle,width=4cm,background=screen,frame=off]
             {A \METAPOST\ clip is not the same as a video clip, although 
we can use
              \METAPOST\ to produce a video clip.}
     \stopbuffer
     \startMPclip{text clip}
         clip currentpicture to fullcircle shifted (.5,.5)
             xscaled \width yscaled \height ;
     \stopMPclip
     \startuseMPgraphic{clip outline}
         draw fullcircle
             xscaled \overlaywidth yscaled \overlayheight
             withpen pencircle scaled 4mm
             withcolor .625red ;
     \stopuseMPgraphic
     \starttext
     \defineoverlay[clip outline][\useMPgraphic{clip outline}]
     \placefigure
         [here][fig:clipped text 2]
         {A clipped buffer (text).}
         {\framed
             [background=clip outline,offset=overlay,frame=off]
             {\clip
                 [nx=1,ny=1,mp=text clip]
                 {\externalfigure[sample][type=buffer,width=4cm]}}}
     \stoptext

As you can see, the above is also from the MetaFun manual. :) ConTeXt 
becomes better and better the more I find out about it.

Thank you for any help.

- Arun

PS. The reason for my question is, that I want to see if I can create an 
MacOSX graphical program like xfig that uses ConTeXt. It would be both 
educational for me in terms of understanding the Cocoa framework as well 
as improve my understanding of ConTeXt.


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

* Re: Stand-alone Graphic
  2001-10-16 13:27 Stand-alone Graphic Arun Mangalam
@ 2001-10-16 16:20 ` Hans Hagen
  2001-10-16 20:04   ` Arun Mangalam
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2001-10-16 16:20 UTC (permalink / raw)
  Cc: ConTeXt mailing list

At 09:27 AM 10/16/2001 -0400, Arun Mangalam wrote:

>My question is: is it possible and, if so, how do I create a stand-alone 
>pdf graphic for other graphics within ConTeXt? For example, I would like 
>to create a stand-alone graphic for the following code [instead of a PDF page]:

\startTEXpage[scale=4000,offset=3pt]
Let me show you a little secret!
\stopTEXpage

 From this you can deduce that there is a general underlaying mechanism at 
work -)

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: Stand-alone Graphic
  2001-10-16 16:20 ` Hans Hagen
@ 2001-10-16 20:04   ` Arun Mangalam
  0 siblings, 0 replies; 3+ messages in thread
From: Arun Mangalam @ 2001-10-16 20:04 UTC (permalink / raw)
  Cc: ConTeXt mailing list

That is totally awesome! It works except that there is some extra space 
to the left of the picture [not really a problem]. Thanks a lot! :)

The code is now [with a nice clipped Escher picture] and it works:

\setupcolors[state=start]

\startMPclip{text clip}
	clip currentpicture to fullcircle shifted (.5,.5)
		xscaled \width yscaled \height ;
\stopMPclip

\startuseMPgraphic{clip outline}
	draw fullcircle
		xscaled \overlaywidth yscaled \overlayheight
		withpen pencircle scaled 3mm
		withcolor .625red ;
\stopuseMPgraphic

\defineoverlay
	[clip outline]
	[\useMPgraphic{clip outline}]

\starttext
	\startTEXpage[scale=3000,offset=5pt]
		{\framed
			[background=clip outline,offset=overlay,frame=off]
			{\clip
				[nx=1,ny=1,mp=text clip]
				{\externalfigure[escher_ascending][type=jpg,width=3cm,height=3cm]}}}
	\stopTEXpage
\stoptext

On Tuesday, October 16, 2001, at 12:20 PM, Hans Hagen wrote:

> At 09:27 AM 10/16/2001 -0400, Arun Mangalam wrote:
>
>
>> My question is: is it possible and, if so, how do I create a 
>> stand-alone pdf graphic for other graphics within ConTeXt? For 
>> example, I would like to create a stand-alone graphic for the 
>> following code [instead of a PDF page]:
>
> \startTEXpage[scale=4000,offset=3pt]
> Let me show you a little secret!
> \stopTEXpage
>
> From this you can deduce that there is a general underlaying mechanism 
> at work -)
>
> Hans


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

end of thread, other threads:[~2001-10-16 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-16 13:27 Stand-alone Graphic Arun Mangalam
2001-10-16 16:20 ` Hans Hagen
2001-10-16 20:04   ` Arun Mangalam

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