www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - arsd.minigui

reply JG <someone somewhere.com> writes:
Hi,

I have an png image that I generate (via pdf via pdflatex) that I 
want to scale and display in a widget. Is this possible via 
something in arsd? I tried resizeImage but that doesn't seem to 
do what I expect. Any suggestions?
Apr 03 2022
parent reply Adam Ruppe <destructionator gmail.com> writes:
On Sunday, 3 April 2022 at 16:58:03 UTC, JG wrote:
 Hi,

 I have an png image that I generate (via pdf via pdflatex) that 
 I want to scale and display in a widget. Is this possible via 
 something in arsd? I tried resizeImage but that doesn't seem to 
 do what I expect. Any suggestions?
Which resizeImage did you use, from the imageresize module? What pain you have with it? Some of its settings take some tweaking. Though in a widget, you can also stretch automatically on Windows... actually XRender can do it too i believe but I never implemented that. Maybe I should. But imageresize should work with some experimentation. This is how I did it in my image viewer application: auto i = loadImageFromFile(arg); auto size = calculateSizeKeepingAspectRatio(i.width, i.height, maxWidth, maxHeight); if(size.width != i.width || size.height != i.height) { i = imageResize(i, size.width, size.height, null, 1.0, 0.6); } then pass that i to one of the minigui/simplediplay functions to display.
Apr 03 2022
parent JG <someone somewhere.com> writes:
On Sunday, 3 April 2022 at 17:10:48 UTC, Adam Ruppe wrote:
 On Sunday, 3 April 2022 at 16:58:03 UTC, JG wrote:
 [...]
Which resizeImage did you use, from the imageresize module? What pain you have with it? Some of its settings take some tweaking. [...]
Thank you very much for your quick reply. I see now I was doing something silly.
Apr 03 2022