private void HandleTestRender(object Sender, RoutedEventArgs e) { PlaneRenderer PR = new PlaneRenderer(); //PR.RenderRGBPlane(RGBAxisDefinitions.RGB, 200, OutImage, ImageContainer.ActualWidth, ImageContainer.ActualHeight); // PR.RenderCMYPlane(CMYAxisDefinitions.CMY, 200); PR.RenderHSVPlane(HSVAxisDefinitions.HSV, 255, OutImage, ImageContainer.ActualWidth, ImageContainer.ActualHeight); }
private void FrameRendering(object Sender, DoWorkEventArgs e) { BackgroundWorker BW = Sender as BackgroundWorker; RenderData RD = e.Argument as RenderData; if (RD == null) { return; } PlaneRenderer PR = new PlaneRenderer(); for (int i = 0; i < RD.FrameCount; i++) { SetStatusText("Rendering frame " + (i + 1).ToString() + " of " + RD.FrameCount.ToString()); switch (RD.ColorSpaceName) { case "RGB": PR.RenderRGBPlane(RGBAxisDefinitions.RGB, i, RD.RenderSurface, RD.FrameWidth, RD.FrameHeight); break; case "CMY": PR.RenderCMYPlane(CMYAxisDefinitions.CMY, i, RD.RenderSurface, RD.FrameWidth, RD.FrameHeight); break; case "HSV": PR.RenderHSVPlane(HSVAxisDefinitions.HSV, i, RD.RenderSurface, RD.FrameWidth, RD.FrameHeight); break; } BW.ReportProgress(i, RD.RenderSurface); #if false string FileName = i.ToString("D3") + "_" + RD.ColorSpaceName + RD.AxisOrder.ToString(); var PngEncoder = new PngBitmapEncoder(); PngEncoder.Frames.Add(BitmapFrame.Create((BitmapSource)RD.RenderSurface.Source)); using (FileStream stream = new FileStream(FileName, FileMode.Create)) PngEncoder.Save(stream); #endif } }