ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* shading with stitching functions
@ 2006-12-26 22:48 Mojca Miklavec
  2006-12-27  8:44 ` Hans Hagen
  2006-12-27 13:01 ` Peter Rolf
  0 siblings, 2 replies; 5+ messages in thread
From: Mojca Miklavec @ 2006-12-26 22:48 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

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

[-- Attachment #2: sampled-shading.eps --]
[-- Type: application/postscript, Size: 1183 bytes --]

[-- Attachment #3: new-shading-type-test.tex --]
[-- Type: application/x-tex, Size: 3181 bytes --]

[-- Attachment #4: Type: text/plain, Size: 139 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shading with stitching functions
  2006-12-26 22:48 shading with stitching functions Mojca Miklavec
@ 2006-12-27  8:44 ` Hans Hagen
  2006-12-27 13:01 ` Peter Rolf
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2006-12-27  8:44 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shading with stitching functions
  2006-12-26 22:48 shading with stitching functions Mojca Miklavec
  2006-12-27  8:44 ` Hans Hagen
@ 2006-12-27 13:01 ` Peter Rolf
  2006-12-27 16:43   ` Mojca Miklavec
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Rolf @ 2006-12-27 13:01 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shading with stitching functions
  2006-12-27 13:01 ` Peter Rolf
@ 2006-12-27 16:43   ` Mojca Miklavec
  2006-12-27 17:01     ` Peter Rolf
  0 siblings, 1 reply; 5+ messages in thread
From: Mojca Miklavec @ 2006-12-27 16:43 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shading with stitching functions
  2006-12-27 16:43   ` Mojca Miklavec
@ 2006-12-27 17:01     ` Peter Rolf
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Rolf @ 2006-12-27 17:01 UTC (permalink / raw)


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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-27 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-26 22:48 shading with stitching functions Mojca Miklavec
2006-12-27  8:44 ` Hans Hagen
2006-12-27 13:01 ` Peter Rolf
2006-12-27 16:43   ` Mojca Miklavec
2006-12-27 17:01     ` Peter Rolf

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).