Hello,

The function is something used mostly by shading types 1, 2 and 3. It uses as input either the coordinates, or the result of a formula based on them. Enter "FunctionType" in the PDF spec.

Re: the proposal, no I don't have a sample. I don't even know how the google format looks like. What I'd expect to see is your background, what you are studying, what are you mostly focused on in these studies, what are your skills / experiences, and why do you think you're "the one" for this project. And maybe a few lines how you're going to crack the two core problems (1. point inside/outside, 2. color). If you don't know, then maybe a few lines explaining what you will want to learn to know it.

Tilman



Am 12.03.2014 14:39, schrieb Thimal Kempitiya:
Hi Tilman,

  Thanks for the feedback. What you mean by the function calculations is it
function evaluation method can you please give more information on it.

About the proposal what advise can you give, is there specific way that
pdfbox expect apart form the gsoc format and is there any sample proposal
that we can get idea about writing proposal.


On Sun, Mar 9, 2014 at 8:42 PM, Tilman Hausherr <[email protected]>wrote:

Hello,

Yes this is an interesting idea. It would save the recalculation of "y1y0
* (y + j - coords[1])" everytime. (Unless the java compiler detects this
already)
But don't expect too much from it - I believe more time is lost in
function calculation (at least for types 1, 2 and 3 where functions are
mandatory).

Tilman


Am 09.03.2014 15:12, schrieb Thimal Kempitiya:

  Thanks Tilman
for optimization  in speed I think we need to facus on methods which use
again and again like getRaster

