Exemple #1
0
        void UpdateDecoratorPreview(bool resetScale)
        {
            Decorator selectedDecorator = null;

            if (puzzlePropertyGrid.SelectedObject is GraphElement graphElement)
            {
                selectedDecorator = graphElement.Decorator;
            }
            if (puzzlePropertyGrid.SelectedObject is Decorator)
            {
                selectedDecorator = puzzlePropertyGrid.SelectedObject as Decorator;
            }
            if (editView != null)
            {
                decoratorPreviewBuffer.Graphics.Clear(editView.Graph.MetaData.BackgroundColor);
                if (selectedDecorator != null)
                {
                    if (resetScale)
                    {
                        decoratorPreviewScale = PuzzleToolkit.GetSuggestedDecorationScale(selectedDecorator);
                    }
                    PuzzleGraphRenderer renderer = new PuzzleGraphRenderer(decoratorPreviewBuffer.Graphics);
                    double width  = decoratorPreviewPictureBox.Width;
                    double height = decoratorPreviewPictureBox.Height;
                    renderer.DrawDecorator(selectedDecorator, new MathHelper.Vector(width / 2.0, height / 2.0),
                                           height * decoratorPreviewScale, editView.Graph.MetaData, editView.Graph.MetaData.BackgroundColor, true);
                }
                decoratorPreviewBuffer.Render();
            }
        }
Exemple #2
0
        public void Draw(Graphics graphics, int width, int height)
        {
            PuzzleGraphRenderer renderer = new PuzzleGraphRenderer(graphics);

            renderer.DrawDecorator(Decorator, new Vector(width / 2.0, height / 2.0), width * AdditionalScale, metaData, metaData.BackgroundColor, true);
        }