Account Options

  1. Sign in
Google Groups Home
« Groups Home
shfill: /ShadingType 2, computed parameters
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  19 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jdaw1  
View profile  
 More options Mar 8 2010, 4:24 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Mon, 8 Mar 2010 13:24:26 -0800 (PST)
Local: Mon, Mar 8 2010 4:24 pm
Subject: shfill: /ShadingType 2, computed parameters
I am failing to get shfill to work for me. Below is a simplified
version of what is going on: several of the numbers (1 7 div) are
actually references to other PostScript variables the value of which
are not yet known. Please, what's wrong?

%!

100 100 moveto  100 500 lineto
3 setlinewidth

strokepath
<<
        /ShadingType 2   /ColorSpace /DeviceRGB   /Extend [true true]
        /Function
        <<
                        /FunctionType 0   /N 1   /Domain [0 1]   /Range [0 1 0 1 0 1]   /
Order 1   /Size [2]
                        /DataSource [
                                1 7 div  1  0.75  gsave sethsbcolor currentrgbcolor grestore   0
                                2 7 div  1  0.75  gsave sethsbcolor currentrgbcolor grestore   1
                        ]
        >>
        /Coords [
                500 200
                500 400
        ]


shfill

showpage

Thank you.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ken  
View profile  
 More options Mar 9 2010, 8:43 am
Newsgroups: comp.lang.postscript
From: ken <k...@spamcop.net>
Date: Tue, 9 Mar 2010 13:43:46 -0000
Local: Tues, Mar 9 2010 8:43 am
Subject: Re: shfill: /ShadingType 2, computed parameters
In article <be046966-b3b4-452b-80b6-a2df7b6d6b69
@q15g2000yqj.googlegroups.com>, jdawise...@gmail.com says...

> I am failing to get shfill to work for me. Below is a simplified
> version of what is going on: several of the numbers (1 7 div) are
> actually references to other PostScript variables the value of which
> are not yet known. Please, what's wrong?

For a type 0 (sampled) function the DataSource is defined to be either a
string or a positionable file providing the sample data. You have
provided a PostScript procedure. This will raise a typecheck error.

For a Type 0 function you *must* supply a BitsPerSample value, which is
not present.

You cannot use a PostScript function as the basis for the data in a
Function dictionary.

                                Ken


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 9 2010, 9:45 am
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Tue, 9 Mar 2010 06:45:11 -0800 (PST)
Local: Tues, Mar 9 2010 9:45 am
Subject: Re: shfill: /ShadingType 2, computed parameters

> You cannot use a PostScript function as the basis for the data in a Function dictionary.

But is it possible to convert computed PostScript-function data to
either of the formats allowed in a function dictionary? And if so,
please, how?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ken  
View profile  
 More options Mar 9 2010, 12:07 pm
Newsgroups: comp.lang.postscript
From: ken <k...@spamcop.net>
Date: Tue, 9 Mar 2010 17:07:23 -0000
Local: Tues, Mar 9 2010 12:07 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
In article <a3c02902-55e0-42a2-8e43-c2d2de83c113
@a18g2000yqc.googlegroups.com>, jdawise...@gmail.com says...

> But is it possible to convert computed PostScript-function data to
> either of the formats allowed in a function dictionary? And if so,
> please, how?

Run the PostScript functions on a number of potential input values to
generate the output data points. Take those data points, convert into
string data, supply the string as a DataSource to the type 0 Function.

Interpolation will generate the intermediate points. FOr more accuracy,
run more samples, cost is only more string data.

                        Ken


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 9 2010, 2:57 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Tue, 9 Mar 2010 11:57:59 -0800 (PST)
Local: Tues, Mar 9 2010 2:57 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
Thank you. As I'm happy for it to be linear, only the start and end
points are needed. Please, how can one
> convert into string data, supply the string as a DataSource to the type 0 Function.

?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olle  
View profile  
 More options Mar 9 2010, 4:30 pm
Newsgroups: comp.lang.postscript
From: Olle <olavi.sak...@gmail.com>
Date: Tue, 9 Mar 2010 13:30:47 -0800 (PST)
Local: Tues, Mar 9 2010 4:30 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
On Mar 9, 12:57 pm, jdaw1 <jdawise...@gmail.com> wrote:

> Thank you. As I'm happy for it to be linear, only the start and end
> points are needed. Please, how can one> convert into string data, supply the string as a DataSource to the type 0 Function.

> ?

Converting to string: cvs

If you need a function for appending to an existing string, see
comp.lang.postscript faqs (7.8 How can I concatenate two strings
together?)

