Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Alan BRASLAU
On Mon, 15 Jun 2015 09:43:38 +0200
Hans Hagen pra...@wxs.nl wrote:

 you're one of those people infected by apple software where shades
 are (of maybe were) the fashion 

Eye candy, goes in and out of fashion...
 
 that's mostly a shade made out of steps (in the pdf one shade
 operation but not better than 8 shades next to each other) 

8 shades of gray?

Alan
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Hans Hagen

On 6/14/2015 11:26 PM, Mojca Miklavec wrote:


Your example uses just two colours, while TikZ uses five and I don't
know how to translate this ball shading to MP (I know or at least
knew how to do it in plain PostScript and could dig it up; I think it
uses function shading with predefined colours at predefined distances,
but it's all a single shading (a single function), not a composition
of multiple sections).


Ok, as I suppose you need it for you thesis ... a new beta ...

I didn't play with values for the circular one but here's a linear:

\startMPpage

fill fullsquare scaled 50pt
withshademethod linear
withshadevector (0,1)
withshadestep (
withshadefraction .3
withshadecolors (red,green)
)
withshadestep (
withshadefraction .5
withshadecolors (green,blue)
)
withshadestep (
withshadefraction .7
withshadecolors (blue,red)
)
withshadestep (
withshadefraction 1
withshadecolors (red,yellow)
)
;

fill fullsquare scaled 50pt shifted(60pt,0)
withshademethod linear
withshadevector (0,1)
withshadecolors (red,green)
;

\stopMPpage

so the withshadestep is new

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Hans Hagen

On 6/15/2015 10:02 AM, Mojca Miklavec wrote:


What is the decimal part (.00128) used for?


it's what tikz produces as output ... a rounding error i guess

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Mojca Miklavec
On Mon, Jun 15, 2015 at 3:02 PM, Hans Hagen wrote:
 On 6/15/2015 10:02 AM, Mojca Miklavec wrote:

 What is the decimal part (.00128) used for?

 it's what tikz produces as output ... a rounding error i guess

Ah, ok, I din't know that you were using the TikZ output.

Then it's more likely related to bigpoint (bp), but that's pure speculation.

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Mojca Miklavec
On Mon, Jun 15, 2015 at 9:43 AM, Hans Hagen wrote:
 On 6/14/2015 11:26 PM, Mojca Miklavec wrote:

 On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote:


 Most shades look ugly and useless to me anyway but you have more control
 than you think (always had but nicer interfaced in mpiv):

 \startMPpage
  fill fullcircle scaled 10cm
  withshademethod circular
  withshadevector (5cm,1cm)
  withshadecenter (.1,.5)
  withshadedomain (.2,.6)
  withshadefactor 1.2
  withshadecolors (red,green)
  ;
 \stopMPage


 Great, I love the new syntax (compared to the MKII ugliness of
 shadings).


 well, even mkii could do some magic if one went a bit more low level

I know. The resulting PDF was great, but doing any programming in MkII
was a nightmare.

 shading is quite old actually (dates from before tikz showed up -)

TikZ is a relatively recent piece of software.

 i have in my mailbox a mail from 1999 from mathew that demos a function
 shading (some perl code) which is the way to go with more advanced shades

 But how does one declare more than one colour? In particular, how
 would you do the following in MP?

 \usemodule
  [tikz]

 \pgfdeclareverticalshading{rainbow}{100bp}{
  color(0bp)=(red);
  color(25bp)=(red);
  color(35bp)=(yellow);
  color(45bp)=(green);
  color(55bp)=(cyan);
  color(65bp)=(blue);
  color(75bp)=(violet);
  color(100bp)=(violet)}

 \starttext
 \starttikzpicture[shading=rainbow]
 \shade[shading angle=90] (0,0) rectangle +(10,1);
 \stoptikzpicture
 \stoptext


 you're one of those people infected by apple software where shades are (of
 maybe were) the fashion

Actually, some shadings in PDF are broken in Apple's libraries. The
output of Asymptote (and some output of my own simulations) can
sometimes only be rendered properly by Acrobat, while Apple software
would simply crash or render pure nonsense.

 (next thing you will ask to simulate perkament
 behind your pages or leather looking cover pages) ... aka patterns in ps

