Jump to content

Render performance of Paint.NET


Recommended Posts


I'm new to graphics programming and I was curious on what method Paint.NET utilizes to render its graphics (the image, not user interface). I believe one of the following three alternatives to be the case.

(1) You use GDI+ (e.Graphics.XX) to render the image onto a custom control (some sort of canvas). Possibly use transformations such as Transform (for zoom and panning) and ScaleTransform (zoom).

(2) You interop with GDI and use APIs such as AlphaBlt / StretchBlt to render your graphics onto the surface of a canvas control.

(3) Something completly else, like direct memory manipulation (pointers, memory copies and so on).

I've tested (1) and it works well (easy and compact code) for resonable sized images but very slow on large images (such as 3000 x 3000 at 100mb or so).

When I tested method (2) I managed to get a lot better performance and it was also easy and nice code (calles to AlphaBlt lets me both zoom and alter opacity).

The closest I've gotten to (3) so far would be to use the overload of the Bitmap class which enables you to send in a pointer to a DIB (byte array). This has proven to be extremly fast while panning a huge image. The drawback is that I have to decode the image myself, i.e use stuff like BITMAPFILEHEADER structures and some memory copy to get to the DIB. Which in turn mean I would have to write my own encoders/decoders for all the image formats I would like to be able to process.

Im experimenting with some code to manipulate large/huge images and I'm looking for the BEST possible way to get performance in my rendering / zoom techniques and some pointers woule be very helpfull

Thanks and keep up the good work!

Link to comment
Share on other sites

Join the conversation

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

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...