[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: Implementing HiDpi scaling
From:       Uli Schlachter <psychon () znc ! in>
Date:       2024-03-16 17:27:56
Message-ID: 83b8399a-f5a2-47af-8f51-6486760e4b2e () znc ! in
[Download RAW message or body]

Hi

Am 14.03.24 um 16:34 schrieb fedang:
> Hello all,
> 
> I am writing a small X11 app using cairo as the drawing backend. I was 
> wondering if and how to implement
> fractional scaling to accommodate high dpi screens. After searching 
> online I found almost nothing, so here I am.
> 
> Can someone give me some pointers on what to do? I can get a scale 
> factor for the screens (depending on the size)
> but I have no idea how to actually use it in the draw code.

I'm not sure if I understand the question. You can use cairo_scale() to 
set a scale factor for all drawing. So I would say that you can just 
apply the scale factor with cairo_scale() before drawing.

Of course, this assumes that you don't use cairo_identity_matrix() or 
cairo_set_matrix() in your drawing. Instead, cairo_save() and 
cairo_restore() should be used around temporary modifications of the 
transformations.

Cheers,
Uli
-- 
Do you remember what we used to say back then?
One impossible thing at a time.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic