pleabo Posted February 8, 2011 Share Posted February 8, 2011 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?? MessageBox.Show("OnSetRenderInfo"); 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. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted February 8, 2011 Share Posted February 8, 2011 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. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
pleabo Posted February 8, 2011 Author Share Posted February 8, 2011 pyrochild, thank you so much for the help and advice. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.