It's noticeable even in IDE if I load some picture into TImage and check "Stretch". Is there any workaround?
System: Linux x86_64, Lazarus 1.6, FPC 3.0.0
Title: Re: Ugly resampling
Post by: zeljko on March 23, 2016, 10:16:35 am
Please open an issue about it, attach example project and original image, so I'll take a look into.
Title: Re: Ugly resampling
Post by: alanphys on January 10, 2018, 02:55:12 pm
Hi zeljko
Sorry to reopen an old thread, but could you tell us what you changed in the new version of Lazarus. I have the opposite problem to grytom. My image which was sharp on previous versions of Lazarus is now fuzzy. The windows version displays correctly. See below. My understanding of StretchDraw is that the interpolation method should be controlled by the alias flag on the destination device context. I've tried defining this, but it doesn't change anything.
I'm running Fedora 26 with QT 5.6, Lazarus 1.8 and Windows 7 with Lazarus 1.8.
Regards
Title: Re: Ugly resampling
Post by: zeljko on January 11, 2018, 12:12:26 pm
Try to disable smooting in qtobjects.pas inside DrawImage and then see what happens. Maybe Qt5 does not need such param. EDIT: Is it lazarus win32 or lazarus qt on win32 ?
Title: Re: Ugly resampling
Post by: zeljko on January 11, 2018, 12:16:20 pm
Try to change params inside TQtDeviceContext.drawImage() (lcl/qt5/qtobjects.pas)...at the very bottom part of routine: // smooth a bit. issue #29883 // try to set another render hint and try without any render hints. ARenderHint := QPainter_testRenderHint(Widget, QPainterSmoothPixmapTransform); if (QImage_format(image) = QImageFormat_ARGB32) and (flags = QtAutoColor) and not EqualRect(LocalRect, sourceRect^) then QPainter_setRenderHint(Widget, QPainterSmoothPixmapTransform, True); QPainter_drawImage(Widget, PRect(@LocalRect), image, sourceRect, flags); QPainter_setRenderHint(Widget, QPainterSmoothPixmapTransform, ARenderHint);
Title: Re: Ugly resampling
Post by: alanphys on January 11, 2018, 02:44:04 pm
Hi zeljko
Many thanks for your help. I changed QPainterSmoothPixmapTransform to QPainterQt4CompatiblePainting in TQtDeviceContext.drawImage() and now get a sharp image on linux with QT5.
PS: It was lazarus win32 that gave the sharp image previously.
Title: Re: Ugly resampling
Post by: zeljko on January 11, 2018, 09:47:46 pm
ok, can you please open an Qt5 issue and attach patch ?
Title: Re: Ugly resampling
Post by: alanphys on January 12, 2018, 02:49:37 pm