ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* insert natural table at the top left of some png
@ 2018-10-15 18:11 Damien Thiriet
  2018-10-15 21:15 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Thiriet @ 2018-10-15 18:11 UTC (permalink / raw)
  To: ntg-context

Hello,

I am still working on maps and facing some new issue.
The program I used to design one map is not convenient for writing key
to symbols, and what I have is a map.png file with big spare space on
its upper left corner.
So I have either to write on the png with ImageMagick or GIMP, 
or have a nicer output with ConTeXt.

I wrote this legend file.

\definecolor[canaux][h=81b3e0]

\startreusableMPgraphic{voies}
path p; p:= (0,0) -- (20,0) ;
drawarrow p withcolor black ;
\stopreusableMPgraphic

\startreusableMPgraphic{canaux}
path p; p:= (0,0) -- (20,0) ;
drawarrow p withcolor \MPcolor{canaux} withpen pencircle scaled 2pt;
\stopreusableMPgraphic


\startbuffer
\bTABLE[frame=off] 
\setupTABLE[column][1,3][align={middle,lohi}]
\bTR
   \bTH 1) \eTH \bTH Le milieu \eTH \bTH 2) \eTH \bTH Les activités \eTH
\eTR
\bTR
   \bTD \externalfigure[illustrations/zone_urbaine][height=12bp] \eTD \bTD zones urbaines \eTD 
\eTR
\bTR 
   \bTD \leavevmode \reuseMPgraphic{voies} \eTD \bTD infrastructures~: voies ferrées \eTD 
\eTR
\bTR 
   \bTD \leavevmode \reuseMPgraphic{canaux} \eTD \bTD infrastructures~: canaux \eTD
\eTR
eTR
\eTABLE
\stopbuffer

The idea was to make some 
\hbox{
  \externalfigure[map][width=0.9 \textwidth]
  \vbox{\hfill -0.9 \textwidth 
     \getbuffer
     }
}

to put the boxed legend at this upper left corner.
Of course I couldn't succeed, since I do not understand so much
boxes. ConTeXt complains with a missing number.

How could I achieve such boxing ?

Thanks,


Damien Thiriet 


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: insert natural table at the top left of some png
  2018-10-15 18:11 insert natural table at the top left of some png Damien Thiriet
@ 2018-10-15 21:15 ` Hans Hagen
  2018-10-16  5:46   ` Damien Thiriet
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2018-10-15 21:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Damien Thiriet

On 10/15/2018 8:11 PM, Damien Thiriet wrote:
> Hello,
> 
> I am still working on maps and facing some new issue.
> The program I used to design one map is not convenient for writing key
> to symbols, and what I have is a map.png file with big spare space on
> its upper left corner.
> So I have either to write on the png with ImageMagick or GIMP,
> or have a nicer output with ConTeXt.
> 
> I wrote this legend file.
> 
> \definecolor[canaux][h=81b3e0]
> 
> \startreusableMPgraphic{voies}
> path p; p:= (0,0) -- (20,0) ;
> drawarrow p withcolor black ;
> \stopreusableMPgraphic
> 
> \startreusableMPgraphic{canaux}
> path p; p:= (0,0) -- (20,0) ;
> drawarrow p withcolor \MPcolor{canaux} withpen pencircle scaled 2pt;
> \stopreusableMPgraphic
> 
> 
> \startbuffer
> \bTABLE[frame=off]
> \setupTABLE[column][1,3][align={middle,lohi}]
> \bTR
>     \bTH 1) \eTH \bTH Le milieu \eTH \bTH 2) \eTH \bTH Les activités \eTH
> \eTR
> \bTR
>     \bTD \externalfigure[illustrations/zone_urbaine][height=12bp] \eTD \bTD zones urbaines \eTD
> \eTR
> \bTR
>     \bTD \leavevmode \reuseMPgraphic{voies} \eTD \bTD infrastructures~: voies ferrées \eTD
> \eTR
> \bTR
>     \bTD \leavevmode \reuseMPgraphic{canaux} \eTD \bTD infrastructures~: canaux \eTD
> \eTR
> eTR
> \eTABLE
> \stopbuffer
> 
> The idea was to make some
> \hbox{
>    \externalfigure[map][width=0.9 \textwidth]
>    \vbox{\hfill -0.9 \textwidth
>       \getbuffer
>       }
> }
> 
> to put the boxed legend at this upper left corner.
> Of course I couldn't succeed, since I do not understand so much
> boxes. ConTeXt complains with a missing number.
> 
> How could I achieve such boxing ?

\definecolor[canaux][h=81b3e0]

