Jump to content

PDN library


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

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

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