[cairo] problem with scaling images

Benjamin Berg benjamin at sipsolutions.net
Mon Jul 18 03:23:39 PDT 2005


On Do, 2005-07-14 at 14:30 -0400, Kristian Høgsberg wrote: 
> > I am trying to draw scaled images, but somehow they fade out at one
> > side, and are placed at the wrong position. For an example see:
> > http://benjamin.sipsolutions.net/screenshots/zenity-wrong.png
> > as a reference, an old version not rendered with cairo:
> > http://benjamin.sipsolutions.net/screenshots/zenity-correct.png
> > 
> > For example look at the top of the buttons. The line should have full
> > opacity everywhere, but at the left it transparent.
> > 
> > To demonstrate this, here a screenshot where only the corners are drawn:
> > http://benjamin.sipsolutions.net/screenshots/zenity-corners-only.png
> 
> I wasn't able to view any of your sipsolutions.net screenshots or get 
> the theme source code, I got "Document contains no data".  From your 
> description of the problem, it sounds like a workaround could be setting 
> the pattern filtering to be CAIRO_FILTER_NEAREST:

That might work in this case, but it is really not the thing I want to
do (Some pictures should not be scaled with NEAREST, this can currently
be chosen by the theme. Though I am currently ignoring the setting in
the cairo code.).

> but I think the real problem could be an off-by-one error in the width 
> calculation in your code, or in possibly in cairo. 

I do not think that the error is in my code. Some of those pictures are
just 1 pixel in width, and do not have any alpha around them (and
cutting parts out of it with gdk_pixbuf_new_subpixbuf, can not add any
junk).

>                                                    If you can put the 
> code and the screenshots up somewhere where I can get them, I'll take a 
> look.
The server was down, should not be a problem anymore.

---

I have updated the tarball with different if statements testing the
different things I have tried.

http://benjamin.sipsolutions.net/experience-cairo.tar.bz2
It also contains some screenshots for each of the if statements.
The screenshots are also available from
http://benjamin.sipsolutions.net/screenshots/experience-cairo


Benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050718/e9fc1bf8/attachment.pgp


More information about the cairo mailing list