Jump to content

Can a Nuget package be referenced in a Plug In?


Recommended Posts

It would save me pulling in a bunch of code.

 

If yes, I have two questions to what is possible.

 

I currently load my PixelDatabase by either a Bitmap, an Image, or a path to an image.

 

Is it possible to access the current layer as an Image or Bitmap, or do I have to loop through the pixels and create an image?

 

Second question is in regards to applying, as it is stands now my component writes to each pixel already if it is effected, and it is pretty efficient using this class called DirectBitmap that bypasses Bitmap.SetPixel due to speed, but I am sure not as efficient as the rectangle multi-threaded approach I just read about in Paint.Net. 

 

Is it possible after I apply my query, to take the bitmap that already has all the new pixel values and just apply it to the destination Surface? I don't even know what a Surface is, my guess is it is a layer of some type, but what I am getting at I would prefer not to have to iterate through all the pixels twice, or move code around since I already have an ApplyPixels method.

 

Thanks, I didn't know Paint.Net was extensible until today. Funny as a programmer I can tell I think subconsciously in billable hours, even for my own projects. I always start from scratch and try and build a rounder wheel, or something else that has already been invented. 

 

Link to comment
Share on other sites

Yes to both.

 

Create a Bitmap from a Surface:

Bitmap srcBitmap = srcSurface.CreateAliasedBitmap();

or if you working with RenderArgs (the "container" for surfaces) :

Bitmap srcBitmap = srcRenderArgs.Bitmap;

 

 

Creating a Surface from a Bitmap:

Surface dstSurface = Surface.CopyFromBitmap(dstBitmap);

 

 

 

These can be used for getting a prototype working in paint.net, but in the long-term, you should switch to the surface[x, y] convention (or even surface pointers) if possible.

(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

2 minutes ago, toe_head2001 said:

Yes to both.

 

Create a Bitmap from a Surface:


Bitmap srcBitmap = srcSurface.CreateAliasedBitmap();

or if you working with RenderArgs (the "container" for surfaces) :


Bitmap srcBitmap = srcRenderArgs.Bitmap;

Thanks, I won't bother you any more today. If I learn too much in one day now my head purges it all. As to the Surface Pointer, I dropped C++ 3 times due to my lack of never liking pointers. I will read up on all this and come back. Thanks for all the quick responses. Corby. It took me a while to figure out what that sound was when I get a new message here. I wish all forums had that.

T

2 minutes ago, toe_head2001 said:

 

Creating a Surface from a Bitmap:


Surface dstSurface = Surface.CopyFromBitmap(dstBitmap);

 

 

 

These can be used for getting a prototype working in paint.net, but in the long-term, you should switch to the surface[x, y] convention (or even surface pointers) if possible.

 

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