Jump to content

Get a Copy of the Source Image in an Effect


Recommended Posts

For and effect I am envisioning, I would like to get a copy of the Source Image to display and manipulate in the Effect UI for later saving to the PDN window. Like Liquify does. All my attempts at getting the source image to a PictureBox have failed.

Here is one of my attempts at getting the source image:

    protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs) {
     if (firstTime){ // usually goes three times on the start of the effect??
       firstTime = false;
       PaintDotNet.Effects.FFPConfigDialog m_dlg = new PaintDotNet.Effects.FFPConfigDialog();
       m_dlg.pictureBox1.Image = (Image)dstArgs.Bitmap;
     base.OnSetRenderInfo(parameters, dstArgs, srcArgs);

This does not change the pictureBox1.Image, nor does anything else that I have tried.

Later I need to get the transformed image to dstArgs.Surface.

Any help appreciated.


Link to comment
Share on other sites

Here, you are creating a new instance of your dialog (that is never shown) in OnSetRenderInfo. Not good.

Instead, you need to access the EffectSourceSurface property from your dialog, not your Effect-based class. Note that this won't be set until Form.Load (so you can't get it in the constructor). Also, DO NOT WRITE TO THIS SURFACE.

That said, you don't appear to understand the concept of instances. Again, you are creating a NEW dialog, instead of using the one Paint.NET has already presented to the user.

I think you should probably read up on OOP and C# some more before continuing your project.


ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

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.

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