\startreusableMPgraphic{voies}
     drawarrow
         (0,0) -- (20,0)
         withcolor black ;
\stopreusableMPgraphic

\startreusableMPgraphic{canaux}
     drawarrow
         (0,0) -- (20,0)
         withcolor \MPcolor{canaux} withpen pencircle scaled 2pt;
\stopreusableMPgraphic

\startbuffer[legend]
     \bTABLE[frame=off]
         \bTR
            \bTH 1) \eTH \bTH Le milieu \eTH \bTH 2) \eTH \bTH Les 
activités \eTH
         \eTR
         \bTR
             \bTD
                 \externalfigure[t:/sources/mill.png][height=12bp]
             \eTD
             \bTD
                 zones urbaines
             \eTD
         \eTR
         \bTR
             \bTD
                 \inframed[frame=off,offset=0pt]{\reuseMPgraphic{voies}}
             \eTD
             \bTD
                 infrastructures~: voies ferrées
             \eTD
         \eTR
         \bTR
            \bTD
                 \inframed[frame=off,offset=0pt]{\reuseMPgraphic{canaux}}
             \eTD
             \bTD
                 infrastructures~: canaux
             \eTD
         \eTR
     \eTABLE
\stopbuffer

\definelayer
   [legend]
   [width=\overlaywidth,
    height=\overlayheight]

\starttext

%     \setlayer
%       [legend]
%       {\getbuffer[legend]}

     \setlayerframed
       [legend]
       [background=color,
        backgroundoffset=2pt,
        backgroundcolor=red,
        strut=no,
        frame=off]
       {\getbuffer[legend]}

     \externalfigure
       [t:/sources/cow.pdf]
       [background={foreground,legend},
        width=0.9\textwidth]

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: insert natural table at the top left of some png
  2018-10-15 21:15 ` Hans Hagen
@ 2018-10-16  5:46   ` Damien Thiriet
  0 siblings, 0 replies; 3+ messages in thread
From: Damien Thiriet @ 2018-10-16  5:46 UTC (permalink / raw)
  To: Hans Hagen, ntg-context

Thank you very much Hans !
One of my first thoughts today was using layers (did not think about
it earlier, because I was too focused on plain TeX boxes), but I am
quite new to this topic.
Thanks to your code, I will have time to learn how to use them.

Greetings,


Damien Thiriet

On Mon, Oct 15, 2018 at 11:15:00PM +0200, Hans Hagen wrote:
 
> \definecolor[canaux][h=81b3e0]
> 
> \startreusableMPgraphic{voies}
>     drawarrow
>         (0,0) -- (20,0)
>         withcolor black ;
> \stopreusableMPgraphic
> 
> \startreusableMPgraphic{canaux}
>     drawarrow
>         (0,0) -- (20,0)
>         withcolor \MPcolor{canaux} withpen pencircle scaled 2pt;
> \stopreusableMPgraphic
> 
> \startbuffer[legend]
>     \bTABLE[frame=off]
>         \bTR
>            \bTH 1) \eTH \bTH Le milieu \eTH \bTH 2) \eTH \bTH Les
> activités \eTH
>         \eTR
>         \bTR
>             \bTD
>                 \externalfigure[t:/sources/mill.png][height=12bp]
>             \eTD
>             \bTD
>                 zones urbaines
>             \eTD
>         \eTR
>         \bTR
>             \bTD
>                 \inframed[frame=off,offset=0pt]{\reuseMPgraphic{voies}}
>             \eTD
>             \bTD
>                 infrastructures~: voies ferrées
>             \eTD
>         \eTR
>         \bTR
>            \bTD
>                 \inframed[frame=off,offset=0pt]{\reuseMPgraphic{canaux}}
>             \eTD
>             \bTD
>                 infrastructures~: canaux
>             \eTD
>         \eTR
>     \eTABLE
> \stopbuffer
> 
> \definelayer
>   [legend]
>   [width=\overlaywidth,
>    height=\overlayheight]
> 
> \starttext
> 
> %     \setlayer
> %       [legend]
> %       {\getbuffer[legend]}
> 
>     \setlayerframed
>       [legend]
>       [background=color,
>        backgroundoffset=2pt,
>        backgroundcolor=red,
>        strut=no,
>        frame=off]
>       {\getbuffer[legend]}
> 
>     \externalfigure
>       [t:/sources/cow.pdf]
>       [background={foreground,legend},
>        width=0.9\textwidth]
> 
> \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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-10-16  5:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 18:11 insert natural table at the top left of some png Damien Thiriet
2018-10-15 21:15 ` Hans Hagen
2018-10-16  5:46   ` Damien Thiriet

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