public bool not_equal(int ex, int ey, cell_aa cell)
 {
     unchecked
     {
         return(((ex - x) | (ey - y) | (left - cell.left) | (right - cell.right)) != 0);
     }
 }
        public void styles(int left, int right)
        {
            cell_aa cell = new cell_aa();

            cell.initial();
            cell.left  = (int)left;
            cell.right = (int)right;
            m_Rasterizer.style(cell);
            if (left >= 0 && left < m_min_style)
            {
                m_min_style = left;
            }
            if (left >= 0 && left > m_max_style)
            {
                m_max_style = left;
            }
            if (right >= 0 && right < m_min_style)
            {
                m_min_style = right;
            }
            if (right >= 0 && right > m_max_style)
            {
                m_max_style = right;
            }
        }
		public bool not_equal(int ex, int ey, cell_aa cell)
		{
			unchecked
			{
				return ((ex - x) | (ey - y) | (left - cell.left) | (right - cell.right)) != 0;
			}
		}
        private static void swap_cells(cell_aa a, cell_aa b)
        {
            cell_aa temp = a;

            a = b;
            b = temp;
        }
 public void Set(cell_aa cellB)
 {
     x     = cellB.x;
     y     = cellB.y;
     cover = cellB.cover;
     area  = cellB.area;
     left  = cellB.left;
     right = cellB.right;
 }
		public void Set(cell_aa cellB)
		{
			x = cellB.x;
			y = cellB.y;
			cover = cellB.cover;
			area = cellB.area;
			left = cellB.left;
			right = cellB.right;
		}
Esempio n. 7
0
        private int getPivotPoint(cell_aa[] dataToSort, int begPoint, int endPoint)
        {
            int pivot = begPoint;
            int m     = begPoint + 1;
            int n     = endPoint;

            while ((m < endPoint) &&
                   dataToSort[pivot].x >= dataToSort[m].x)
            {
                m++;
            }

            while ((n > begPoint) && (dataToSort[pivot].x <= dataToSort[n].x))
            {
                n--;
            }
            while (m < n)
            {
                cell_aa temp = dataToSort[m];
                dataToSort[m] = dataToSort[n];
                dataToSort[n] = temp;

                while ((m < endPoint) && (dataToSort[pivot].x >= dataToSort[m].x))
                {
                    m++;
                }

                while ((n > begPoint) && (dataToSort[pivot].x <= dataToSort[n].x))
                {
                    n--;
                }
            }
            if (pivot != n)
            {
                cell_aa temp2 = dataToSort[n];
                dataToSort[n]     = dataToSort[pivot];
                dataToSort[pivot] = temp2;
            }
            return(n);
        }
        // Sweeps one scanline with one style index. The style ID can be
        // determined by calling style().
        //template<class Scanline>
        public bool sweep_scanline(IScanlineCache sl, int style_idx)
        {
            int scan_y = m_scan_y - 1;

            if (scan_y > m_Rasterizer.max_y())
            {
                return(false);
            }

            sl.ResetSpans();

            int master_alpha = aa_mask;

            if (style_idx < 0)
            {
                style_idx = 0;
            }
            else
            {
                style_idx++;
                master_alpha = m_master_alpha[(int)(m_ast[(int)style_idx] + m_min_style - 1)];
            }

            style_info st = m_styles[m_ast[style_idx]];

            int     num_cells  = (int)st.num_cells;
            int     CellOffset = st.start_cell;
            cell_aa cell       = m_cells[CellOffset];

            int cover = 0;

            while (num_cells-- != 0)
            {
                int alpha;
                int x    = cell.x;
                int area = cell.area;

                cover += cell.cover;

                cell = m_cells[++CellOffset];

                if (area != 0)
                {
                    alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area,
                                            master_alpha);
                    sl.add_cell(x, alpha);
                    x++;
                }

                if (num_cells != 0 && cell.x > x)
                {
                    alpha = calculate_alpha(cover << (poly_subpixel_shift + 1),
                                            master_alpha);
                    if (alpha != 0)
                    {
                        sl.add_span(x, cell.x - x, alpha);
                    }
                }
            }

            if (sl.num_spans() == 0)
            {
                return(false);
            }
            sl.finalize(scan_y);
            return(true);
        }
 public void styles(int left, int right)
 {
     cell_aa cell = new cell_aa();
     cell.initial();
     cell.left = (int)left;
     cell.right = (int)right;
     m_Rasterizer.style(cell);
     if(left  >= 0 && left  < m_min_style) m_min_style = left;
     if(left  >= 0 && left  > m_max_style) m_max_style = left;
     if(right >= 0 && right < m_min_style) m_min_style = right;
     if(right >= 0 && right > m_max_style) m_max_style = right;
 }
Esempio n. 10
0
        //--------------------------------------------------------------------
        public bool sweep_scanline(IScanlineCache scanlineCache)
        {
            for (; ;)
            {
                if (m_scan_y > m_outline.max_y())
                {
                    return(false);
                }

                scanlineCache.ResetSpans();
                int       num_cells = (int)m_outline.scanline_num_cells(m_scan_y);
                cell_aa[] cells;
                int       Offset;
                m_outline.scanline_cells(m_scan_y, out cells, out Offset);
                int cover = 0;

                while (num_cells != 0)
                {
                    cell_aa cur_cell = cells[Offset];
                    int     x        = cur_cell.x;
                    int     area     = cur_cell.area;
                    int     alpha;

                    cover += cur_cell.cover;

                    //accumulate all cells with the same X
                    while (--num_cells != 0)
                    {
                        Offset++;
                        cur_cell = cells[Offset];
                        if (cur_cell.x != x)
                        {
                            break;
                        }

                        area  += cur_cell.area;
                        cover += cur_cell.cover;
                    }

                    if (area != 0)
                    {
                        alpha = calculate_alpha((cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1)) - area);
                        if (alpha != 0)
                        {
                            scanlineCache.add_cell(x, alpha);
                        }
                        x++;
                    }

                    if ((num_cells != 0) && (cur_cell.x > x))
                    {
                        alpha = calculate_alpha(cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1));
                        if (alpha != 0)
                        {
                            scanlineCache.add_span(x, (cur_cell.x - x), alpha);
                        }
                    }
                }

                if (scanlineCache.num_spans() != 0)
                {
                    break;
                }
                ++m_scan_y;
            }

            scanlineCache.finalize(m_scan_y);
            ++m_scan_y;
            return(true);
        }
 public void style(cell_aa cellB)
 {
     left  = cellB.left;
     right = cellB.right;
 }
 public void style(cell_aa style_cell)
 {
     m_style_cell.style(style_cell);
 }
		public void style(cell_aa cellB)
		{
			left = cellB.left;
			right = cellB.right;
		}
		private static void swap_cells(cell_aa a, cell_aa b)
		{
			cell_aa temp = a;
			a = b;
			b = temp;
		}
		public void scanline_cells(int y, out cell_aa[] CellData, out int Offset)
		{
			CellData = m_sorted_cells.data();
			Offset = m_sorted_y[y - m_min_y].start;
		}
		public void style(cell_aa style_cell)
		{
			m_style_cell.style(style_cell);
		}