Add support for configurable transparent background to SVGs
Summary:
SVGs do not honor the "Transparent background" config option, and simply have no
background at all. This patch ensures this option is applied to SVGs as well as
raster images.
Unlike RasterImageView that uses a QPixmap buffer (mCurrentBuffer) for drawing
the background and the image, SVGs are rendered directly on top of SvgImageView
(QGraphicsWidget). Therefore we just paint the background in SvgImageView::paint
which happens before the SVG is rendered.
We move the checkboard texture code to AbstractImageView now that it's used by
both subclasses RasterImageView and SvgImageView.
This patch also configures kconf_update due to the moving of the above enum.
Since I didn't want to litter /app with files, I've moved the update files to
/kconf_update.
Fixes T8125
Before:
After:
Test Plan:
- Open an SVG with solid color config option
- Open and SVG with checkboard background config. At a high enough zoom (where the birdseye view shows up), panning/scrolling should have the checkboard pattern fixed to the image, like raster images
- Ensure raster images with transparent backgrounds are unaffected
kconf_update
The script gwenview-imageview-alphabackgroundmode-update.pl must be in
/usr/share/kconf_update in order for /usr/lib/kf5/kconf_update to find it.
If successfull, instances of RasterImageView::AlphaBackground* should change to
AbstractImageView::AlphaBackground*.
Reviewers: Gwenview, rkflx, ngraham
Reviewed By: Gwenview, rkflx, ngraham
Tags: Gwenview
Maniphest Tasks: T8125
Differential Revision: https://phabricator.kde.org/D11629