honzapat Posted July 22, 2020 Share Posted July 22, 2020 Is there any wrapper library for the .PDN file type? I am trying to create custom importer for Unity. By using PaintNet.Core, Base and Data I almost done it, only problem is I cant use Bitmaps and surfaces from System.Drawing(idk Unity has some issue even thogh Iam using it, it probably missing from the Mono version), maybe if I could get Color array directly from layer it would be enough. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted July 22, 2020 Share Posted July 22, 2020 32 minutes ago, honzapat said: Is there any wrapper library for the .PDN file type? Sorry, there is not. 33 minutes ago, honzapat said: I am trying to create custom importer for Unity. What would be the purpose of that? Would the importer automatically convert the .PDN to a flattened texture asset for use in your game? 32 minutes ago, honzapat said: I cant use Bitmaps and surfaces from System.Drawing There is no Surface in System.Drawing. 32 minutes ago, honzapat said: maybe if I could get Color array directly from layer it would be enough. Probably not. You'd need the Opacity and Blend Mode for each layer too. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
honzapat Posted July 22, 2020 Author Share Posted July 22, 2020 The purpose would be, that i could save directly pdn assets and through some scripting(which is available) where I get: file path and I can callback engines proprietary types(Texture2D and/or Sprite in that case), so the idea is I would load the pdn file and for example add each layer as separate Texture2D or sprite (depending on per asset settings), as I say Iam 90% there I just cant access bitmap. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted July 22, 2020 Share Posted July 22, 2020 There is an irfanview plugin that reads Paint.NET files... I wonder if that source is available. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
honzapat Posted July 22, 2020 Author Share Posted July 22, 2020 Ok it looks like I cant access anything from System.Drawing, I can access surface though. If only could I somehow copy the byte[] directly from the layer. Quote Link to comment Share on other sites More sharing options...
honzapat Posted July 22, 2020 Author Share Posted July 22, 2020 Unity partialy made a wrapper for PDN for their PSD importer, so they are basically using the plugin to convert to PDN and then to their format, but you cant load PDN format, what a great thing. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted July 22, 2020 Share Posted July 22, 2020 38 minutes ago, honzapat said: If only could I somehow copy the byte[] directly from the layer. You can access each pixel with an Indexer on the Surface type. for (int y = 0; y < mySurface.Height; y++) { for (int x = 0; x < mySurface.Width; x++) { ColorBgra currentPixel = mySurface[x, y]; byte r = currentPixel.R; byte g = currentPixel.G; byte b = currentPixel.B; byte a = currentPixel.A; } } Keep in mind that the Paint.NET DLL assemblies are not licensed to be used independently of Paint.NET. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
honzapat Posted July 23, 2020 Author Share Posted July 23, 2020 Well if it wasnt enough, Unity now doesnt even want to load the dlls, so iam really looking into some class wrapper for the pdn Quote Link to comment Share on other sites More sharing options...
honzapat Posted July 23, 2020 Author Share Posted July 23, 2020 Well today I spend like 5 hours trying to make it work isntead of working on the game, i think I can live with the must to click ctrl + shift + s and save as png Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 23, 2020 Share Posted July 23, 2020 You can't access the byte[] directly because it doesn't exist. The memory for a Surface is allocated in native memory. 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...
honzapat Posted July 23, 2020 Author Share Posted July 23, 2020 Having it would be awesome but probably need massive porting of serialization parts, so aim gonna stick with PSD plugin and saving it as PSD, which I didnt initially though of. 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.