Thanks for the idea ;)

 Of course you need to play with the values as there is no 'best'
 combination.


 This is how TikZ defines the ball:

 \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{%
   color(0bp)=(tikz@ball!15!white);
   color(9bp)=(tikz@ball!75!white);
   color(18bp)=(tikz@ball!70!black);
   color(25bp)=(tikz@ball!50!black);
   color(50bp)=(black)}


 that's mostly a shade made out of steps (in the pdf one shade operation but
 not better than 8 shades next to each other)

8 shades next to each other are probably less efficient and might
render with holes in non-Acrobat buggy renderers. But your example
below looks like it should be interpreted as a single shading (it
uses a single function), so it should work fine.

What is the decimal part (.00128) used for?

 ... personally i dislike such
 granular shaded (either do it good or don't do it at all)

 (btw in context code will look a bit more complex because we also need to
 deal with spot colors, multi-tones, cmyk, etc)

 Your example uses just two colours, while TikZ uses five and I don't
 know how to translate this ball shading to MP (I know or at least
 knew how to do it in plain PostScript and could dig it up; I think it
 uses function shading with predefined colours at predefined distances,
 but it's all a single shading (a single function), not a composition
 of multiple sections).


 something similar to

 /Shading  /Sh 
   /ShadingType 2
   /ColorSpace
   /DeviceRGB
   /Domain [0.0 100.00128]
   /Coords [0 0.0 0 100.00128]
   /Function 
 /FunctionType 3
 /Domain [0.0 100.00128]
 /Functions [
/FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 0 0] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 1 0] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [1 1 0] /C1 [0 1 0] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 0] /C1 [0 1 1] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 1] /C1 [0 0 1] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 1] /C1 [0 0 0] /N
 1 
/FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 0] /C1 [0 0 0] /N
 1 
 ]
   /Bounds [ 25.00032 35.00043 45.00056 55.00069 65.00082 75.00096]
   /Encode [0 1  0 1 0 1 0 1 0 1 0 1 0 1] 
   /Extend [false false]
 /ProcSet[/PDF] 

 not too hard to program (if i can motivate myself)

Talking about old examples ... here's an example in pure PostScript
that achieves a desired result, including your response (however it
doesn't support specifying the locations of colours):
http://www.ntg.nl/pipermail/ntg-context/2006/022833.html

Mojca
___
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 / 

Re: [NTG-context] TikZ and wrong drawing order

2015-06-15 Thread Hans Hagen

On 6/14/2015 11:26 PM, Mojca Miklavec wrote:

On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote:


Most shades look ugly and useless to me anyway but you have more control
than you think (always had but nicer interfaced in mpiv):

\startMPpage
 fill fullcircle scaled 10cm
 withshademethod circular
 withshadevector (5cm,1cm)
 withshadecenter (.1,.5)
 withshadedomain (.2,.6)
 withshadefactor 1.2
 withshadecolors (red,green)
 ;
\stopMPage


Great, I love the new syntax (compared to the MKII ugliness of shadings).


well, even mkii could do some magic if one went a bit more low level

shading is quite old actually (dates from before tikz showed up -)

i have in my mailbox a mail from 1999 from mathew that demos a function 
shading (some perl code) which is the way to go with more advanced shades



But how does one declare more than one colour? In particular, how
would you do the following in MP?

\usemodule
 [tikz]

\pgfdeclareverticalshading{rainbow}{100bp}{
 color(0bp)=(red);
 color(25bp)=(red);
 color(35bp)=(yellow);
 color(45bp)=(green);
 color(55bp)=(cyan);
 color(65bp)=(blue);
 color(75bp)=(violet);
 color(100bp)=(violet)}

\starttext
\starttikzpicture[shading=rainbow]
\shade[shading angle=90] (0,0) rectangle +(10,1);
\stoptikzpicture
\stoptext


you're one of those people infected by apple software where shades are 
(of maybe were) the fashion (next thing you will ask to simulate 
perkament behind your pages or leather looking cover pages) ... aka 
patterns in ps



Of course you need to play with the values as there is no 'best'
combination.


This is how TikZ defines the ball:

\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{%
  color(0bp)=(tikz@ball!15!white);
  color(9bp)=(tikz@ball!75!white);
  color(18bp)=(tikz@ball!70!black);
  color(25bp)=(tikz@ball!50!black);
  color(50bp)=(black)}


that's mostly a shade made out of steps (in the pdf one shade operation 
but not better than 8 shades next to each other) ... personally i 
dislike such granular shaded (either do it good or don't do it at all)


(btw in context code will look a bit more complex because we also need 
to deal with spot colors, multi-tones, cmyk, etc)



Your example uses just two colours, while TikZ uses five and I don't
know how to translate this ball shading to MP (I know or at least
knew how to do it in plain PostScript and could dig it up; I think it
uses function shading with predefined colours at predefined distances,
but it's all a single shading (a single function), not a composition
of multiple sections).


something similar to

/Shading  /Sh 
  /ShadingType 2
  /ColorSpace
  /DeviceRGB
  /Domain [0.0 100.00128]
  /Coords [0 0.0 0 100.00128]
  /Function 
/FunctionType 3
/Domain [0.0 100.00128]
/Functions [
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 0 
0] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 1 
0] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 1 0] /C1 [0 1 
0] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 0] /C1 [0 1 
1] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 1] /C1 [0 0 
1] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 1] /C1 [0 0 
0] /N 1 
   /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 0] /C1 [0 0 
0] /N 1 

]
  /Bounds [ 25.00032 35.00043 45.00056 55.00069 65.00082 75.00096]
  /Encode [0 1  0 1 0 1 0 1 0 1 0 1 0 1] 
  /Extend [false false]
 /ProcSet[/PDF] 

