Jump to content

Recommended Posts

Sorry, I should have included more detail - this is for a custom FileType plugin which loads the image just fine, it's when attempting to save I'm having trouble.

I set the pixel like this: 

layer.Surface[x_pos, y_pos] = ColorBgra.Transparent;

Which both displays and 'eye drops' correctly.

 

if (scratchSurface[x, y].A == 0)

This just returns 255, despite PDN clearly showing and displaying A=0

 

I'm also iterating through multiple layers so not sure if this is the right way to do so?

foreach (Layer layer in input.Layers)

 

Edited by JohnnyBlueBird
Link to post
Share on other sites

I think you probably need to post more of the code than those two unconnected snippets. Perhaps it's just my lack of experience with FileType plugins, but the relationship between layer.Surface and scratchSurface isn't apparent.

 

EDIT: A search reveals that scratchSurface is a pre-allocated surface for the programmer's convenience. However, that's all that it is: just a temporary surface to be used as the programmer wishes. Perhaps you are incorrectly assuming it will be modified if the layer surface is modified. If you haven't specially written into scatchSurface, it will contain whatever it happened to contain when it was allocated for you.

  • Upvote 1
Link to post
Share on other sites

Please don't use scratchSurface if you can. It's been deprecated and you should not rely on its existence, or that it's been pre-filled with anything in particular.

 

The FileType class* will be evolving over time to reflect this. It's not like you can't use it (scratchSurface), I just would prefer plugins to pretend like it doesn't exist.

 

* or whatever it evolves into, or whatever replaces it, etc.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to post
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...