Method Cairo.Surface()->set_device_scale()


Method set_device_scale

void set_device_scale(float|int x_scale, float|int y_scale)

Description

Sets a scale that is multiplied to the device coordinates determined by the CTM when drawing to this surface. One common use for this is to render to very high resolution display devices at a scale factor, so that code that assumes 1 pixel will be a certain size will still work. Setting a transformation via Context->scale() isn't sufficient to do this, since functions like Context->device_to_user() will expose the hidden scale.

Note that the scale affects drawing to the surface as well as using the surface in a source pattern.

Parameter x_scale

a scale factor in the X direction

Parameter y_scale

a scale factor in the Y direction