Jump to content

Technical question about drawing of bitmaps and primitives


Go to solution Solved by NinthDesertDude,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution

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.

  • Like 1
Link to comment
Share on other sites

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.

  • Like 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...