for the axial shading part current implementation in the getRaster method
we calculate the x' value for the raster inside the for by for loop

   for (int j = 0; j < h; j++)
          {
              for (int i = 0; i < w; i++)
              {
                  useBackground = false;
                  double inputValue = x1x0 * (x + i - coords[0]);
                  inputValue += y1y0 * (y + j - coords[1]);

but all the time changing happen in the i and j values and they vary from
0<j<h and 0<i<w
so the contribution form i and j values can be calculation in separate 2
for loops which run from 0 to h and 0 to w and calculate these values
separately and put them in 2 arrays and when we need to evaluate we can
add
to the input value

this will reduce the calculations inside the for by for loop and put them
inside a 2 for loops this may be speed up the axial shading

what you think about it


On Fri, Mar 7, 2014 at 11:44 PM, Tilman Hausherr <[email protected]
wrote:
  Am 07.03.2014 15:03, schrieb Thimal Kempitiya:
   Thanks Tilman for the feedback

http://www.particleincell.com/blog/2012/quad-interpolation/ seems like
opposite of what we are going need to check whether its work with this
by
implementing it (but can easily implement if we used library with matrix
manipulations)

  This is really up to you :-)  Re: the pure math parts, its rather me
who
is learning something.

Re: library, you can use the java standard library, or any library with
Apache license or compatible license.



  can I know more about the optional part in the issue
"Optional:
Review and optimize the complete shading package; implement cubic spline
interpolation for type 0 (sampled) functions."

where I can get more information about the cubic spline interpolation
for
type 0 (sampled) functions and in what aspects do you expect the
optimization.

  Optimization for speed. Especially the axial shading. It gets slow when
the shaded area is very large.

The cubic spline interpolation is mentioned in the PDF spec at the type 0
(sampled) functions, it is the part where order = 3. In the PDF spec,
search for it, or for "Additional entries specific to a type 0 function
dictionary". Its really just a "nice to have" and of low priority.
There's
a note from adobe telling that it is not done for printing.

Tilman




On Tue, Mar 4, 2014 at 10:13 PM, Tilman Hausherr <[email protected]

wrote:

   Am 04.03.2014 15:19, schrieb Thimal Kempitiya:

    Hi,

  I checked the code related to the shading and studied the pdf spec
related
to the type 6. As I see it is going same as the type 4
    From what I feel this is need to be done correct me if I'm wrong
first need to get the 12 control points and colors related to each
unit
from stream

   Yes

    create the 4 cubic Bézier curves which are boundaries of each patch
(
to

  find a Bézier curve it need 4 control points, two points are part of
the
curve )

   Yes, although they are not painted as a curve, the curve is part of
a

formula to find out whether a point is inside or outside the patch.

    given point need to find the point which patch (I think this can be

  done[1]<http://en.wikipedia.org/wiki/Plane_%28geometry%29>but need
research on that)
find the color of the point using bi linear interpolation

   Probably. Although I'm not sure if the bilinear interpolation is the

same
as used for a rectangle.
http://www.particleincell.com/blog/2012/quad-interpolation/
I also don't know if the curves needs to be taken into account.


    This has the same structure as the other shading types but need to

  structure to keep Bézier curves and patches
and patches are connected as in the type4

   Yes, the data structure is similar. You can use existing code and do

lot
of copy & paste there, although there is some rearrangement needed as
there
are more points.



   I have to study the type 7 but I think its similar to this

   According to the spec, type 6 is a special case of type 7. I cannot

tell
whether it is enough to implement type 7 only and derive type 6 from
it,
i.e. I don't know if the performance would be worse.

Tilman


   please give feedback on my approach

[1]http://en.wikipedia.org/wiki/Plane_%28geometry%29<http
://en.wikipedia.org/wiki/Plane_%28geometry%29>




On Sun, Mar 2, 2014 at 11:18 AM, Thimal Kempitiya <
[email protected]

  wrote:
     yeah I'm using  trunk code(2.0) and I wanted to render the image
got
it,

  thanks. I'm currently studying the 1 to 5 shading implementations and
the
pdf spec related to 6 and 7 type shading and i'll buzz you if i got
issue.
Once again thanks for quick reply


On Sat, Mar 1, 2014 at 2:38 AM, John Hewson <[email protected]>
wrote:

    You'll need to use the latest 2.0.0 snapshot jar, which is the
unstable

  version from trunk
and the place where new development occurs.

-- John

On 28 Feb 2014, at 05:04, Thimal Kempitiya <[email protected]>
wrote:

    Hi,

  I'm Thimal Kempitiya, third year computer science and engineering
undergraduate at university of moratuwa. I'm interested in the
project

   idea

   "implement shading with Coons and tensor-product patch meshes". I

have

   the

   basic knowledge about the cubic Bézier curves", , "bilinear

   interpolation",

   " and "Bernstein polynomials and i think can manage rest of the

   mathematics

   needed for this project. Also I have the java knowledge to do the

implementation part.

I clone the PDFBOX repository and checked the code regarding to the

   shading

   and I tried some examples in pdfbox cook book.

Also I tried code to work with the type 1 shading type.

           File f=new File("C:\\asy-latticeshading.pdf");
           try {
               PDDocument doc=PDDocument.load(f);
                  PDPage p;
             p=(PDPage)doc.getDocumentCatalog().
getAllPages().get(0);
             PDShadingType1 pdst1=new PDShadingType1(p.
getCOSDictionary());
             PDRectangle pdr=p.findCropBox();
             PDGraphicsState pdg=new PDGraphicsState(pdr);
             Matrix m=pdg.getCurrentTransformationMatrix();
             Type1ShadingPaint t1sp=new Type1ShadingPaint(pdst1, m,
(int)p.findCropBox().getHeight());

But this give me error saying unknown shading type 0
java.io.IOException: Error: Unknown shading type 0

can you please tell me what I'm doing wrong here and how can i
solve

   this.

   --



*Thimal Kempitiya <http://www.facebook.com/thimalk>

   UndergraduateDepartment

   of Computer Science and Engineering University of Moratuwa.*

    --


*Thimal Kempitiya <http://www.facebook.com/thimalk>
UndergraduateDepartment of Computer Science and Engineering
University
of
Moratuwa.*






Reply via email to