internal override void Rasterize(ref Canvas imageObject)
 {
     DrawBubbleLeaves(ref imageObject);
 }
 internal override void Rasterize(ref Canvas imageObject)
 {
     DrawHull(ref imageObject);
     DrawBranches(ref imageObject);
 }
        protected void DrawSplinesBetweenLeaves(ref Canvas imageObject)
        {
            Random rnd = new Random();
            for (int i = 0; i < leaves.Count(); i++)
            {
                int j = rnd.Next(0, i);
                Point p1 = leaves[i];
                Point p2 = leaves[j];
                leaves[i] = p2;
                leaves[j] = p1;
            }
            int nSplines = leaves.Count() / 3;

            int k = 0;
            for (int i = 0; i < nSplines; i++)
            {
                Point p1 = leaves[k];
                Point p2 = leaves[k + 1];
                Point p3 = leaves[k + 2];
                k = k + 3;
                imageObject.DrawBezier(hullWidth, color, p1, p2, p3);

            }
        }
 protected void FillHull(ref Canvas imageObject)
 {
     Stack<Point> convexHull = LinearAlgebra.GetConvexHull(leaves);
     imageObject.DrawPolygon(color, convexHull.ToArray());
 }
 protected void DrawHull(ref Canvas imageObject)
 {
     Stack<Point> convexHull = LinearAlgebra.GetConvexHull(leaves);
     Point startPoint = convexHull.Pop();
     Point p1 = startPoint;
     while (convexHull.Count() > 0)
     {
         Point p2 = convexHull.Pop();
         imageObject.DrawLine(color, hullWidth, p1, p2);
         p1 = p2;
         if (convexHull.Count == 0)
         {
             imageObject.DrawLine(color, hullWidth, p1, startPoint);
         }
     }
 }
 protected void DrawLeaves(ref Canvas imageObject)
 {
     for (int i = 0; i < leaves.Count(); i++)
     {
         Point leaf = new Point(leaves[i].X, leaves[i].Y);
         imageObject.DrawElipse(color, leafSize, leaf);
     }
 }
 protected void DrawBranches(ref Canvas imageObject)
 {
     for (int i = 0; i < previousGen.Count(); i++)
     {
         Point parent = new Point(previousGen[i].X, previousGen[i].Y);
         Point leaf = new Point(leaves[i].X, leaves[i].Y);
         imageObject.DrawLine(color, branchWidth, parent, leaf);
     }
 }
        protected void DrawBubbleLeaves(ref Canvas imageObject)
        {
            Random rnd = new Random();
            for (int i = leaves.Count() / 2; i < leaves.Count(); i++)
            {
                double scaleFactor = 0.10;
                int xMinCord = (int)Math.Round(leaves[i].X * (1 - scaleFactor));
                int xMaxCord = (int)Math.Round(leaves[i].X + leaves[i].X * scaleFactor);
                int yMinCord = (int)Math.Round(leaves[i].Y * (1 - scaleFactor));
                int yMaxCord = (int)Math.Round(leaves[i].Y + leaves[i].Y * scaleFactor);
                if (xMinCord < xMaxCord && yMinCord < yMaxCord)
                {

                    Point leaf = new Point(rnd.Next(xMinCord, xMaxCord + 1), rnd.Next(yMinCord, yMaxCord + 1));
                    int rndLeafSize = rnd.Next(leafSize);
                    int rndBias = rnd.Next(rndLeafSize);
                    if ((rndLeafSize - rndBias) > 0)
                    {
                        rndLeafSize = rndLeafSize - rndBias;
                    }
                    imageObject.DrawElipse(color, rndLeafSize, leaf);
                }
            }
        }
 internal abstract override void Rasterize(ref Canvas imageObject);
 internal override void Rasterize(ref Canvas imageObject)
 {
     DrawSplinesBetweenLeaves(ref imageObject);
 }
 internal abstract void Rasterize(ref Canvas imageObeject);
 internal override void Rasterize(ref Canvas imageObject)
 {
     FillHull(ref imageObject);
 }
예제 #13
0
 internal View(RenderTargetBitmap image)
 {
     canvas = new Canvas(image);
 }