Thanks,

Olle


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 9 2010, 6:01 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Tue, 9 Mar 2010 15:01:14 -0800 (PST)
Local: Tues, Mar 9 2010 6:01 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
I have a Concatenate function. But how do I convert numbers on the
stack, like 0.3284, to an appropriate strong format?

/ConcatenateOverflowErrorsSuppressed false def
/Concatenate
{
        2 copy type exch type
        2 copy /stringtype ne exch /stringtype ne or
        {
                2 copy /arraytype eq exch /arraytype eq 4 2 roll /packedarraytype eq
exch /packedarraytype eq
                3 -1 roll or 3 1 roll or and not
                {
                        (Error: Concatenate, types either unsuitable or non-matching)
OutputToLog == == stop
                } {false} ifelse  % not both arrays
        } {pop pop true} ifelse  % either not a string
        3 1 roll  2 copy  length exch length add dup 65535 le
        {
                4 -1 roll {string} {array} ifelse dup dup
                0  5 index putinterval
                4 -1 roll length 4 -1 roll putinterval
        }
        {
                % bool A B joint-size
                pop  3 -1 roll
                {
                        1 index length 65535 ge
                        {
                                pop
                                ConcatenateOverflowErrorsSuppressed not
                                {
                                        (Error: Concatenate, first string of maximal size. Suppressing
reporting of further such errors.) OutputToLog
                                        /ConcatenateOverflowErrorsSuppressed true store
                                } if  % ConcatenateOverflowErrorsSuppressed not
                        }
                        {
                                ConcatenateOverflowErrorsSuppressed not
                                {
                                        (Error: Concatenate -- truncation, as objects jointly too long.
Suppressing reporting of further such errors.) OutputToLog
                                        /ConcatenateOverflowErrorsSuppressed true store
                                } if  % ConcatenateOverflowErrorsSuppressed not
                                65535 string dup dup  % A B string string string
                                0  5 index  putinterval  % A B string string
                                4 -1 roll length dup 65535 exch sub  % B string string |A| 65535-|
A|
                                5 -1 roll 0 3 -1 roll getinterval  % string string |A| B'
                                dup length 0 gt {putinterval} {pop pop} ifelse  % string
                        } ifelse  % First object maximal length
                        dup 65532 (...) putinterval
                }
                {
                        ConcatenateOverflowErrorsSuppressed not
                        {
                                (Error: Concatenate, objects jointly too large, returning only
first object. Suppressing reporting of further such errors.)
OutputToLog
                                /ConcatenateOverflowErrorsSuppressed true store
                        } if  % ConcatenateOverflowErrorsSuppressed not
                        pop
                } ifelse  % string
        } ifelse  % fits within architectural limits


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 9 2010, 6:16 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Tue, 9 Mar 2010 15:16:16 -0800 (PST)
Local: Tues, Mar 9 2010 6:16 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
Of course by “strong” I meant “string”.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Olle  
View profile  
 More options Mar 10 2010, 3:55 pm
Newsgroups: comp.lang.postscript
From: Olle <olavi.sak...@gmail.com>
Date: Wed, 10 Mar 2010 12:55:04 -0800 (PST)
Local: Wed, Mar 10 2010 3:55 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
On Mar 9, 4:16 pm, jdaw1 <jdawise...@gmail.com> wrote:

> Of course by “strong” I meant “string”.

Well, using cvs is pretty straightforward, you just have to check that
your argument is a number.

Something like this might work for you:

% integer/real  *CeeVeeEss*  string true
%        other  *CeeVeeEss*  other false
/CeeVeeEss
{
  dup type dup /integertype eq exch /realtype eq or
  {20 string cvs true}{false}
  ifelse

}

bind def

/ConcatenateOverflowErrorsSuppressed false def
/Concatenate
{
  CeeVeeEss {( ) Concatenate} if exch
  CeeVeeEss {( ) Concatenate} if exch
  2 copy type exch type
  ...

If an argument was converted to a string a space will be appended to
it.

Thanks,

Olle


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 10 2010, 6:40 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Wed, 10 Mar 2010 15:40:15 -0800 (PST)
Local: Wed, Mar 10 2010 6:40 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
OK, let me replace things with constants I understand and then, later,
manufacture those constants.

Why does the following give me a typecheck in shfill?

strokepath
<<
        /ShadingType 2   /ColorSpace /DeviceRGB   /Extend [true true]
        /Function
        <<
        /FunctionType 0 /N 1 /Domain [0 1] /Range [0 1 0 1 0 1] /Order 1 /
Size [2]
        /DataSource [(0.115385 0.75 0.0 0 0.115385 0.0 0.75 1 )]
        >>
        /Coords [814.958 553.151 814.958 289.594]


shfill

Splitting the DataSource into two strings doesn't help: [(0.115385
0.75 0.0 0) ( 0.115385 0.0 0.75 1 )]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Cloos  
View profile  
 More options Mar 10 2010, 7:16 pm
