ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Garulfo <garulfo@azules.eu>
To: ntg-context@ntg.nl
Subject: Re: MetaFun - "remove the paths of text" from a rectangle to let the background visible
Date: Thu, 24 Dec 2020 18:04:08 +0100	[thread overview]
Message-ID: <45caca3b-d3a5-bb5d-49f7-ede450292d82@azules.eu> (raw)
In-Reply-To: <00ED4FB6-675E-40BC-88EB-AABD34E1F9FA@elvenkind.com>

Much more lean now thanks to your feedbacks.

I prefered to "remove the shapes of the letter"
rather than doubling the shading.


Wikified https://wiki.contextgarden.net/Cover_Pages#.22Empty.22_letters





\definecolor [ColorHighA] [h=c4a000]
\definecolor [ColorHighB] [h=602217]
\definecolor [ColorLow] [0.8(white)]

\startMPpage

%------------------------------------------------------------------------------ 


   picture tt ;
   tt := lmt_outline [
         kind = "fillup",
         text = "\definedfont[name:texgyrepagellabold*default]%
                 \framed[frame=off,offset=3mm,align=middle,strut=none]
                 {MetaPost\\is Fun !\\Aujourd'hui\\Today\\*§ 2020 §*}",
     ] xsized 12cm ;

   path bb ; bb := boundingbox tt;

%------------------------------------------------------------------------------ 


   path pp ; pp := bb enlarged 2cm ;
   fill pp
        withshademethod "linear"
        withshadedirection (2.,0.)
        withshadecolors (\MPcolor{ColorHighA}, \MPcolor{ColorHighB});

%------------------------------------------------------------------------------ 


   picture Paddmissing; Paddmissing := nullpicture;
   picture Pwoletters; Pwoletters := nullpicture;
   numeric testwithin ;

%------------------------------------------------------------------------------ 


   for i within tt :

     if stroked i or filled i :
       testwithin :=0;

       for j within tt :
         if stroked j or filled j:
           if (((xpart llcorner i) > (xpart llcorner j)) and
               ((ypart llcorner i) > (ypart llcorner j)) and
               ((xpart urcorner i) < (xpart urcorner j)) and
               ((ypart urcorner i) < (ypart urcorner j))) :
               testwithin :=1;
           fi;
         fi;
       endfor;

       if testwithin == 1:
         addto Paddmissing contour
               (pathpart i)
               withcolor \MPcolor{ColorLow};
       else:
         addto Pwoletters contour
               (pathpart i)
               withpostscript "collect";
       fi;

     fi ;
   endfor ;

%------------------------------------------------------------------------------ 


   addto Pwoletters contour
         bb
         withpostscript "evenodd"
         withcolor \MPcolor{ColorLow};
   draw Pwoletters ;
   draw Paddmissing ;

\stopMPpage
___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2020-12-24 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 15:09 Garulfo
2020-12-21 15:29 ` Taco Hoekwater
2020-12-23 23:14   ` Garulfo
2020-12-23 23:46     ` Otared Kavian
2020-12-24  0:42       ` Hans Hagen
2020-12-23 23:58     ` Hans Hagen
2020-12-24  9:02     ` Taco Hoekwater
2020-12-24 17:04       ` Garulfo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45caca3b-d3a5-bb5d-49f7-ede450292d82@azules.eu \
    --to=garulfo@azules.eu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).