not too hard to program (if i can motivate myself)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
On Thu, Jun 11, 2015 at 11:26 PM, Hans Hagen wrote:
 On Thu, 11 Jun 2015, Mojca Miklavec wrote:

 Hi,

 I would like to ask for help for either finding a fix or some clever
 workaround for the following problem.

 If I use a TikZ picture as item symbol and additionally use background
 text, then the first symbol in itemize environment gets covered by the
 background. Here's an example:

 \usemodule
 [tikz]

 \definesymbol[1]
 [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

 \definecolor
 [backcol]
 [s=1,a=1,t=0.1]

 \starttext

 \startframedtext[width=4cm,background=color,backgroundcolor=backcol]
 \startitemize
 \item one
 \item two
 \item three
 \stopitemize
 \stopframedtext

 \stoptext

 i suppose that tikz puts some pdf code in the output stream and this is
 likely to interfere with the way context deals with colors

 a solution is:

 {\red x\dontleavehmode\forcecolorhack\tikz\fill[color=blue] (0,0) circle
 (.2cm);x}

 the

 \forcecolorhack

 is, well, a hack that fools the optimizer and \dontleavehmode is needed to
 get tex in the right mode

Thank you very much. Using the following worked fine as a workaround.

\definesymbol[1]
[{\dontleavehmode\forcecolorhack\tikz\shade[shading=ball,ball
color=blue] (0,0) circle (.2cm);}]

Meanwhile I filed a ticket to the pgf's bug tracker to help us
remember specifics about the problem.

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
See also:
http://tex.stackexchange.com/questions/54193/how-to-draw-a-shaded-sphere

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote:

 Most shades look ugly and useless to me anyway but you have more control
 than you think (always had but nicer interfaced in mpiv):

 \startMPpage
 fill fullcircle scaled 10cm
 withshademethod circular
 withshadevector (5cm,1cm)
 withshadecenter (.1,.5)
 withshadedomain (.2,.6)
 withshadefactor 1.2
 withshadecolors (red,green)
 ;
 \stopMPage

Great, I love the new syntax (compared to the MKII ugliness of shadings).

But how does one declare more than one colour? In particular, how
would you do the following in MP?

\usemodule
[tikz]

\pgfdeclareverticalshading{rainbow}{100bp}{
color(0bp)=(red);
color(25bp)=(red);
color(35bp)=(yellow);
color(45bp)=(green);
color(55bp)=(cyan);
color(65bp)=(blue);
color(75bp)=(violet);
color(100bp)=(violet)}

\starttext
\starttikzpicture[shading=rainbow]
\shade[shading angle=90] (0,0) rectangle +(10,1);
\stoptikzpicture
\stoptext

 Of course you need to play with the values as there is no 'best'
 combination.

This is how TikZ defines the ball:

\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{%
 color(0bp)=(tikz@ball!15!white);
 color(9bp)=(tikz@ball!75!white);
 color(18bp)=(tikz@ball!70!black);
 color(25bp)=(tikz@ball!50!black);
 color(50bp)=(black)}

Your example uses just two colours, while TikZ uses five and I don't
know how to translate this ball shading to MP (I know or at least
knew how to do it in plain PostScript and could dig it up; I think it
uses function shading with predefined colours at predefined distances,
but it's all a single shading (a single function), not a composition
of multiple sections).

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-12 Thread Alan BRASLAU
On Fri, 12 Jun 2015 00:28:43 +0200
Mojca Miklavec mojca.miklavec.li...@gmail.com wrote:

 Thank you. But TikZ simply delivers a superior result in this case
 (= better tuned). 

Pfluff!

Alan
___
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
___

[NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Mojca Miklavec
Hi,

I would like to ask for help for either finding a fix or some clever
workaround for the following problem.

If I use a TikZ picture as item symbol and additionally use background
text, then the first symbol in itemize environment gets covered by the
background. Here's an example:

\usemodule
[tikz]

\definesymbol[1]
[{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

\definecolor
[backcol]
[s=1,a=1,t=0.1]

\starttext

\startframedtext[width=4cm,background=color,backgroundcolor=backcol]
\startitemize
\item one
\item two
\item three
\stopitemize
\stopframedtext

\stoptext

Thank you,
Mojca


test.pdf
Description: Adobe PDF document
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Aditya Mahajan

On Thu, 11 Jun 2015, Mojca Miklavec wrote:


Hi,

I would like to ask for help for either finding a fix or some clever
workaround for the following problem.

If I use a TikZ picture as item symbol and additionally use background
text, then the first symbol in itemize environment gets covered by the
background. Here's an example:

\usemodule
   [tikz]

\definesymbol[1]
   [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

\definecolor
   [backcol]
   [s=1,a=1,t=0.1]

\starttext

\startframedtext[width=4cm,background=color,backgroundcolor=backcol]
\startitemize
\item one
\item two
\item three
\stopitemize
\stopframedtext

\stoptext


Workaround (though I have no idea why this should work). Use

   background={foreground,color}

I wanted to test background={color, foreground}, but wrote the above by 
mistake and it works!!!


Aditya

___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Mojca Miklavec
On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote:
 On Thu, 11 Jun 2015, Mojca Miklavec wrote:

 Hi,

 I would like to ask for help for either finding a fix or some clever
 workaround for the following problem.

 If I use a TikZ picture as item symbol and additionally use background
 text, then the first symbol in itemize environment gets covered by the
 background. Here's an example:

 \usemodule
[tikz]

 \definesymbol[1]
[{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

 \definecolor
[backcol]
[s=1,a=1,t=0.1]

 \starttext

 \startframedtext[width=4cm,background=color,backgroundcolor=backcol]
 \startitemize
 \item one
 \item two
 \item three
 \stopitemize
 \stopframedtext

 \stoptext


 Workaround (though I have no idea why this should work).

Does it also work if you use the following?

\definecolor
[backcol]
[s=1,a=1,t=0.95]

 Use

background={foreground,color}

 I wanted to test background={color, foreground}, but wrote the above by
 mistake and it works!!!

While it works in the sense that it gives a consistent look, it
doesn't really lead to the desired result, at least not for me. The
reason for using background colour in my case was to make text
visible on a dark background photo. It doesn't really help if the
main text gets hidden behind the semi-transparent layer.

Unless you get different results than I do.

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Mojca Miklavec
On Thu, Jun 11, 2015 at 10:43 PM, Aditya Mahajan wrote:
 On Thu, 11 Jun 2015, Mojca Miklavec wrote:
 On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote:
 On Thu, 11 Jun 2015, Mojca Miklavec wrote:

 Hi,

 I would like to ask for help for either finding a fix or some clever
 workaround for the following problem.

 If I use a TikZ picture as item symbol and additionally use background
 text, then the first symbol in itemize environment gets covered by the
 background. Here's an example:


 Workaround (though I have no idea why this should work).


background={foreground,color}


 While it works in the sense that it gives a consistent look, it
 doesn't really lead to the desired result, at least not for me. The
 reason for using background colour in my case was to make text
 visible on a dark background photo. It doesn't really help if the
 main text gets hidden behind the semi-transparent layer.


 I have no idea what tikz is doing:

 \usemodule[tikz]

 \definecolor[light][s=1,a=1,t=0.1]
 \definecolor[dark] [s=1,a=1,t=0.95]

 \defineframedtext[normal] [width=4cm, background=color]
 \defineframedtext[reverse][width=4cm, background={foreground,color}]

 \startbuffer
 \tikz\fill[color=blue] (0,0) circle (.2cm);
 \startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue};
 \stopMPcode
 \stopbuffer

 \starttext

 \startnormal[backgroundcolor=light] \getbuffer \stopnormal
 \startnormal[backgroundcolor=dark] \getbuffer  \stopnormal

 \blank[3*line]

 \startreverse[backgroundcolor=light] \getbuffer \stopreverse
 \startreverse[backgroundcolor=dark] \getbuffer  \stopreverse
 \stoptext

It's even more weird than that. The colour of the first item behind
the dark depends on the colour of light:

\usemodule[tikz]

\definecolor[extralight][s=1,a=1,t=0.1]
\definecolor[light][s=1,a=1,t=0.6]
\definecolor[dark] [s=1,a=1,t=0.95]

\defineframedtext[normal] [width=6cm, background=color]
\defineframedtext[reverse][width=6cm, background={foreground,color}]

\startbuffer
\tikz\fill[color=blue] (0,0) circle (.2cm);%
\startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue}; \stopMPcode
\tikz\fill[color=blue] (0,0) circle (.2cm);
\stopbuffer

\starttext

\startnormal[backgroundcolor=light] \getbuffer \stopnormal
\startnormal[backgroundcolor=dark] \getbuffer  \stopnormal

\blank[2*line]

\startreverse[backgroundcolor=light] \getbuffer \stopreverse
\startreverse[backgroundcolor=dark] \getbuffer different \stopreverse

\blank[2*line]

\startreverse[backgroundcolor=extralight] \getbuffer \stopreverse
\startreverse[backgroundcolor=dark] \getbuffer from this one \stopreverse
\stoptext

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Aditya Mahajan

On Thu, 11 Jun 2015, Mojca Miklavec wrote:


On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote:

On Thu, 11 Jun 2015, Mojca Miklavec wrote:


Hi,

I would like to ask for help for either finding a fix or some clever
workaround for the following problem.

If I use a TikZ picture as item symbol and additionally use background
text, then the first symbol in itemize environment gets covered by the
background. Here's an example:



Workaround (though I have no idea why this should work).



   background={foreground,color}


While it works in the sense that it gives a consistent look, it
doesn't really lead to the desired result, at least not for me. The
reason for using background colour in my case was to make text
visible on a dark background photo. It doesn't really help if the
main text gets hidden behind the semi-transparent layer.


I have no idea what tikz is doing:

\usemodule[tikz]

\definecolor[light][s=1,a=1,t=0.1]
\definecolor[dark] [s=1,a=1,t=0.95]

\defineframedtext[normal] [width=4cm, background=color]
\defineframedtext[reverse][width=4cm, background={foreground,color}]

\startbuffer
\tikz\fill[color=blue] (0,0) circle (.2cm);
\startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue}; \stopMPcode
\stopbuffer

\starttext

\startnormal[backgroundcolor=light] \getbuffer \stopnormal
\startnormal[backgroundcolor=dark] \getbuffer  \stopnormal

\blank[3*line]

\startreverse[backgroundcolor=light] \getbuffer \stopreverse
\startreverse[backgroundcolor=dark] \getbuffer  \stopreverse
\stoptext

Aditya

test.pdf
Description: Adobe PDF document
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Hans Hagen

On 6/11/2015 10:14 PM, Mojca Miklavec wrote:

On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote:

On Thu, 11 Jun 2015, Mojca Miklavec wrote:


Hi,

I would like to ask for help for either finding a fix or some clever
workaround for the following problem.

If I use a TikZ picture as item symbol and additionally use background
text, then the first symbol in itemize environment gets covered by the
background. Here's an example:

\usemodule
[tikz]

\definesymbol[1]
[{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

\definecolor
[backcol]
[s=1,a=1,t=0.1]

\starttext

\startframedtext[width=4cm,background=color,backgroundcolor=backcol]
\startitemize
\item one
\item two
\item three
\stopitemize
\stopframedtext

\stoptext



Workaround (though I have no idea why this should work).


Does it also work if you use the following?

\definecolor
 [backcol]
 [s=1,a=1,t=0.95]


Use

background={foreground,color}

I wanted to test background={color, foreground}, but wrote the above by
mistake and it works!!!


While it works in the sense that it gives a consistent look, it
doesn't really lead to the desired result, at least not for me. The
reason for using background colour in my case was to make text
visible on a dark background photo. It doesn't really help if the
main text gets hidden behind the semi-transparent layer.

Unless you get different results than I do.


i suppose that tikz puts some pdf code in the output stream and this is 
likely to interfere with the way context deals with colors


a solution is:

{\red x\dontleavehmode\forcecolorhack\tikz\fill[color=blue] (0,0) circle 
(.2cm);x}


the

\forcecolorhack

is, well, a hack that fools the optimizer and \dontleavehmode is needed 
to get tex in the right mode


i have no time to look into the internals of tikz to see if a different 
trick is possible


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Hans Hagen

On 6/11/2015 7:27 PM, Mojca Miklavec wrote:

Hi,

I would like to ask for help for either finding a fix or some clever
workaround for the following problem.

If I use a TikZ picture as item symbol and additionally use background
text, then the first symbol in itemize environment gets covered by the
background. Here's an example:

\usemodule
 [tikz]

\definesymbol[1]
 [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]


\startreusableMPgraphic{bullet}
fill fullcircle
scaled (1EmWidth)
withshademethod circular
withcolor red shadedinto blue ;
\stopreusableMPgraphic

\definesymbol[1]{\reuseMPgraphic{bullet}}

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Mojca Miklavec
On Thu, Jun 11, 2015 at 11:12 PM, Hans Hagen wrote:
 On 6/11/2015 7:27 PM, Mojca Miklavec wrote:

 \usemodule
  [tikz]

 \definesymbol[1]
  [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]


 \startreusableMPgraphic{bullet}
 fill fullcircle
 scaled (1EmWidth)
 withshademethod circular
 withcolor red shadedinto blue ;
 \stopreusableMPgraphic

 \definesymbol[1]{\reuseMPgraphic{bullet}}

Thank you. But TikZ simply delivers a superior result in this case
(= better tuned). We should figure out how exactly the shading is done
there (it's slightly eccentric etc.) and try to prepare a macro for
metafun that delivers the same result (or at least a compatible one)
with an input of a single colour as a parameter.

Mojca
___
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
___

Re: [NTG-context] TikZ and wrong drawing order

2015-06-11 Thread Hans Hagen

On 6/12/2015 12:28 AM, Mojca Miklavec wrote:

On Thu, Jun 11, 2015 at 11:12 PM, Hans Hagen wrote:

On 6/11/2015 7:27 PM, Mojca Miklavec wrote:


\usemodule
  [tikz]

\definesymbol[1]
  [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]



\startreusableMPgraphic{bullet}
 fill fullcircle
 scaled (1EmWidth)
 withshademethod circular
 withcolor red shadedinto blue ;
\stopreusableMPgraphic

\definesymbol[1]{\reuseMPgraphic{bullet}}


Thank you. But TikZ simply delivers a superior result in this case
(= better tuned). We should figure out how exactly the shading is done
there (it's slightly eccentric etc.) and try to prepare a macro for
metafun that delivers the same result (or at least a compatible one)
with an input of a single colour as a parameter.


Most shades look ugly and useless to me anyway but you have more control 
than you think (always had but nicer interfaced in mpiv):


\startMPpage
fill fullcircle scaled 10cm
withshademethod circular
withshadevector (5cm,1cm)
withshadecenter (.1,.5)
withshadedomain (.2,.6)
withshadefactor 1.2
withshadecolors (red,green)
;
\stopMPage

Of course you need to play with the values as there is no 'best' 
combination.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___