On Mon, Mar 17, 2014 at 4:32 PM, Kevin Krammer <
kra...@kde.org> wrote:
> On Monday, 2014-03-17 ,16:15:40 you wrote:
>> On Mon, Mar 17, 2014 at 3:31 PM, Kevin Krammer <
kra...@kde.org> wrote:
>> > On Sunday, 2014-03-16, 22:42:11, PCMan wrote:
>> >> BTW, there is an unresolved problem.
>> >> When scaling down larger images to fit the smaller window, the image
>> >> quality is quite poor.
>> >> There's no simple solution to this issue. It's the limitation of
>> >> QGraphicsView.
>> >
>> > Have you tried using a QListView in IconView mode and backing it with a
>> > simple QAbstractListModel derived class that returns appropriately scaled
>> > images?
>> Brilliant idea!
>
> Thanks, but I am afraid I misunderstood your original mail.
> I thought the problem was the thumbnail view but you are talking about the
> main view.
>
>> If we can store the original image only, and doing the scaling for
>> painting the exposed area on demand, this can save a lot of memory.
>
> True, shouldn't be that difficult as long as there is no arbitraty rotation
> involved.
Well, I figured out how to workaround this.
The code is already in the latest git. :-)
Now the memory usage is lower and we can still have good image quality.
There're still some glitches, though.
>> What I want to do is only scaling the visible area when painting so we
>> don't need to cache the whole scaled image.
>
> I can see two options:
> 1) map the view rectangle to the source image, get a QImage copy of that part
> and scale that
> 2) "build" the display data by running through the scanlines yourself
Indeed, I use option 2 to avoid copying the visible region. (Build the
subimage using QImage::constBits() of the original image).
> I know you are tryting to minimize library dependencies but I vaguely remember
> that some image viewers use specialized image libraries for additional speed
> and runtime efficiency, e.g. qimagepblitz, imlib, the lib from ImageMagick.
Yes, they're awesome libs.
However, qimageblitz has no qt5 support.
The others are more difficult to use with Qt.
Minimizing memory usage and speed up startup is very important.
Otherwise, we already have too many good and powerful image viewers
and there's no need to write yet another one.
The focus of lximage as a default image viewer is quick startup and
the "just enough" philosophy.
Cheers!
> Cheers,
> Kevin
> --
> Kevin Krammer, KDE developer, xdg-utils developer
> KDE user support, developer mentoring