Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Image Render(RenderState State = RenderState.FullOverlay)
        {
            Image Img = null;
            Graphics g;
            switch (State)
            {
                case RenderState.Original:
                    Img = (Image)mBaseImage.Clone();
                    break;

                case RenderState.FullOverlay:
                    Img = (Image)mBaseImage.Clone();
                    g = Graphics.FromImage(Img);
                    foreach (Child c in mChildren)
                        c.Draw(g);
                    g.Dispose();
                    break;

                case RenderState.Base1Shapes:
                    Img = new Bitmap(mBaseImage.Width, mBaseImage.Height);
                    g = Graphics.FromImage(Img);
                    foreach (Child c in mChildren)
                        c.Draw(g);
                    g.Dispose();
                    break;

                case RenderState.Negative:
                    Img = (Image)mLeftover.Clone();
                    break;

                case RenderState.EditOrig:
                    ImgManip Man = new ImgManip(ref mBaseImage);
                    Man.ReduceColors(mColorDetail);
                    Man.ReduceGrid(mResDetail);
                    Img = Man.GetImage;
                    break;
            }
            return Img;
        }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Count"></param>
        public void GenerateChildren()
        {
            //int Count = 0;
            #if GUIOUTPUT
            double Prog = 0d;
            ProgressDisplay Disp = new ProgressDisplay();
            System.Threading.Tasks.Task t = new System.Threading.Tasks.Task(new Action(Disp.Show));
            t.Start();
            #endif
            //Reduce the image into simplicity
            mLeftover = (Bitmap)mBaseImage.Clone();
            ImgManip Man = new ImgManip(ref mLeftover);
            Man.ReduceColors(mColorDetail);
            mScale = Man.ReduceGrid(mResDetail);
            mLeftover = Man.GetImage;
            Bitmap Clear = new Bitmap(mLeftover.Width, mLeftover.Height);
            Graphics.FromImage(Clear).Clear(Constants.ALPHA_FULL);
            ImageSection Img = new ImageSection(new Point(0, 0), mLeftover, Clear, Color.Empty);

            mChildren = Child.ScanImageSection(Img, mColorForgive, mColorDetail, mMinMargin);
            #if GUIOUTPUT
            Prog = 0.5d;
            #endif
            //Count += mChildren.Length;
            double Scale;
            foreach (Child c in mChildren)
            {
                Scale = Constants.GetScale(((ImageSection)c).Size, this.Size);
                c.GenerateSubChildren((int)(Scale * mColorForgive), (int)(Scale * mColorDetail), mMinMargin);
            #if GUIOUTPUT
                Prog += 1d / (double)mChildren.Count() * 0.5d;
            #endif
            }
            #if GUIOUTPUT
            Disp.Close();
            Disp.Dispose();
            t.Dispose();
            #endif
        }