[cairo] PDF Blend modes

Carlos Garcia Campos carlosgc at gnome.org
Wed Jun 17 09:45:12 PDT 2009


El mié, 17-06-2009 a las 18:02 +0200, Soeren Sandmann escribió:
> > > > I'm trying to implement the missing features in poppler cairo backend
> > > > (specially those that are present in splash backend). When I asked ickle
> > > > about blend mode operators in cairo, he told me that Company had started
> > > > to implement it some time ago[1]. So, I have taken Company's repos in
> > > > order to update them and try to use the new cairo operators in poppler. 
> > > > 
> > > > First I tried to rebase blend-mode pixman branch from current master,
> > > > but it was quite painful, too many conflicts, so I finally merged it as
> > > > a single patch. I've set up a public repository for this [2].
> > > 
> > > This looks great; thanks for doing this!
> > > 
> > > I can definitely understand why you decided to merge it as one big
> > > patch, but I'd really like to see it broken down a bit if
> > > possible. Benjamin's tree had a lot of small commits; if we can
> > > preserve at least some of them, that would be nice.
> > 
> > I finally rebased your repo to current master, see the new repo here:
> > 
> > http://cgit.freedesktop.org/~carlosgc/pixman/log/?h=blend-mode
> 
> Excellent. I merged it into my branch, with an additional commit to
> enlarge the default size of the composite test window.
> 
> > > * Review that what I did makes sense (both the code and the math in
> > >   the comment I added).
> 
> This is not likely to ever happen, I guess.
> 
> > > * Use floating point in the HSL modes
> > > 
> > >   Because I'm not sure that the overflow protection we have right now
> > >   is correct.
> 
> I'd still like to see this done. For reference:
> 
>         > >>  if (min < 0) {
>         > >>    tmp[0] = l + (tmp[0] - l) / 4 * l / (l - min) * 4;
>         > >>    tmp[1] = l + (tmp[1] - l) / 4 * l / (l - min) * 4;
>         > >>    tmp[2] = l + (tmp[2] - l) / 4 * l / (l - min) * 4;
>         > >>  }
>         > >>  if (max > a) {
>         > >>    tmp[0] = l + (tmp[0] - l) / 4 * (a - l) / (max - l) * 4;
>         > >>    tmp[1] = l + (tmp[1] - l) / 4 * (a - l) / (max - l) * 4;
>         > >>    tmp[2] = l + (tmp[2] - l) / 4 * (a - l) / (max - l) * 4;
>         > >>  }
>         > >
>         > > Where do those 4s come from?
>         > >
>         > Overflow protection. The tmp value can range from -COMP2_T_MAX .. 2
>         > *
>         > COMP2_T_MAX (I think), so I took the shortcut to just divide by a
>         > high
>         > enough number to avoid it. Also, this code will break on 64bit cases
>         > as I'm using ints there for lack of a signed comp4_t type.
>         > It's one of the cases I asked about previously on IRC I think as I
>         > was
>         > unsure if this is a case for doubles or how it should best be
>         > handled.
> 
>         I would be more comfortable with floating points, yes.
> 
> > > * Getting rid of component alpha versions of HSL and
> > >   return_if_fail()ing if you to use them with a component alpha
> > >   mask. [1]
> 
> And this should be a trivial change.

For the things I haven't said anything yet it doesn't mean I don't want
to do it, it's just that I started with the easiest things :-P

> 
> 
> Thanks,
> Soren


-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
 digitalmente
Url : http://lists.cairographics.org/archives/cairo/attachments/20090617/4efb833e/attachment.pgp 


More information about the cairo mailing list