Image scaling for Platform RegisterImage and RegisterRGBAImage?

Mitchell <[email protected]> Tue, 6 May 2025 18:11:37 -0400
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
Hi Neil,

Is there any appetite for modifying the Platform RegisterImage and RegisterRGBAImage interfaces to add a scaling parameter? Presumably one can call SCI_RGBAIMAGESETSCALE before calling SCI_REGISTERIMAGE or SCI_REGISTERRGBAIMAGE, just like for registering marker images.

I have a proof-of-concept for Qt that draws 16x16@2x images in autocompletion lists on a HiDPI/Retina display. Currently Scintilla draws a 16x16 image as a 32x32 image on a HiDPI display, but my test draws a 32x32 image as if it was a 16x16 scaled up by 2.

On Qt, the key is to set `QPixmap.setDevicePixelRatio(2.0)`, but the QPixmap is constructed inside `ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage)`, which does not have a scale factor, and I cannot find a way to set it before or after the fact using the Scintilla message API. (There’s also the matter of dividing every call to `QPixmap.width()` and `QPixmap.height()` by `QPixmap.devicePixelRatio()`, but that’s trivial once the ratio is set.)

It might be possible to make scale=1 an optional default parameter, but I don’t know enough about C++ to know if that’ll still require downstream Platform changes or not.

Cheers,
Mitchell

P.S. I looked up how to do this for GTK and it’s pretty much not possible without using Cairo contexts instead of GdkPixbufs (https://gitlab.gnome.org/GNOME/gtk/-/issues/613), so that’s a bummer :(

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/FCED375B-D5DF-4678-8165-D0541B3B33A8%40foicica.com.