Jump to content
wadepm

smooth scaling of bitmaps

Recommended Posts

@Anders Melander Excellent! - I will try it out as soon as I can.  What's the easiest way to get this into Delphi, reinstall Graphics32 from scratch?  Is there a way to just recompile GR32_Image.pas?  And then what - sorry I don't have much experience working with 3rd party stuff.     

Share this post


Link to post
1 minute ago, wadepm said:

What's the easiest way to get this into Delphi, reinstall Graphics32 from scratch?

The design time functionality hasn't changed so you don't need to recompile the packages.

The easiest way to test it out would be to just copy the modified GR32_Image.pas to the source folder of your application. That way your application will compile with the new GR32_Image but your existing Graphics32 installation will not be affected.

 

Once the changes are merged into the main Graphics32 branch you can update your Graphics32 installation and remove the local copy of GR32_Image.

  • Like 1

Share this post


Link to post

OK.  I put the new unit in the project folder and recompiled.  The new .dcu file for GR32_Image.pas is in the debug folder.  But I am not seeing any change in the scrolling - still really lagging. 

Share this post


Link to post
9 minutes ago, wadepm said:

But I am not seeing any change in the scrolling - still really lagging.

Did you set ImgView.RepaintMode=rmOptimized ?

 

Try to set a breakpoint in line 2380 of GR32_Image ("SourceRect := GetBitmapRect;") to verify that the correct version is being used.

 

Can you reproduce the problem with the small example that I posted earlier (remember to make the changes I later mentioned and set RepaintMode):

 

Share this post


Link to post

I have it set to rmOptimized.  I set the breakpoint and the program stopped at that location so I am using the latest version of the unit.

 

The bitmap I work with in my project is 5500 by 4000.  The viewport is 1700 by 1000.  

 

I am goin to try scaling the bitmap first using the drawto method and then assign it to the image for the scrolling.  I think (hope) that will avoid the problem as the image will always be at full scale, as far as it knows.  What do you think? 

Share this post


Link to post
1 hour ago, wadepm said:

The bitmap I work with in my project is 5500 by 4000.  The viewport is 1700 by 1000. 

I tried with a 5500x4000 bitmap and I did actually manage to produce some lag. I then changed the resampler to TDraftResampler and the lag was completely gone. Same with TNearestResampler.

Edited by Anders Melander

Share this post


Link to post

I thought I needed to use the TKernelResampler to get a nice resize but TDraftResampler looks good and panning is almost as good as panning of the full size image.  This is good enough for me! 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×