Jump to content

PDN library


honzapat

Recommended Posts

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.

Link to comment
Share on other sites

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.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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