Artz Posted November 7, 2023 Share Posted November 7, 2023 I'm a developer working with WinForms canvas and GDI+ drawing. I see that Paint.NET is unbelievably fast, when panning or zooming into images. How is this accomplished? What kind of technology is used? Is there a technical paper about it? Quote Link to comment Share on other sites More sharing options...
Solution Roly Poly Goblinoli Posted November 7, 2023 Solution Share Posted November 7, 2023 What tricks come to mind include: - only drawing the visible portion of the canvas (after transformations) - keeping a merged copy in memory of the visible portion of the canvas for all layers above or below the current, I don't know if PDN does this but it would be faster than merging each pixel per layer on every frame to redraw it. So this means 3 images in total: one for all layers above (merged), one for the active layer, one for all layers below (merged). For large images, you'd probably want to keep the temporary copies saved to disk or only generated for the visible portion of the canvas to avoid overloading RAM. I believe paint.net layers automatically have the ability to save & load from disk already, so it's probably doing that much at least - load and unload the image in chunks to handle extremely large images. Loading it all in memory would quickly fail for a 10x10k image - use GPU not CPU. Older version of paint.net were not GPU optimized I'm sure Rick can pour over it in more detail and with better accuracy since I'm not actually a paint.net dev. I just have a plugin. 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted November 8, 2023 Share Posted November 8, 2023 16 hours ago, Artz said: Is there a technical paper about it? Why would I write a 100 page technical paper when I have way more important things to do with my time 😂 Don't use GDI+. It's too slow; it's really quite terrible. You want Direct2D. 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Artz Posted January 3 Author Share Posted January 3 Thanks Rick Unfortunately I'm stuck with GDI. All apps are running on Citrix anyway where there is no hardware acceleration Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.