Newsgroups: comp.lang.postscript
From: James Cloos <cl...@jhcloos.com>
Date: Wed, 10 Mar 2010 19:16:59 -0500
Local: Wed, Mar 10 2010 7:16 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
Wouldn't a type1 shading work better for that?

PS type1 shadings are functions which take two values from the stack and
push N values, one per colour component.

It seems better to use a type1 than to use ps code to create a string to
use with a type2 shading.

-JimC
--
James Cloos <cl...@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 11 2010, 4:35 am
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Thu, 11 Mar 2010 01:35:07 -0800 (PST)
Local: Thurs, Mar 11 2010 4:35 am
Subject: Re: shfill: /ShadingType 2, computed parameters
> Wouldn't a type1 shading work better for that?

Looked more complicated.

There is a path, consisting of a single curveto with the two internal
control points being the same, so the path not self-intersecting.
There are computed RGB values for the colours at the two ends. In
between I want the colour to shift gradually from one to the other,
and I don't care about the speed of colour variation.

Please, given real values X0 Y0 X1 Y1 X3 Y3, R0 G0 B0, R3 G3 B3, show
me the code that makes it happen.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Prouty  
View profile  
 More options Mar 11 2010, 2:49 pm
Newsgroups: comp.lang.postscript
From: Scott Prouty <scott.pro...@solimarsystems.com>
Date: Thu, 11 Mar 2010 11:49:13 -0800 (PST)
Local: Thurs, Mar 11 2010 2:49 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
On Mar 10, 3:40 pm, jdaw1 <jdawise...@gmail.com> wrote:

The /DataSource is still an array.  Try:

         /DataSource (0.115385 0.75 0.0 0 0.115385 0.0 0.75 1 )


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ken  
View profile  
 More options Mar 11 2010, 3:23 pm
Newsgroups: comp.lang.postscript
From: ken <k...@spamcop.net>
Date: Thu, 11 Mar 2010 20:23:51 -0000
Local: Thurs, Mar 11 2010 3:23 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
In article <7b228915-dc3e-47b7-8ff7-c47f527f5794
@e7g2000yqf.googlegroups.com>, scott.pro...@solimarsystems.com says...

> > Splitting the DataSource into two strings doesn't help: [(0.115385
> > 0.75 0.0 0) ( 0.115385 0.0 0.75 1 )]

> The /DataSource is still an array.  Try:

>          /DataSource (0.115385 0.75 0.0 0 0.115385 0.0 0.75 1 )

In this case the data must be binary, not ASCII, eg:

<0001020304> = 0x01 0x02 0x03 0x04 etc

To map the integer hex values into the domain of the function output you
must supply a Decode array. Depending on the input, you may also find it
necessary to supply an Encode array as well.

                Ken


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 11 2010, 4:24 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Thu, 11 Mar 2010 13:24:25 -0800 (PST)
Local: Thurs, Mar 11 2010 4:24 pm
Subject: Re: shfill: /ShadingType 2, computed parameters

> To map the integer hex values into the domain of the function output you
> must supply a Decode array. Depending on the input, you may also find it
> necessary to supply an Encode array as well.

Thank you. But, please, would it be easy to post some code that could
convert real variables R0 G0 B0 R3 G3 B3 into the appropriately-
formatted DataSource / Encode / BitsPerSample data?

I have plenty of spare memory so BitsPerSample could happily be large.
Unless that introduces new problems.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 11 2010, 7:08 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Thu, 11 Mar 2010 16:08:20 -0800 (PST)
Local: Thurs, Mar 11 2010 7:08 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
Thank you all for comments. The thing I was missing was put'ting
integers directly into a string: now it works.

Note to self:

