[cairo] Cairo/PNG shaked up.
Hans Breuer
hans at breuer.org
Sun Apr 17 12:09:57 PDT 2005
Am 17.04.2005 um 19:14 schrieb Owen Taylor:
> On Sun, 2005-04-17 at 17:28 +0200, Hans Breuer wrote:
>> Am 12.04.2005 um 16:19 schrieb Carl Worth:
>>
>>> On Sun, 10 Apr 2005 22:35:04 +0100, "Hans Breuer" wrote:
>>>> While updateing my Cairo/Dia plug-in [1] I stumpled not only about
>>>> about lost convenience [2] (PNG output needs to be special cased
>>>> now)
>>>
>>> Well, it's different convenience, not lost. The idea is that now
>>> you'll be able to take your xlib_surface and then generate PNG output
>>> from it with cairo_surface_write_png, (rather than having to create a
>>> distinct png_surface type in the first place).
>>>
>>>> but also about Cairo apprently not respecting the scale of the
>>>> output
>>>> anymore [3] or the image backend is missing some appropriate DPI
>>>> default.
>>> [...]
>>>> [3] http://hans.breuer.org/dia/render-test-shaked-up.png
>>>
>>> I'm not sure what that image is supposed to look like, but I did just
>>> fix a bug with cairo_show_surface in which the data was being
>>> translated to the wrong place, (resulting in the display of garbage
>>> memory). You might give the latest in CVS a try and see if it's any
>>> better. Otherwise, let me know more specifically what's going wrong.
>>>
>> Just tested with current cvs and the defect is still the same. It
>> seems
>> as if cairo_scale(about 20x) does not have an effect at all.
>> The broken and right output (generated with a prevoius version)
>> are at http://hans.breuer.org/dia/dia-cairo-broken.htm
>
> I don't think this has anything to do with the PNG changes ... more
> likely something to do with the recent matrix changes. But Cairo scale
> seems to be working in general. Would it be possible to come up with
> a small test case?
My smallest test case is
http://cvs.gnome.org/viewcvs/dia/plug-ins/cairo/diacairo.c?
rev=1.15&view=log
Looking to make it even smaller I tried a little change. If in the
initilaization
sequence
renderer->cr = cairo_create ();
cairo_scale (renderer->cr, renderer->scale, renderer->scale);
cairo_translate (renderer->cr, -renderer->dia->extents.left,
-renderer->dia->extents.top);
cairo_set_target_surface (renderer->cr, renderer->surface);
/* clear background */
the set_target_surface() call is moved before the scale() call the
scaling
is right again - for the PNG export case. I haven't tested with the
other
backends, but think the order of calls should not be decisive here.
Bug or feature?
Hans
More information about the cairo
mailing list