Jump to content

GDI+ and PDN


MJW

Recommended Posts

I'm hoping someone who understands PDN internals and GDI could explain how they work together. I was trying some experiments using GDI+, based of BoltBait's CodeLab tutorial, and it worked very well; my question is, why? From reading the (to me, less-than-clear) documentation I found on GDI+, it seems to work with MS-style Bitmaps. As far as I know -- and I could be wrong -- PDN surfaces aren't based on MS Bitmaps*, so what is the mechanism that allows GDI+ to work with PDN surfaces? I'm mostly just curious, but it would also help in deciding how to best use GDI+ in plugins.

 

I searched for forum topics mentioning GDI and GDI+, and didn't find a single one. That surprises me, because GDI+ seems like a powerful tool for developing plugins.

 

*One reason I don't think PDN surfaces are based on Bitmaps is that accessing Bitmaps on a pixel-by-pixel basis is HORRIBLY slow because the map is locked for every access.
 

Link to comment
Share on other sites

After reading some long-forgotten bookmarked pages on locking Bitmaps, I think I may have an idea how PDN uses surfaces. I think it may use LockBits to create a temporary buffer that can be read and written to with "unsafe" instructions, which is then automatically moved into a Bitmap when the Lock is released. Even if that's correct, I'd still much appreciate any details on what goes on "under the hood" in PDN. I don't yet comprehend how GDI+ works with locked regions, assuming it does.

Edited by MJW
Link to comment
Share on other sites

Grab a copy of Reflector or ILSpy or your favorite disassembler

 

Add Paint.NET's binaries (PaintDotNet.exe and PaintDotNet.*.dll) to its list

 

Read the disassembled code

 

 

 

Paint.NET doesn't use System.Drawing.Bitmap for the most part, it uses PaintDotNet.Surface.

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

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