Skip to content

Draft: Add support for HiDPI images and animations

Currently I have modified ply-image to support loading an image assuming a scale, or to have it try loading an alternative at a given device scale. Opaquely making ply-image load the image data at a device scale doesn't really work to my knowledge, since ply-image is used both per-view and per-plugin, and in the latter case there can be multiple-different device scales required.

There's also a ply-multiscale-image now, for images that are available in multiple resolutions, which takes care of loading these different resolutions and picking the right one for a given scale (to replace the use of plugin level images, which are used across different views with possibly different device scales).

Since icons are already per-view I've just made them accept a device scale and use that for loading their image (falling back to scale 1 if no version at the device scale is available).

ply-animation is also used per-view only, so I'm currently working on just having it load either versions of the images at the correct scale or if not available (even in part, i.e. if the number of images at a given scale differ) fall back to the default scale of 1.

The naming scheme I'm currently using just has the current names for scale 1 (e.g. keyboard.png) and names suffixed with @<scale> (e.g. keyboard@2.png) for a given device scale.

Current remaining TODOs:

  • Figuring out why I'm only getting device scales of 1 in my plymouth tests with the X11/GTK backend on my 4k displays.
  • Getting HiDPI animations to work properly
  • HiDPI support for ply-entry
  • HiDPI support for ply-throbber
  • HiDPI support for other custom animations (probably using newly introduced ply-image-sequence)

So far I'm just assuming that device scales are either 2 or 1, but I do try to write my code in a way that it could deal with alternative scales as well.

The current code still has some issues and might need some re-organizing (hence a draft PR for now), but I'm slowly getting somewhere.

Fixes #76.

Edited by Hans Christian Schmitz

Merge request reports