[poppler] poppler/Gfx.cc

2010-12-23 Thread Albert Astals Cid
 poppler/Gfx.cc |   25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 0294d6e50691a3e40fad0d6e4fa9056944a91efd
Author: Thomas Freitag thomas.frei...@alfa.de
Date:   Thu Dec 23 15:56:32 2010 +

Be more correct when drawing radial shadings

Fixes 32349

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 6b80e90..09c5381 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -2924,17 +2924,24 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
 tb = t0 + sb * (t1 - t0);
 getShadingColorRadialHelper(t0, t1, tb, shading, colorB);
 while (ib - ia  1) {
-  if (isSameGfxColor(colorB, colorA, nComps, radialColorDelta)  ib  
radialMaxSplits) {
+  if (isSameGfxColor(colorB, colorA, nComps, radialColorDelta)) {
 // The shading is not necessarily lineal so having two points with the
 // same color does not mean all the areas in between have the same 
color too
-// Do another bisection to be a bit more sure we are not doing 
something wrong
-GfxColor colorC;
-int ic = (ia + ib) / 2;
-double sc = sMin + ((double)ic / (double)radialMaxSplits) * (sMax - 
sMin);
-double tc = t0 + sc * (t1 - t0);
-getShadingColorRadialHelper(t0, t1, tc, shading, colorC);
-if (isSameGfxColor(colorC, colorA, nComps, radialColorDelta))
-  break;
+int ic = ia + 1;
+for (; ic = ib; ic++) {
+  GfxColor colorC;
+  const double sc = sMin + ((double)ic / (double)radialMaxSplits) * 
(sMax - sMin);
+  const double tc = t0 + sc * (t1 - t0);
+  getShadingColorRadialHelper(t0, t1, tc, shading, colorC);
+  if (!isSameGfxColor(colorC, colorA, nComps, radialColorDelta)) {
+break;
+  }
+}
+ib = (ic  ia + 1) ? ic - 1 : ia + 1;
+sb = sMin + ((double)ib / (double)radialMaxSplits) * (sMax - sMin);
+tb = t0 + sb * (t1 - t0);
+getShadingColorRadialHelper(t0, t1, tb, shading, colorB);
+break;
   }
   ib = (ia + ib) / 2;
   sb = sMin + ((double)ib / (double)radialMaxSplits) * (sMax - sMin);
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Creating PDF with poppler ?

2010-12-23 Thread Albert Astals Cid
Will have a look at it after we release 0.16.0

Albert

A Dilluns, 20 de desembre de 2010, Thomas Freitag va escriure:
 Hi all!
 
 How I promised long time ago, here now a patch for the poppler writing
 routines and some new helper function, together with two small sample
 programs using them.
 
 In merging the writer routines I encountered, that some of the problems
 I found are solved in the meantime. So, where they are solved, I left
 the code as it is, but manually merging could always cause new problems.
 
 The main changes beside solving some smaller problems are that I make
 the most writer routines static, and that I add a new parameter
 numoffset. The reason for this is the small sample program pdfmerge,
 which merges several PDF to one bigger PDF, so there I have no PDFDoc
 object for the resulting PDF, and I have to change the num values of
 each single PDF.
 
 The other small sample program I add is to do the other way round:
 Extract one or more pages from a multi page PDF to several one page PDFs.
 
 I'm not an expert in configure, so I just attach the single main cc's.
 Building the programs is simular topdftotext, they need parseargs and
 the poppler library. So I would appreciate any help on this.
 
 I think the patch together with the samples could make it easier to file
 samples for bugs, i.e. extracting only the page or pages which causes a
 regression, or merge several sample PDFs which causing regressions.
 
 What are You thinking about it? Helpful or not?
 
 Best regards,
 Thomas
 
 Am 28.10.2010 15:49, schrieb Jennings Jay:
  Hi poppler folks,
  
  I am looking for a C++ example that creates PDF files using the
  poppler library.  I have poppler compiled (Windows XP / Visual Studio
  2008) and I have working examples that **read** a PDF, but I don't see
  anything in the poppler codebase, documentation, or mailing-list
  archives to show how to **create** a PDF.  My real goal is to create a
  Geospatial PDF, but any kind of simple PDF creation example would
  probably help a lot.   Thanks for the pointer.
  
  .**
  
  *Jay Jennings***
  
  Senior Software Engineer
  
  www.geoeye.com http://www.geoeye.com
  
  703.480.4614
  
  jennings@geoeye.com
  
  21700 Atlantic Blvd. Dulles, VA 20166
  
  cid:image001.png@01C9DE0A.57705A70 http://www.geoeye.com/CorpSite
  
  */Trusted Imagery Experts/*
  
  
  ___
  poppler mailing list
  poppler@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/poppler
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler