Re: [NTG-context] shading with stitching functions

2006-12-27 Thread Hans Hagen
Mojca Miklavec wrote:
 Hello,

 I'm still trying to get shading in MetaPost as the one in the attached
 eps file, but I don't manage to decipher the way how other shandings
 are done.

 There's a .tex file attached with a failed (hardcoded) example tries
  but I don't know where to explore further.
well, 'where' coul dbe spec-tpd, or the pdftex manual -)

{\immediate\pdfobj stream attr
 {/FunctionType 0
/Order 1
/BitsPerSample 8
/Domain [\gMPs1 \gMPs2]
/Decode [ 0 1 0 1 0 1 ]
/Range [ 0 1 0 1 0 1 ]
/Size [ 11 ]}
  {00 00 00
   51 00 96
   71 02 f3
   8c 07 f3
   a1 10 96
   b4 20 00
   c6 37 00
   d5 57 00
   e4 83 00
   f2 ba 00
   ff ff 00}%

you can try to define a stream but then you also must maks sure that there is a 
corresponding length key 

Hans 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] shading with stitching functions

2006-12-27 Thread Peter Rolf
Hi Mojca,

this is also on my wishlist (and christmas is over). Currently I use
several color gradients in a row, to simulate the same effect. But sadly
this way is too viewer dependent (rendering is a matter of luck with
every new version), not to mention the big size. So if there would be a
cleaner solution, I would be a happy man.

I'm willing to help, but I haven't looked into specials yet. Give me
some time for reading and some more time for understanding... ;)


Greetings, Peter


Mojca Miklavec wrote:
 Hello,
 
 I'm still trying to get shading in MetaPost as the one in the attached
 eps file, but I don't manage to decipher the way how other shandings
 are done.
 
 There's a .tex file attached with a failed (hardcoded) example tries
 ... but I don't know where to explore further.
 
 I would appreciate any hints,
 Mojca
 
 
 
 
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] shading with stitching functions

2006-12-27 Thread Mojca Miklavec
On 12/27/06, Peter Rolf wrote:
 Hi Mojca,

 this is also on my wishlist (and christmas is over). Currently I use
 several color gradients in a row, to simulate the same effect. But sadly
 this way is too viewer dependent (rendering is a matter of luck with
 every new version), not to mention the big size. So if there would be a
 cleaner solution, I would be a happy man.

 I'm willing to help, but I haven't looked into specials yet. Give me
 some time for reading and some more time for understanding... ;)

With Hans's hint I finally got some kind of result. However, the
numbers in the stream seem to influence the colors, but not in the way
I want them to. I have to do some further explorations. Does anyone
know how to convert PS to PDF without compression?

Btw: TikZ supports such shadings, so if you don't necessary need a
metapost graphic, you can take a look at it as well. Here's an example
from the manual:

\usemodule[tikz]
\starttext
\pgfdeclarehorizontalshading{myshadingA}
{1cm}{rgb(0cm)=(1,0,0); color(2cm)=(green); color(4cm)=(blue)}
\pgfuseshading{myshadingA}
\stoptext

(I've just found out that it uses another aproach for sampled
functions, perhaps I'll have more chances to figure out how to
implement it that way.)

Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] shading with stitching functions

2006-12-27 Thread Peter Rolf
Mojca Miklavec wrote:
 On 12/27/06, Peter Rolf wrote:
 Hi Mojca,

 this is also on my wishlist (and christmas is over). Currently I use
 several color gradients in a row, to simulate the same effect. But sadly
 this way is too viewer dependent (rendering is a matter of luck with
 every new version), not to mention the big size. So if there would be a
 cleaner solution, I would be a happy man.

 I'm willing to help, but I haven't looked into specials yet. Give me
 some time for reading and some more time for understanding... ;)
 
 With Hans's hint I finally got some kind of result. However, the
 numbers in the stream seem to influence the colors, but not in the way
 I want them to. I have to do some further explorations. Does anyone
 know how to convert PS to PDF without compression?

I used

\pdfcompresslevel=0

with your example code.

 Btw: TikZ supports such shadings, so if you don't necessary need a
 metapost graphic, you can take a look at it as well. Here's an example
from the manual:

I need them as mp graphic, but it shouldn't hurt to look into that.

 \usemodule[tikz]
 \starttext
 \pgfdeclarehorizontalshading{myshadingA}
 {1cm}{rgb(0cm)=(1,0,0); color(2cm)=(green); color(4cm)=(blue)}
 \pgfuseshading{myshadingA}
 \stoptext
 
 (I've just found out that it uses another aproach for sampled
 functions, perhaps I'll have more chances to figure out how to
 implement it that way.)
 
 Mojca
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context
 

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context