ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco Patzer <lists@homerow.info>
To: ntg-context@ntg.nl
Subject: Re: Shading to transparent using withshademethod
Date: Thu, 28 Jan 2016 19:09:50 +0100	[thread overview]
Message-ID: <20160128190950.5cec1cf9@homerow> (raw)
In-Reply-To: <56AA4F44.4060709@wxs.nl>

On Thu, 28 Jan 2016 18:26:28 +0100
Hans Hagen <pragma@wxs.nl> wrote:

> On 1/28/2016 3:34 PM, Marco Patzer wrote:
> > On Thu, 28 Jan 2016 14:45:13 +0100
> > Hans Hagen <pragma@wxs.nl> wrote:
> >  
> >> On 1/28/2016 1:53 PM, Marco Patzer wrote:  
> >>> On Thu, 28 Jan 2016 12:33:39 +0100
> >>> Hans Hagen <pragma@wxs.nl> wrote:
> >>>  
> >>>>>>> How to make transparent shadings work with the new
> >>>>>>> mechanism?  
> >>>>>>
> >>>>>>           withtransparency (1,.5)  
> >>>>>
> >>>>> However, this makes the entire shade transparent. How to shade
> >>>>> from one colour to transparent using withtransparency to achieve
> >>>>> an effect like in the example below?  
> >>>>
> >>>> that isn't how shading works,  
> >>>
> >>> …any longer. I just confirmed that it used to work on an older
> >>> installation. Just sayin'  
> >>
> >> are you sure?  
> >
> > See the attached example. The shade seems to go from black to fully
> > transparent. So regardless of the background colour the shade looks
> > fine. I can't replicate this with the new mechanism.  
> 
> a matter of choosing the colors

Indeed, if you choose the colours wisely you don't necessarily need
transparency (at least in my use case).

> \unprotect
> 
> \def\MPcoloronly#1%
>    {\clf_mpcolor
>       \attribute\colormodelattribute
>       \colo_helpers_inherited_current_ca{#1} %
>       \zerocount}
> 
> \def\MPtransparency#1%
>    {\clf_mpcolor
>       \zerocount
>       \zerocount
>       \colo_helpers_inherited_current_ta{#1} }
> 
> \protect
> 
> \startbuffer
>    \definecolor[tex:bg][s=.85]
>    \definecolor[mp:fg] [s=.85,t=1,a=1]
>    \setupbackgrounds [page] [background=color,backgroundcolor=tex:bg]
>    \starttext
>      \contextversion\crlf
>      \startMPcode
>     % lightgray = 0.85white;
                     ^^^ That looks more like Tex's lightgray

>       fill fullsquare xyscaled (12cm, 12cm)
>         withshademethod "linear"
>         withshadevector (-1,0)
>       % withshadecolors (black,lightgray)
>       % withtransparency (1,1)
>         withshadecolors (black,\MPcoloronly{mp:fg})
>         withtransparency \MPtransparencyonly{mp:fg}
                                         ^^^^^  Typo or new feature?
                                         looks like \MPtransparency
                                         should be sufficient
>       ;
>      \stopMPcode
>    \stoptext
> \stopbuffer
> 
> \starttext
>    \typebuffer\getbuffer
> \stoptext

I'll play with the code in the new beta.

Marco
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2016-01-28 18:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 21:05 Marco Patzer
2016-01-28  8:43 ` Hans Hagen
2016-01-28 10:45   ` Marco Patzer
2016-01-28 11:33     ` Hans Hagen
2016-01-28 12:53       ` Marco Patzer
2016-01-28 13:45         ` Hans Hagen
2016-01-28 14:34           ` Marco Patzer
2016-01-28 17:26             ` Hans Hagen
2016-01-28 18:09               ` Marco Patzer [this message]
2016-01-28 11:29   ` Hans Hagen
2016-01-28 13:02     ` Marco Patzer
2016-01-28 15:16       ` 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=20160128190950.5cec1cf9@homerow \
    --to=lists@homerow.info \
    --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).