/RaysStrokeCode
{
        ThisName (Julian) eq {0.75 setgray stroke}
        {
                0.36 setlinewidth
                WithinPage0 WithinPage1 eq
                {
                        GlassesOnSheets SheetNum get length dup dup 4 div CoprimeNear
WithinPage0 mul 1 index mod exch div  1  1  sethsbcolor  stroke
                }
                {
                        strokepath clipsave clip
                        <<
                                /Function
                                <<
                                                /DataSource
                                                GlassesOnSheets SheetNum get length dup dup 4 div CoprimeNear
WithinPage0 mul 1 index mod exch div  1  1  gsave sethsbcolor
currentrgbcolor grestore
                                                GlassesOnSheets SheetNum get length dup dup 4 div CoprimeNear
WithinPage1 mul 1 index mod exch div  1  1  gsave sethsbcolor
currentrgbcolor grestore
                                                (123456)  % 6 numbers, one byte each; can re-use string so will
                                                5 -1 0 {exch dup 4 2 roll exch  255 mul 0.5 add floor cvi  put}
for
                                                /BitsPerSample 8
                                                /FunctionType 0   /Domain [0 1]   /Range [0 1  0 1  0 1]   /
Order 1   /Size [2]   /N 1
                                >>
                                /Coords [ X0 Y0 X1 Y1 ]
                                /ShadingType 2   /ColorSpace /DeviceRGB   /Extend [true dup]
                        >>
                        shfill cliprestore newpath
                } ifelse  % WithinPage0 WithinPage1 eq
        } ifelse  % ThisName ...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 11 2010, 7:38 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Thu, 11 Mar 2010 16:38:42 -0800 (PST)
Local: Thurs, Mar 11 2010 7:38 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
Another note to self:

/RaysStrokeCode
{
        ThisName (Julian) eq {0.75 setgray stroke}
        {
                0.36 setlinewidth
                WithinPage0 WithinPage1 eq
                {
                        RaysAngle0 90 add RaysAngleOffset sub 1 mul 360 div {dup 1 ge {1
sub} {exit} ifelse} loop  1  0.8  sethsbcolor  stroke
                }
                {
                        strokepath clipsave clip
                        % Help received at groups.google.com/group/comp.lang.postscript/
browse_thread/thread/888d4167a7eaadb2
                        <<
                                /Function
                                <<
                                        /DataSource
                                        RaysAngle0 90 add RaysAngleOffset sub 1 mul 360 div {dup 1 ge {1
sub} {exit} ifelse} loop  1  0.8  gsave sethsbcolor currentrgbcolor
grestore
                                        RaysAngle1 90 add RaysAngleOffset sub 1 mul 360 div {dup 1 ge {1
sub} {exit} ifelse} loop  1  0.8  gsave sethsbcolor currentrgbcolor
grestore
                                        (123456)  % 6 numbers, one byte each; can re-use string so will
                                        5 -1 0 {exch dup 4 2 roll exch  255 mul 0.5 add floor cvi  put}
for
                                        /BitsPerSample 8
                                        /FunctionType 0   /Domain [0 1]   /Range [0 1  0 1  0 1]   /Order
1   /Size [2]   /N 1
                                >>
                                /Coords [ X0 Y0 X1 Y1 ]
                                /ShadingType 2   /ColorSpace /DeviceRGB   /Extend [true dup]
                        >>
                        shfill cliprestore newpath
                } ifelse  % WithinPage0 WithinPage1 eq
        } ifelse  % ThisName ...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Lancaster  
View profile  
 More options Mar 12 2010, 1:29 pm
Newsgroups: comp.lang.postscript
From: Don Lancaster <d...@tinaja.com>
Date: Fri, 12 Mar 2010 11:29:02 -0700
Local: Fri, Mar 12 2010 1:29 pm
Subject: Re: shfill: /ShadingType 2, computed parameters

jdaw1 wrote:
>> You cannot use a PostScript function as the basis for the data in a Function dictionary.

> But is it possible to convert computed PostScript-function data to
> either of the formats allowed in a function dictionary? And if so,
> please, how?

You can easily use a PostScript function as the basis for the data in a
function dictionary.

That is one of PostScript's strongest features.

Exactly what are you trying to do?

--
Many thanks,

Don Lancaster                          voice phone: (928)428-4073
Synergetics   3860 West First Street   Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml   email: d...@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jdaw1  
View profile  
 More options Mar 14 2010, 6:09 pm
Newsgroups: comp.lang.postscript
From: jdaw1 <jdawise...@gmail.com>
Date: Sun, 14 Mar 2010 15:09:29 -0700 (PDT)
Local: Sun, Mar 14 2010 6:09 pm
Subject: Re: shfill: /ShadingType 2, computed parameters
> Exactly what are you trying to do?

Master a simple shading dictionary. With help given here, and some
inspiration of my own, that is now done.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »