mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
51b11486c5b84d453880f1ca1ca86f82004bd6dd
When no scale factor is set, scale by 1.0, mapping one image pixel to one device-independent pixel. This matches the behavior of CSS and other frameworks. The old code attempted to convert to Dp while taking the image's DPI into account. This was wrong in two ways: - It assumed that the default display DPI is 160, but this is only true for Android. Other platforms use 96, 162, or leave it undefined. Thus image.Layout's idea of a dp didn't match that of Gio on most platforms. - It tried to account for image DPI, and assumed a default of 72. This was wrong in that DPI in images is merely metadata meant for printing, not display. The vast majority of software such as image viewers and image editors do not take DPI into account, mapping one image pixel either to one physical pixel or to one device-independent pixel. That is, users would expect their images to either display 1 to 1, or scaled based on PxPerDp, but not scaled based on the image's DPI. We default to a scale of 1 to stay consistent with other parts of Gio that scale by default. Users who don't want any scaling can continue to set the scale to the inverse of PxPerDp. While we're here we clarify the documentation of the Scale field. This change is backwards incompatible for users that relied on the default scale. Signed-off-by: Dominik Honnef <dominik@honnef.co>
Gio - https://gioui.org
Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly (experimental).
Installation, examples, documentation
Go to gioui.org.
Issues
File bugs and TODOs through the issue tracker or send an email to ~eliasnaur/gio@todo.sr.ht. For general discussion, use the mailing list: ~eliasnaur/gio@lists.sr.ht.
Contributing
Post discussion to the mailing list and patches to gio-patches. No Sourcehut account is required and you can post without being subscribed.
See the contribution guide for more details.
An official GitHub mirror is available.
Description
Languages
Go
89.6%
C
7%
Java
1.7%
Objective-C
1.6%