[cairo] PNG backend

Bill Spitzak spitzak at d2.com
Tue Feb 17 12:36:01 PST 2004

On Tuesday 17 February 2004 07:48 am, Olivier Andrieu wrote:
>  > Hmm... does it make sense to require pixels_per_inch here? The
>  > current image_surface backend doesn't take this, and these two
>  > should probably be consistent.
> Well the pixels_per_inch is mainly here to provide a return value for
> the pixels_per_inch method of the backend. And it gets written in the
> PNG header too. But I guess it could use the same fixed value than the
> image backend.

It does seem like it would be useful to have any surface accept a way to set 
DPI. For Cairo the only effect would be to change what matrix you get when 
you request the default transformation. But backends could use this 
information for setting fields in output files or even controlling the scale 
of printing.

Since the default matrix rounds to the nearest integer multiple of 96 DPI (? 
or is it 72?) it won't work to have a call to set the default matrix, as the 
actual DPI cannot be recovered from that. Also it appears the exact rules for 
setting the default matrix should be coded explicitly into Cairo so nobody 
can mess them up.

Probably setting this should immediatly change the current transform to the 
default matrix for this new dpi. This will produce the expected result when 
people use it to initialize new surfaces, and you really should not change it 
while you are drawing.

Perhaps independent horizontal and vertical DPI could be specified, though 
I'm not really clear if Cairo supports non-square rasters on the backend 
(because the default matrix either must be non-integer in one direction, or 
it is allowed to produce non-square transformations).

If 2 numbers are supported and you need to send this information to an 
interface that only accepts one, I have found it best to use the vertical. 
Don't use the horizontal or any kind of mathematical combination of the 
horizontal and vertical.

                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com

More information about the cairo mailing list