MJW Posted November 21, 2013 Posted November 21, 2013 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. Quote
MJW Posted November 21, 2013 Author Posted November 21, 2013 (edited) 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 November 21, 2013 by MJW Quote
Rick Brewster Posted November 22, 2013 Posted November 22, 2013 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. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
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.