Skip to main content
sasikumars93559897
Participant
March 20, 2015
Question

how the axial shading is preserve in pdf

  • March 20, 2015
  • 1 reply
  • 1089 views

@@using Shading Dictionary to perform shading in pdf,before that the shading dictionary call from Pattern Dictionary.In the Pattern Dictionary there is an Matrix based on the matrix value  location the shading operation is perform,So i dont know how to calculate value of pattern Dictionary matrix value.

10 0 obj

<< /Type /Pattern

/PatternType 2

/Shading 11 0 R

/Matrix [1.00 .00 .00 1.00 54.00 53.00]  // the matrix value how to calculate

>>

11 0 obj

<<

/ColorSpace /DeviceRGB

/Function 12 0 R

/ShadingType 2

/Coords [109.2726 69.00 109.2726 .00]

/Extend [true true]

>>

12 0 obj

<<

/FunctionType 0

/Domain [.00 1.00]

/Range [.00 1.00 .00 1.00 .00 1.00]

/Size [1002]

/BitsPerSample 8

/Length 3006

>>

stream

here is an stream of colors

endstream

endobj

Can anybody help me please.

Regards, Sasi kumar sekar.

This topic has been closed for replies.

1 reply

Participating Frequently
March 20, 2015

Hi, Sasi -

The Matrix maps coordinates in your shading dictionary into User Space. That is, the Matrix entry in the Pattern dictionary specifies a coordinate transformation that will be applied to coordinates specified in the shading dictionary.

To take your example, you have an axial shading extending from (rounding off) 109,69 to 109,0.  Your Pattern dictionary specifies the Matrix

[ 1  0  0  1  54  53 ]

This transformation matrix corresponds to a scale of 1,1 (that is, no change in scale) and a translation of 54,53. Thus, the actual endpoints for the axial shading will be the User Space positions 163,122 and 163,53 (assuming I’ve added correctly).

As to what values to use for your Matrix, it depends on how you’ve set up your Shading dictionary. If the coordinates you’ve specified are actually where you want the gradient to go, then just use an identity matrix

[ 1  0  0  1  0  0 ]

By the way, are you sure that the Pattern dictionary includes a Matrix entry? I seem to remember (it's been a while since I've looked at Patterns) that the matrix is supplied as an argument to the makepattern operator:

<<patternDict>> [ 1 0 0 1 0 0 ] makepattern

Hope that helps.

- John Deubert

  Acumen Training

  PostScript and PDF

  Training & Consulting