示例#1
0
        ////////////////////////////////////////////////

        static Polygons ExPolygons2Polygons(ExPolygons epgs)
        {
            Polygons result = new Polygons();

            foreach (ExPolygon epg in epgs)
            {
                result.Add(epg.outer);
                foreach (Polygon hole in epg.holes)
                {
                    result.Add(hole);
                }
            }
            return(result);
        }
示例#2
0
        //---------------------------------------------------------------------

        private void Form1_Load(object sender, EventArgs e)
        {
            mybitmap = new Bitmap(
                pictureBox1.ClientRectangle.Width,
                pictureBox1.ClientRectangle.Height,
                PixelFormat.Format32bppArgb);

            subjects   = new Polygons();
            clips      = new Polygons();
            solution   = new Polygons();
            exSolution = new ExPolygons();

            toolStripStatusLabel1.Text =
                "Tip: Use the mouse-wheel (or +,-,0) to adjust the offset of the solution polygons.";
            DrawBitmap();
        }
示例#3
0
文件: Clipper.cs 项目: msiyer/Pinta
        //------------------------------------------------------------------------------

        public bool Execute(ClipType clipType, ExPolygons solution,
            PolyFillType subjFillType, PolyFillType clipFillType)
        {
            if (m_ExecuteLocked) return false;
            m_ExecuteLocked = true;
            solution.Clear();
            m_SubjFillType = subjFillType;
            m_ClipFillType = clipFillType;
            m_ClipType = clipType;
            bool succeeded = ExecuteInternal(true);
            //build the return polygons ...
            if (succeeded) BuildResultEx(solution);
            m_ExecuteLocked = false;
            return succeeded;
        }
示例#4
0
文件: Clipper.cs 项目: msiyer/Pinta
        //------------------------------------------------------------------------------

        private void BuildResultEx(ExPolygons polyg)
        {         
            polyg.Clear();
            polyg.Capacity = m_PolyOuts.Count;
            int i = 0;
            while (i < m_PolyOuts.Count)
            {
                OutRec outRec = m_PolyOuts[i++];
                if (outRec.pts == null) break; //nb: already sorted here
                OutPt p = outRec.pts;
                int cnt = PointCount(p);
                if (cnt < 3) continue;
                ExPolygon epg = new ExPolygon();
                epg.outer = new Polygon(cnt);
                epg.holes = new Polygons();
                for (int j = 0; j < cnt; j++)
                {
                    epg.outer.Add(p.pt);
                    p = p.next;
                }
                while (i < m_PolyOuts.Count)
                {
                    outRec = m_PolyOuts[i];
                    if (outRec.pts == null || !outRec.isHole) break;
                    Polygon pg = new Polygon();
                    p = outRec.pts;
                    do
                    {
                        pg.Add(p.pt);
                        p = p.next;
                    } while (p != outRec.pts);
                    epg.holes.Add(pg);
                    i++;
                }
                polyg.Add(epg);
            }
        }
示例#5
0
文件: Clipper.cs 项目: msiyer/Pinta
        //------------------------------------------------------------------------------

        public bool Execute(ClipType clipType, ExPolygons solution)
        {
            return Execute(clipType, solution,
                PolyFillType.pftEvenOdd, PolyFillType.pftEvenOdd);
        }