wip/hires-icons



Fellow hackers,

In the last days I've been pushing into wip/hires-icons some work to
make GTK+3 able to render icons in a way so it can adapt to higher pixel
densities such as that of retina displays.

First of all, I'm aware this partially collides with Alex's work[1], but
on this branch the backing surface scale details have just been sorted
out for the Quartz backend, so the meat in this branch can still greatly
benefit from his work on X11 and Wayland, plus it'd mean plugging less
holes to get the right icon scale at render time.

This branch doesn't precisely reinvent the wheel, there's just a few API
additions to current components to have this work as seamlessly as
possible. As choosing an icon must be postponed till rendering time, the
preferred way to hold this information is GtkIconSet and GtkIconSource,
as these already do a few things we want here:

  * It may already hold multiple sources for an image
  * GtkIconSize works as a scale-independent size abstraction

This has implied making GtkIconSets more prominent, so the matching
properties have been added to GtkEntry and GtkCellRendererPixbuf.

GtkIconTheme has been regarded as a lower level file->pixbuf abstraction
and mainly a few *_for_scale() calls have been added there so
GtkIconSets can resolve rendering to the best pixbuf.

The icon theme parser has been added a extra "OutputScale" per-directory
property, so there may be directories containing upscaled variants that
are preferred over "bigger" icons meant for 1x. This way asking for a
16x16 icon on a double-density display could first resort to a 16x16 2x
version over the traditional 32x32 or upscaled 16x16 versions of the
icon. This means an addendum to the Icon Theme specification though.

As for applications doing custom icons, it'd be matter of (optionally)
registering a GtkIconSize, and setting multiple GtkIconSources into a
GtkIconSet, so very similar to the current way of doing things.

Comments welcome,
  Carlos

[1] https://bugzilla.gnome.org/show_bug.cgi?id=683365



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]