AddCell() публичный абстрактный Метод

public abstract AddCell ( int x, int cover ) : void
x int
cover int
Результат void
Пример #1
0
        //--------------------------------------------------------------------
        internal bool SweepScanline(Scanline scline)
        {
            for (;;)
            {
                if (m_scan_y > m_cellAARas.MaxY)
                {
                    return(false);
                }

                scline.ResetSpans();
                CellAA[] cells;
                int      offset;
                int      num_cells;
                m_cellAARas.GetCells(m_scan_y, out cells, out offset, out num_cells);
                int cover = 0;
                while (num_cells != 0)
                {
                    unsafe
                    {
                        fixed(CellAA *cur_cell_h = &cells[0])
                        {
                            CellAA *cur_cell_ptr = cur_cell_h + offset;
                            int     alpha;
                            int     x    = cur_cell_ptr->x;
                            int     area = cur_cell_ptr->area;

                            cover += cur_cell_ptr->cover;
                            //accumulate all cells with the same X
                            while (--num_cells != 0)
                            {
                                offset++;       //move next
                                cur_cell_ptr++; //move next
                                if (cur_cell_ptr->x != x)
                                {
                                    break;
                                }

                                area  += cur_cell_ptr->area;
                                cover += cur_cell_ptr->cover;
                            }

                            if (area != 0)
                            {
                                alpha = CalculateAlpha((cover << (poly_subpix.SHIFT + 1)) - area);
                                if (alpha != 0)
                                {
                                    scline.AddCell(x, alpha);
                                }
                                x++;
                            }

                            if ((num_cells != 0) && (cur_cell_ptr->x > x))
                            {
                                alpha = CalculateAlpha(cover << (poly_subpix.SHIFT + 1));
                                if (alpha != 0)
                                {
                                    scline.AddSpan(x, (cur_cell_ptr->x - x), alpha);
                                }
                            }
                        }

                        //CellAA 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 = CalculateAlpha((cover << (poly_subpix.SHIFT + 1)) - area);
                        //    if (alpha != 0)
                        //    {
                        //        scline.AddCell(x, alpha);
                        //    }
                        //    x++;
                        //}

                        //if ((num_cells != 0) && (cur_cell.x > x))
                        //{
                        //    alpha = CalculateAlpha(cover << (poly_subpix.SHIFT + 1));
                        //    if (alpha != 0)
                        //    {
                        //        scline.AddSpan(x, (cur_cell.x - x), alpha);
                        //    }
                        //}
                    }
                }

                if (scline.SpanCount != 0)
                {
                    break;
                }

                ++m_scan_y;
            }

            scline.CloseLine(m_scan_y);
            ++m_scan_y;
            return(true);
        }
Пример #2
0
        //--------------------------------------------------------------------
        internal bool SweepScanline(Scanline scline)
        {
            for (;;)
            {
                if (m_scan_y > m_cellAARas.MaxY)
                {
                    return(false);
                }

                scline.ResetSpans();
                //-------------------------
                CellAA[] cells;
                int      offset;
                int      num_cells;
                m_cellAARas.GetCells(m_scan_y, out cells, out offset, out num_cells);
                int cover = 0;
                while (num_cells != 0)
                {
                    unsafe
                    {
                        fixed(CellAA *cur_cell_h = &cells[0])
                        {
                            CellAA *cur_cell_ptr = cur_cell_h + offset;
                            int     x            = cur_cell_ptr->x;
                            int     area         = cur_cell_ptr->area;

                            cover += cur_cell_ptr->cover;
                            //accumulate all cells with the same X
                            while (--num_cells != 0)
                            {
                                offset++;       //move next
                                cur_cell_ptr++; //move next
                                if (cur_cell_ptr->x != x)
                                {
                                    break;
                                }
                                area  += cur_cell_ptr->area;
                                cover += cur_cell_ptr->cover;
                            }

                            if (area != 0)
                            {
                                //-----------------------------------------------
                                //single cell, for antialias look
                                //-----------------------------------------------
                                int alpha = CalculateAlpha((cover << (poly_subpix.SHIFT + 1)) - area);
                                if (alpha != 0)
                                {
                                    scline.AddCell(x, alpha);
                                }

                                x++;
                            }

                            if ((num_cells != 0) && (cur_cell_ptr->x > x))
                            {
                                //-----------------------------------------------
                                //this is long span , continuous color, solid look
                                //-----------------------------------------------
                                int alpha = CalculateAlpha(cover << (poly_subpix.SHIFT + 1));
                                if (alpha != 0)
                                {
                                    scline.AddSpan(x, (cur_cell_ptr->x - x), alpha);
                                }
                            }
                        }
                    }
                }

                if (scline.SpanCount != 0)
                {
                    break;
                }

                ++m_scan_y;
            }

            scline.CloseLine(m_scan_y);
            ++m_scan_y;
            return(true);
        }
        //--------------------------------------------------------------------
        internal bool SweepScanline(Scanline scline)
        {
            for (; ; )
            {
                if (m_scan_y > m_cellAARas.MaxY)
                {
                    return false;
                }

                scline.ResetSpans();
                //-------------------------
                CellAA[] cells;
                int offset;
                int num_cells;
                m_cellAARas.GetCells(m_scan_y, out cells, out offset, out num_cells);
                int cover = 0;
                while (num_cells != 0)
                {
                    unsafe
                    {
                        fixed (CellAA* cur_cell_h = &cells[0])
                        {
                            CellAA* cur_cell_ptr = cur_cell_h + offset;
                            int x = cur_cell_ptr->x;
                            int area = cur_cell_ptr->area;
                            cover += cur_cell_ptr->cover;
                            //accumulate all cells with the same X
                            while (--num_cells != 0)
                            {
                                offset++; //move next
                                cur_cell_ptr++; //move next
                                if (cur_cell_ptr->x != x)
                                {
                                    break;
                                }
                                area += cur_cell_ptr->area;
                                cover += cur_cell_ptr->cover;
                            }

                            if (area != 0)
                            {
                                //-----------------------------------------------
                                //single cell, for antialias look
                                //-----------------------------------------------
                                int alpha = CalculateAlpha((cover << (poly_subpix.SHIFT + 1)) - area);
                                if (alpha != 0)
                                {
                                    scline.AddCell(x, alpha);
                                }

                                x++;
                            }

                            if ((num_cells != 0) && (cur_cell_ptr->x > x))
                            {
                                //-----------------------------------------------
                                //this is long span , continuous color, solid look
                                //-----------------------------------------------
                                int alpha = CalculateAlpha(cover << (poly_subpix.SHIFT + 1));
                                if (alpha != 0)
                                {
                                    scline.AddSpan(x, (cur_cell_ptr->x - x), alpha);
                                }
                            }
                        }
                    }
                }

                if (scline.SpanCount != 0) { break; }

                ++m_scan_y;
            }

            scline.CloseLine(m_scan_y);
            ++m_scan_y;
            return true;
        }