Example #1
0
        private void RenderFrame(object sender, DoWorkEventArgs e)
        {
            ProcessCustomFrameEventArgs args = (ProcessCustomFrameEventArgs)e.Argument;

            CustomFrame     nFrame = new CustomFrame();
            WriteableBitmap src    = null;

            if (args.img != null)
            {
                //if we have an IImage, convert it
                src = new WriteableBitmap(Utils.IImageToBitmapSource(args.img));
                args.img.Dispose();
            }
            else if (args.writeablebmp != null)
            {
                //otherwise we can just use the writeablebitmap
                src = args.writeablebmp;
            }

            //set CustomFrame bitmap
            if (src != null)
            {
                src.Freeze();
                nFrame.SetBitmap(src);
            }
            else
            {
                //easier to avoid setting
                nFrame = null;
            }

            e.Result = nFrame;
        }
Example #2
0
 private void Render_Complete(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         CustomFrame frame = (CustomFrame)e.Result;
         if (frame != null)
         {
             masterFrame = frame;
         }
     }
     catch (Exception err)
     {
         ////Debug.WriteLine("Custom Stream failed to set master frame: " + err.ToString());
     }
     isWorking = false;
 }
Example #3
0
 internal CustomStream()
 {
     isWorking   = false;
     name        = "Custom Stream";
     masterFrame = null;
 }