[poppler] Followup Bug 32349 & Poppler: More shading fun ;-)

Andrea Canciani ranma42 at gmail.com
Fri Dec 31 07:50:21 PST 2010


On Fri, Dec 31, 2010 at 4:38 PM, Leonard Rosenthol <lrosenth at adobe.com> wrote:
> I did "Save as PNG" on each of the files and then zipped them up.  You can find them at <http://dl.dropbox.com/u/1644474/Gradient_Issues.zip>.

They look quite different from what I would expect to be the correct result.
The other cases might be harder to check, but it's very easy to see that
radial gradients in radial-gradient-one-stop should not contain colors
different from red.

I will try to modify the test a little so that it generates integer coordinates.
This should make it easier to verify what the behavior should be.

Andrea

>
>
> Leonard
>
> -----Original Message-----
> From: Andrea Canciani [mailto:ranma42 at gmail.com]
> Sent: Friday, December 31, 2010 10:01 AM
> To: Leonard Rosenthol
> Cc: Thomas Freitag; Albert Astals Cid; poppler
> Subject: Re: [poppler] Followup Bug 32349 & Poppler: More shading fun ;-)
>
> On Fri, Dec 31, 2010 at 3:28 PM, Leonard Rosenthol <lrosenth at adobe.com> wrote:
>> Not sure what version of Acrobat/Reader on what OS platform you tested with, but Acrobat X Pro on Windows just opened and rendered these documents quite fine.  (though they look really weird!)
> Yes, they are supposed to look weird, they're very artificial tests
> which trigger different cornercases in cairo.
>
> Adobe Reader 9.4.1 on Ubuntu 10.4 produces these results:
> http://people.freedesktop.org/~ranma42/cairo/radial/acroread/
>
> The test is structured as a 4x7 matrix. To indicate the errors I'll
> number rows from 1 to 4 (top to bottom) and columns from 1
> to 7 (left to right):
>  - radial-gradient-one-stop looks incorrect in (2,2), (2,6), (3,2), (3,6)
>  - all other tests look incorrect in (4,2).
>
> Can you confirm that the proposed rasterization (i.e.
> http://people.freedesktop.org/~ranma42/cairo/radial/*.image.*)
> is the correct one?
> Does Acrobat X Pro agree with it or with Adobe Reader 9.4.1?
> This is essentially the same question as http://forums.adobe.com/message/3316526
>
> Thank you for looking into this
>
> Andrea
>
>>
>> Leonard
>>
>> -----Original Message-----
>> From: poppler-bounces+leonardr=adobe.com at lists.freedesktop.org [mailto:poppler-bounces+leonardr=adobe.com at lists.freedesktop.org] On Behalf Of Andrea Canciani
>> Sent: Friday, December 31, 2010 8:25 AM
>> To: Thomas Freitag
>> Cc: Albert Astals Cid; poppler
>> Subject: Re: [poppler] Followup Bug 32349 & Poppler: More shading fun ;-)
>>
>> On Fri, Dec 31, 2010 at 3:10 AM, Thomas Freitag
>> <Thomas.Freitag at kabelmail.de> wrote:
>>> I made a lot of mistakes, but I'm quite close now, s. attached rendering of
>>> Andrea's PDF. What is still up to do, is
>>
>> Wow, that's really good!
>>
>>> a) speed it up again
>>> b) implement the shading extend in a correct way (I'd already a look at it,
>>> it's also wrong implemented in Gfx)
>>> c) run it again through my own regression test.
>>
>> I'd like to provide another set of "difficult" radial gradients,
>> because the test
>> I posted isn't checking some interesting cases (in particular the case where
>> start and end circle are tangent):
>> http://people.freedesktop.org/~ranma42/cairo/radial/
>>
>> This folder contains some pdf files and the expected rasterization.
>> Adobe Reader seems to be unable to display these files (it just hangs),
>> so I also created some "reduced" versions:
>> http://people.freedesktop.org/~ranma42/cairo/radial/
>>
>> Adobe Reader can display the reduced files, but all of them look incorrect
>> in the second column (start circle tangent inside end circle).
>>
>>>
>>> But first I need a little bit to sleep :-)
>>
>> Sorry for trying so hard to make your code fail ;P
>> FWIW I'm doing the same against my own radial gradient implementation
>> in pixman (which right now fails with tangent circles, but I already have a
>> patch to fix it).
>>
>> Andrea
>>
>>>
>>> Thomas
>>>
>>> Am 30.12.2010 12:20, schrieb Thomas Freitag:
>>>>
>>>> I just recognized a bug with Andrea's PDF when drawing non centered
>>>> circles. Want to fix that first before sending a new patch.
>>>>
>>>> Thomas
>>>>
>>>> Am 30.12.2010 11:29, schrieb Albert Astals Cid:
>>>>>
>>>>> A Dijous, 30 de desembre de 2010, vàreu escriure:
>>>>>>
>>>>>> Sorry, I attached Your "new.png", not mine. Here the correct one
>>>>>> produced with the above changes.
>>>>>
>>>>> This looks good enough for me, can you send the full patch to the list?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Albert
>>>>>
>>>>>> Thomas
>>>>>>
>>>>>> Am 30.12.2010 10:31, schrieb Thomas Freitag:
>>>>>>>
>>>>>>> Hi Albert!
>>>>>>>
>>>>>>> I changed the SplashRadialPattern::getColor a little bit to solve
>>>>>>> this. It is still a little bit different from the old one, in my
>>>>>>> opinion a little bit better, but that's just a flavour, and in other
>>>>>>> cases it could be a little bit more worse. So if You agree, I can send
>>>>>>> a complete new patch.
>>>>>>>
>>>>>>> BTW, as You probably see, Andrea attached his PDF to the closed bug
>>>>>>> 32349. I saw already yesterday, that also the new rendering with the
>>>>>>> latest patch is quite better than the old rendering, but it's still
>>>>>>> not shown what Acrobat reader shows. I'll have an additional look in
>>>>>>> it, but I fear that this will be again a bigger job (the PDF has 128
>>>>>>> radial shadings, and only some of them are still buggy!). So (if not
>>>>>>> solvable in time) I would prefer to close this thread first, and then
>>>>>>> reopen the bug or create a new one.
>>>>>>>
>>>>>>> Do You agree, or do You have other ideas?
>>>>>>>
>>>>>>> Thomas
>>>>>>>
>>>>>>> FYI, here the changes:
>>>>>>>
>>>>>>> GBool SplashRadialPattern::getColor(int x, int y, SplashColorPtr c) {
>>>>>>>
>>>>>>>   double xc, yc;
>>>>>>>   int xs, ys;
>>>>>>>   Guchar *bitmapAlpha;
>>>>>>>
>>>>>>>   bitmapAlpha = bitmap->getAlphaPtr();
>>>>>>>   ictm.transform(x, y,&xc,&yc);
>>>>>>>   xs = splashRound(xc);
>>>>>>>   ys = splashRound(yc);
>>>>>>>   // Because of rounding problems, coordinates could be
>>>>>>>   // outside the bitmap. Reset them on the outer bound now
>>>>>>>   // and let it up to the alpha channel if they are shown:
>>>>>>>   if (xs<  0) xs = 0;
>>>>>>>   if (xs>= bitmap->getWidth()) xs = bitmap->getWidth() - 1;
>>>>>>>   if (ys<  0) ys = 0;
>>>>>>>   if (ys>= bitmap->getHeight()) ys = bitmap->getHeight() - 1;
>>>>>>>   if (bitmapAlpha[ys * bitmap->getWidth() + xs])
>>>>>>>
>>>>>>>       bitmap->getPixel(xs, ys, c);
>>>>>>>
>>>>>>>   else
>>>>>>>
>>>>>>>       return gFalse;
>>>>>>>
>>>>>>>   return gTrue;
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> Am 29.12.2010 23:28, schrieb Albert Astals Cid:
>>>>>>>>
>>>>>>>> First page, left of the "title". A few white pixels in there.
>>>>>>>>
>>>>>>>> Albert
>>>>>>>>
>>>>>>>> A Dimecres, 29 de desembre de 2010, Thomas Freitag va escriure:
>>>>>>>>>
>>>>>>>>> Am 29.12.2010 18:53, schrieb Andrea Canciani:
>>>>>>>>>>
>>>>>>>>>> On Wed, Dec 29, 2010 at 4:48 PM, Thomas Freitag
>>>>>>>>>>
>>>>>>>>>> <Thomas.Freitag at kabelmail.de>    wrote:
>>>>>>>>>>>
>>>>>>>>>>> ...
>>>>>>>>>>> I made a mistake when solving the problem with
>>>>>>>>>>> altona_visual_1v2a_x3.pdf. I find now a better way to solve it,
>>>>>>>>>>> which
>>>>>>>>>>> also gives a better look of the printer paper back again.
>>>>>>>>>>
>>>>>>>>>> I'd like to point yo to another pdf whose rendering regresses with
>>>>>>>>>> the
>>>>>>>>>> patch: https://bugs.freedesktop.org/attachment.cgi?id=41506
>>>>>>>>>
>>>>>>>>> Albert, can You please just change two lines in the former patch?
>>>>>>>>> 1. In SplashOutputDev.cc in the constructor of SplashRadialPattern,
>>>>>>>>> replace
>>>>>>>>> + bitmap = new SplashBitmap(splashRound(width) + 1,
>>>>>>>>> splashRound(height)
>>>>>>>>> + 1, colorMode != splashModeMono1, colorMode, gTrue);
>>>>>>>>> through
>>>>>>>>> +      bitmap = new SplashBitmap(splashRound(width) + 2,
>>>>>>>>> splashRound(height) + 2, colorMode != splashModeMono1, colorMode,
>>>>>>>>> gTrue);
>>>>>>>>> 2. In Splash.cc in the painting routine radialShadedFill, where the
>>>>>>>>> smaller extend circle is painted, replace
>>>>>>>>> + drawPartEllipseLine(&pipe, 2* yo - curY, xMin, xMax);
>>>>>>>>> through
>>>>>>>>> +                drawPartEllipseLine(&pipe, curY, xMin, xMax);
>>>>>>>>> (curY is alfready recalculated two line before!)
>>>>>>>>>
>>>>>>>>> Or just reapply the attached patch.
>>>>>>>>> This solves the rendering regressions mailed by Andrea.
>>>>>>>>>
>>>>>>>>> Thomas
>>>>>>>>>
>>>>>>>>>> In the last row, half of the inner circle is transparent with
>>>>>>>>>> poppler/master+radialsh.patch.
>>>>>>>>>>
>>>>>>>>>> Andrea
>>>>>>>>>>
>>>>>>>>>> PS: Sorry for removing most of the thread from this message, but
>>>>>>>>>> gmail
>>>>>>>>>> squashed it to just one level.
>>>>>>>>>> _______________________________________________
>>>>>>>>>> poppler mailing list
>>>>>>>>>> poppler at lists.freedesktop.org
>>>>>>>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>>>>>>>>
>>>>>>>>>> .
>>>>>
>>>>> .
>>>>>
>>>>
>>>
>>>
>> _______________________________________________
>> poppler mailing list
>> poppler at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>
>


More information about the poppler mailing list