public void Render(DrawingArea area, SettingsModel settings) { var width = area.Allocation.Width; var height = area.Allocation.Height; var kaleidoscope = _factory.Get(settings.Type); var rootNode = kaleidoscope.Generate( settings.GeometyWidth, settings.ImageUri, width, height); ImageSurface surface = new ImageSurface(Format.Argb32, width, height); using (var context = new Context(surface)) { context.Translate(width / 2, height / 2); rootNode.Render(context); } rootNode.Geometry.Dispose(); using (Context context = Gdk.CairoHelper.Create(area.GdkWindow)) { context.Rectangle(0, 0, width, height); context.SetSource(surface); context.Fill(); context.GetTarget().Dispose(); } surface.Dispose(); }
private void RenderKaleidoscope(SettingsModel settings) { var kaleidoscope = _kaleidoscopes.Get(settings.SelectedKaleidoscopeType.Type); var imageUri = new Uri(settings.ImagePath, UriKind.Absolute); var rootNode = kaleidoscope.Generate(settings.GeometryWidth, imageUri, ActualWidth, ActualHeight); var model = new ModelVisual3D(); model.Content = rootNode.Model3D; Children.Clear(); Children.Add(model); var light = new ModelVisual3D(); light.Content = _light; Children.Add(light); Console.WriteLine("done"); }
private void RenderKaleidoscope(SettingsModel settings) { var kaleidoscope = _kaleidoscopes.Get(settings.SelectedKaleidoscopeType.Type); var imageUri = new Uri(settings.ImagePath, UriKind.Absolute); var rootNode = kaleidoscope.Generate(settings.GeometryWidth, imageUri, ActualWidth, ActualHeight); var drawingFromCenter = new DrawingGroup(); drawingFromCenter.Transform = new TranslateTransform(ActualWidth / 2, ActualHeight / 2); drawingFromCenter.Children.Add(rootNode.Drawing); RemoveVisualChild(_drawingVisual); _drawingVisual = new DrawingVisual(); using (var drawingContext = _drawingVisual.RenderOpen()) { // clear brackgroud var background = new RectangleGeometry(new Rect(new Point(0, 0), new Size(ActualWidth, ActualHeight))); drawingContext.DrawGeometry(new SolidColorBrush(Colors.White), null, background); // render kaleidoscope drawingContext.DrawDrawing(drawingFromCenter); } AddVisualChild(_drawingVisual); }
void before_each() { var factory = new KaleidoscopeFactory <NodeMock, GeometryMock, TransformationMock>(); _kaleidoscope = factory.Get(KaleidoscopeTypes.Triangle); }
void before_each() { var factory = new KaleidoscopeFactory<NodeMock, GeometryMock, TransformationMock>(); _kaleidoscope = factory.Get(KaleidoscopeTypes.Triangle); }