Hi, first time on forum, - "Welcome to the forum", well thank you. Time for substance.
I'm writing a test plugin that write the source surface to a bitmap on disk, waits for an executable to end and then re-reads the bitmap and render it on the destination surface.
The problem is that after my render loop is called, a ProgressDialog apprears with "Rendering...", and it renders for ~15-20 seconds a 50x50px image.
Here is my reduced code [no error checking, etc...] but tested that it still has this behavior.
public override void Render ( EffectConfigToken parameters, RenderArgs destination, RenderArgs source, Rectangle [ ] rois, int startIndex, int length )
{
// Validate configuration token
MyEffectConfigToken Token = parameters as MyEffectConfigToken;
// Retrieve selection
PdnRegion SelectionRegion = EnvironmentParameters.GetSelection ( source.Bounds );
Rectangle SelectionBounds = SelectionRegion.GetBoundsInt ( );
// Create temporary filenames
string InputFileName = Path.Combine ( Path.GetTempPath ( ), Path.ChangeExtension ( Path.GetRandomFileName ( ), ".bmp" ) );
string OutputFileName = Path.Combine ( Path.GetTempPath ( ), Path.ChangeExtension ( Path.GetRandomFileName ( ), ".bmp" ) );
// Create bitmap and save it to InputFileName
Bitmap Bitmap = source.Surface.CreateAliasedBitmap ( SelectionBounds, true );
Bitmap.Save ( InputFileName, ImageFormat.Bmp );
// Create process
Process Process = new Process ( );
Process.StartInfo.FileName = Path.Combine ( Path.GetDirectoryName ( Assembly.GetExecutingAssembly ( ).Location ), "MyExecutable.exe" );
Process.StartInfo.Arguments = string.Format ( "-input \"{0}\" -output \"{1}\" {2}", InputFileName, OutputFileName, Token.CommandLine );
Process.StartInfo.CreateNoWindow = true;
Process.StartInfo.UseShellExecute = false;
Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// Start process
Process.Start ( );
// Wait for process to end
Process.WaitForExit ( );
// Read OutputFileName and draw bitmap
using ( Bitmap OutputBitmap = new Bitmap ( OutputFileName ) )
destination.Graphics.DrawImageUnscaledAndClipped ( OutputBitmap, SelectionBounds );
}
Any help would be greatly appreciated.