Пример #1
0
        private void UpdateOutputImage(object sender, EventArgs e)
        {
            GmicPipeServer server = (GmicPipeServer)sender;

            if (surface != null)
            {
                surface.Dispose();
                surface = null;
            }

            OutputImageState state = server.OutputImageState;

            if (state.Error == null)
            {
                IReadOnlyList <Surface> outputImages = state.OutputImages;

                if (outputImages.Count == 1)
                {
                    Surface output = outputImages[0];

                    if (output.Size == EnvironmentParameters.SourceSurface.Size)
                    {
                        surface = output.Clone();
                    }
                }
            }

            // The DialogResult property is not set here because it would close the dialog
            // and there is no way to tell if the user clicked "Apply" or "Ok".
            // The "Apply" button will show the image on the canvas without closing the G'MIC-Qt dialog.
            FinishTokenUpdate();
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && server != null)
            {
                server.Dispose();
                server = null;
            }

            base.Dispose(disposing);
        }
Пример #3
0
 public GmicConfigDialog()
 {
     InitializeComponent();
     Text         = GmicEffect.StaticName;
     surface      = null;
     workerThread = null;
     dialogSynchronizationContext = new GmicDialogSynchronizationContext(this);
     server = new GmicPipeServer(dialogSynchronizationContext);
     server.OutputImageChanged += UpdateOutputImage;
     outputFolder = string.Empty;
 }