Make Konqi look good in HiDPI
ClosedPublic

Authored by ngraham on Jul 19 2018, 11:17 PM.

Details

Summary

Substitute an SVG Konqi image provided by @bruns and scale it appropriately depending on the scale factor so it always looks crisp and clear.

Test Plan

Looks the same at 1x. Looks better at anything larger than 1x:

1.2x:

1.5x:

1.75x:

2x:

...etc.

Diff Detail

Repository
R263 KXmlGui
Branch
hidpi-konqi (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 2212
Build 2230: arc lint + arc unit
ngraham created this revision.Jul 19 2018, 11:17 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 19 2018, 11:17 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
ngraham requested review of this revision.Jul 19 2018, 11:17 PM
ngraham edited the test plan for this revision. (Show Details)Jul 19 2018, 11:18 PM
ngraham edited the summary of this revision. (Show Details)Jul 19 2018, 11:22 PM
ngraham updated this revision to Diff 38106.Jul 19 2018, 11:28 PM

Use smooth transformation to slightly improve appearance

ngraham edited the test plan for this revision. (Show Details)Jul 19 2018, 11:30 PM
ngraham edited the summary of this revision. (Show Details)
bruns added a subscriber: bruns.Jul 20 2018, 5:31 PM

Try zopflipng ...

aacid added a subscriber: aacid.Jul 20 2018, 6:46 PM

If the increased image memory is payed only when the dialog is shown i don't see it as a problem tbh.

Funny story: after multiple attempts to use Inkscape to make an SVG of this, all versions were much larger than the new png! I don't think that's an option. @broulik, does the current approach look sane to you? I wasn't able to make it work simply adding an @2x image without code changes.

ngraham updated this revision to Diff 38367.Jul 25 2018, 4:50 AM

Use zopflipng to squeeze the image down even smaller (thanks @bruns!)

ngraham edited the summary of this revision. (Show Details)Jul 25 2018, 4:51 AM

If the increased image memory is payed only when the dialog is shown i don't see it as a problem tbh.

Well, it's compiled into .qrc and potentially shipped for bundled applications? The RAM will be shared, I guess? I don't really know how this qt resource stuff works :)

Whatever the size/memory penalty is, I'm not sure we can get around paying it since the vector approach was a no-go. I tried my best to reduce the size of the image as much as possible, at least.

bruns added a comment.Jul 27 2018, 3:46 PM

I have traced the image with GIMPs selection tool, "convert selection to path" and export path as SVG. IMHO works best for tracing pixel art.

Thanks! But where seems to be something wrong with that SVG. Qt complains when I try to load it into a QPixmap:

couldn't create image from  "file:///home/sbruens/Downloads/aboutkde_doubled2.png"

Looking inside the SVG file itself, I see the following:

<image
   sodipodi:absref="/home/sbruens/Downloads/aboutkde_doubled2.png"
   y="0.000955912"
   x="-0.000238418"
   id="image946"
   xlink:href="file:///home/sbruens/Downloads/aboutkde_doubled2.png"
   preserveAspectRatio="none"
   height="749.999"
   width="449.999" />
     <image
        sodipodi:absref="/home/sbruens/Downloads/aboutkde_doubled2.png"
...
        width="449.999" />

Just delete the image element from the SVG and you should be good.

cfeck added a comment.Aug 15 2018, 3:08 PM

I have traced the image with GIMPs selection tool, "convert selection to path" and export path as SVG.

If I understand it correctly, the SVG only contains the outline of the selection, but not the actual colors. What I see is just a black silhouette.

cfeck added a reviewer: VDG.Aug 15 2018, 3:10 PM

Does someone from the VDG use professional tools that are able to trace to SVG?

bruns added a comment.Aug 15 2018, 3:53 PM

I have traced the image with GIMPs selection tool, "convert selection to path" and export path as SVG.

If I understand it correctly, the SVG only contains the outline of the selection, but not the actual colors. What I see is just a black silhouette.

The outline exported from the GIMP is just an outline. The SVG I attached are all outlines properly stacked and filled.

If you see only an outline, your SVG viewer is broken. Try opening it in Inkscape.

cfeck added a comment.Aug 15 2018, 4:44 PM

My viewer is QtSVG.

Works fine in Inkscape, Gwenview, ShowFoto, Konqueror (KHTML mode) ...

Minimal working application:

#include <QIcon>
#include <QGuiApplication>

int main(int argc, char* argv[])
{
  QGuiApplication app(argc, argv);

  QIcon icon(QStringLiteral("./konqui.svg"));
  QPixmap pixmap = icon.pixmap(64, 64);

  pixmap.save("./konqui.png");
}
ngraham updated this revision to Diff 40080.Aug 20 2018, 8:09 PM

Use @bruns' awesome SVG

ngraham edited the summary of this revision. (Show Details)Aug 20 2018, 8:10 PM
ngraham edited the test plan for this revision. (Show Details)
ngraham updated this revision to Diff 40081.Aug 20 2018, 8:11 PM

...Actually add the SVG image :)

ngraham updated this revision to Diff 40083.Aug 20 2018, 8:32 PM

Rebase on current master

ngraham updated this revision to Diff 40099.Aug 20 2018, 10:54 PM

Simplify, simplify

ngraham updated this revision to Diff 40101.Aug 20 2018, 11:07 PM

Simplify even more (maybe this is too much simplification though?)

ngraham updated this revision to Diff 40104.Aug 20 2018, 11:12 PM

Un-simplify; the previous version was better

bruns added a comment.Aug 22 2018, 3:22 AM

There was some cruft in the file (empty layers, unused definitions ...)

ngraham updated this revision to Diff 40246.Aug 22 2018, 7:00 PM

Use @bruns' latest SVG

Ping, is this good to go now?

bruns added a comment.Aug 24 2018, 9:00 PM

+1, but I haven't tested it.

@broulik , @cfeck - your opinion?

cfeck accepted this revision.Aug 24 2018, 11:43 PM
cfeck added inline comments.
src/aboutkde.svg
2

The file mode is odd. It should be '644', but not '755'. Not sure what the initial '1' flag indicates.

This revision is now accepted and ready to land.Aug 24 2018, 11:43 PM
ngraham updated this revision to Diff 40389.Aug 25 2018, 1:04 AM
ngraham marked an inline comment as done.

Correct file permissions

ngraham closed this revision.Aug 25 2018, 1:08 AM