コード例 #1
0
ファイル: BaseTreeRender.cs プロジェクト: sgww/cozy
 public void Draw(CozyTree tree)
 {
     foreach (var i in tree.Branchs)
     {
         BranchRender?.Draw(i);
     }
     foreach (var i in tree.Leaves)
     {
         LeafRender?.Draw(i);
     }
     foreach (var i in tree.Flowers)
     {
         FlowerRender?.Draw(i);
     }
 }
コード例 #2
0
ファイル: LowRender.cs プロジェクト: sgww/cozy
 public void Draw(CozyTree tree)
 {
     foreach (var b in tree.Branchs)
     {
         LineGeometry geo = new LineGeometry();
         geo.StartPoint = b.begin;
         geo.EndPoint   = b.end;
         Path myPath = new Path();
         myPath.Stroke          = Brushes.Black;
         myPath.StrokeThickness = b.width;
         myPath.Data            = geo;
         myPath.Effect          = _effect1;
         _canvas.Children.Add(myPath);
     }
     foreach (var b in tree.Leaves)
     {
         EllipseGeometry geo = new EllipseGeometry();
         geo.Center  = b.begin;
         geo.RadiusX = 5;
         geo.RadiusY = 3;
         Path myPath = new Path();
         myPath.Stroke          = Brushes.Green;
         myPath.StrokeThickness = 1;
         myPath.Fill            = Brushes.Green;
         myPath.Data            = geo;
         myPath.Effect          = _effect2;
         _canvas.Children.Add(myPath);
     }
     foreach (var b in tree.Flowers)
     {
         EllipseGeometry geo = new EllipseGeometry();
         geo.Center  = b.pos;
         geo.RadiusX = 5;
         geo.RadiusY = 3;
         Path myPath = new Path();
         myPath.Stroke          = Brushes.Pink;
         myPath.StrokeThickness = 1;
         myPath.Fill            = Brushes.Pink;
         myPath.Data            = geo;
         myPath.Effect          = _effect3;
         _canvas.Children.Add(myPath);
     }
 }
コード例 #3
0
ファイル: LowRender.cs プロジェクト: sgww/cozy
        public void Draw(CozyTree tree)
        {
            CanvasCommandList cl = new CanvasCommandList(_sender);

            using (CanvasDrawingSession clds = cl.CreateDrawingSession())
            {
                foreach (var b in tree.Branchs)
                {
                    clds.DrawLine(
                        new Vector2(b.beginX, b.beginY),
                        new Vector2(b.endX, b.endY),
                        Colors.Black,
                        b.width);
                    clds.FillCircle(
                        new Vector2(b.endX, b.endY),
                        b.width / 2,
                        Colors.Black);
                }
                foreach (var b in tree.Leaves)
                {
                    clds.FillEllipse(
                        new Vector2(b.beginX, b.beginY),
                        5,
                        3,
                        RndGreenColor());
                }
                foreach (var b in tree.Flowers)
                {
                    clds.FillEllipse(
                        new Vector2(b.posX, b.posY),
                        5,
                        3,
                        Colors.Pink);
                }
            }
            var ef = new GaussianBlurEffect();

            ef.Source     = cl;
            ef.BlurAmount = 5;
            _args.DrawingSession.DrawImage(ef);
            _args.DrawingSession.DrawImage(cl, 3, -3);
        }
コード例 #4
0
ファイル: SensitivePlantGenerator.cs プロジェクト: sgww/cozy
 CozyTree ITreeGenerator.Generate()
 {
     tree = new CozyTree();
     DrawTree(_begin);
     return(tree);
 }
コード例 #5
0
 public CozyTree Generate()
 {
     tree = new CozyTree();
     DrawTree(500f, 850f, PI / 2, 200, 30);
     return(tree);
 }
コード例 #6
0
ファイル: SampleTree.cs プロジェクト: sgww/cozy
 public CozyTree Generate()
 {
     tree = new CozyTree();
     DrawTree(new Point(500, 850), PI / 2, 200, 30);
     return(tree);
 }