ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: ntg-context@ntg.nl
Subject: Re: drawarrow and transparency
Date: Thu, 03 May 2012 16:09:35 +0200	[thread overview]
Message-ID: <4FA2919F.6090906@gmx.net> (raw)
In-Reply-To: <20120503123247.7592251f@sole.extra.cea.fr>

Hi Alan,

Am 03.05.2012 12:32, schrieb Alan BRASLAU:
> On Wed, 2 May 2012 21:42:24 +0200
> Marco <netuse@lavabit.com> wrote:
> 
>> On 2012-05-02 Alan BRASLAU <alan.braslau@cea.fr> wrote:
>>
>>> For  example, in  the minimal  example below,  how can  one obtain
>>> a  transparent  arrow  without  getting an  X-ray  vision  of  the
>>> arrowhead?
>>
>> Maybe I'm  reinventing the  wheel here,  but you  can write  a small
>> macro that only draws the lines you want. Here is an idea:
>>
>> \starttext
>> \startMPpage
>>
>> 	linecap  := squared;
>> 	penscale := .5bp;
>> 	pickup pencircle scaled penscale;
>>
>> 	def drawmyarrow expr p = _apth:=p; _myfinarr enddef;
>> 	def _myfinarr text t =
>> 		draw _apth cutafter point (-ahlength+.1penscale) on
>> _apth t; fill arrowhead _apth  t
>> 	enddef;
>>
>> 	drawarrow   origin    -- (1cm,0)     withtransparency(1,.5) ;
>> 	drawarrow   origin    -- (0,1cm)     withtransparency(1,.5) ;
>> 	drawmyarrow (1.5cm,0) -- (2.5cm,0)   withtransparency(1,.5) ;
>> 	drawmyarrow (1.5cm,0) -- (1.5cm,1cm) withtransparency(1,.5) ;
>>
>> \stopMPpage
>> \stoptext
>>
>> The (-ahlength+.1penscale)  are of  course empiric. You  should find
>> the correct  formula to always have  a nice match of  line and arrow
>> whatever ahlength and ahangle values are in use.
>>
>> Marco
> 
> Yes, this is somewhat reinventing the wheel.
> 
> I believe that this is somewhat a bug with transparency under MetaFun.
> For I tried the following:
> 
> \startMPcode
> 	picture pic ; pic := image(drawarrow origin--(1cm,0)) ;
>

isn't 'image()' a fixed graphic? the only difference from normal drawing
is, that the stuff is not added to 'currentpicture'. think of it more
like a stamp, that is used to create identical copies.

anyhow, it's probably better and cleaner to use a macro here...

> 	draw pic withtransparency(1,.5) ;
> 	draw pic rotated 90 withtransparency(1,.5) ;
> \stopMPcode
> 
> Here, the arrowhead is totally opaque and only the "stem"
> has transparency. Something is fishy.
> 
> Alan

what you want (if i understand you right) is a non-isolated 'knockout
group'. see 'PLATE 17'**, page 1147, in the pdf reference 1.7 for an
example.

currently no grouping (objects are in the same transparency group) is
supported in metafun.
the only possible way to create such a graphic is to use the tikz module
(search for 'transparency group' in the tikz manual).


hope that helps,

Peter


** the complete graphic is a fake, because all of its parts are opaque,
pixel based graphics; not a single vector graphic, no transparency at
all! what a joke :-D
maybe adobe doesn't trust other (or their own) pdf viewers to show the
right result!?
___________________________________________________________________________________
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
___________________________________________________________________________________


  parent reply	other threads:[~2012-05-03 14:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 15:35 Alan BRASLAU
2012-05-02 19:42 ` Marco
2012-05-03 10:32   ` Alan BRASLAU
2012-05-03 12:47     ` Rogers, Michael K
2012-05-03 14:09     ` Peter Rolf [this message]
2012-05-05  9:19 ` Hans Hagen

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=4FA2919F.6090906@gmx.net \
    --to=indiego@gmx.net \
    --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).