public void Styles(int left, int right) { AntiAliasingCell cell = new AntiAliasingCell(); cell.Initial(); cell.left = (short)left; cell.right = (short)right; _rasterizer.Style(cell); if (left >= 0 && left < _minStyle) { _minStyle = left; } if (left >= 0 && left > _maxStyle) { _maxStyle = left; } if (right >= 0 && right < _minStyle) { _minStyle = right; } if (right >= 0 && right > _maxStyle) { _maxStyle = right; } }
public bool NotEqual(int ex, int ey, AntiAliasingCell cell) { unchecked { return ((ex - x) | (ey - y) | (left - cell.left) | (right - cell.right)) != 0; } }
public bool NotEqual(int ex, int ey, AntiAliasingCell cell) { unchecked { return(((ex - x) | (ey - y) | (left - cell.left) | (right - cell.right)) != 0); } }
static void SwapCells(AntiAliasingCell a, AntiAliasingCell b) { AntiAliasingCell temp = a; a = b; b = temp; }
public void Set(AntiAliasingCell cellB) { x = cellB.x; y = cellB.y; cover = cellB.cover; area = cellB.area; left = cellB.left; right = cellB.right; }
public void Sort(AntiAliasingCell[] dataToSort, uint beg, uint end) { if (end == beg) { return; } else { uint pivot = GetPivotPoint(dataToSort, beg, end); if (pivot > beg) { Sort(dataToSort, beg, pivot - 1); } if (pivot < end) { Sort(dataToSort, pivot + 1, end); } } }
private uint GetPivotPoint(AntiAliasingCell[] dataToSort, uint begPoint, uint endPoint) { uint pivot = begPoint; uint m = begPoint+1; uint 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) { AntiAliasingCell 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) { AntiAliasingCell temp2 = dataToSort[n]; dataToSort[n] = dataToSort[pivot]; dataToSort[pivot] = temp2; } return n; }
private uint GetPivotPoint(AntiAliasingCell[] dataToSort, uint begPoint, uint endPoint) { uint pivot = begPoint; uint m = begPoint + 1; uint 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) { AntiAliasingCell 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) { AntiAliasingCell temp2 = dataToSort[n]; dataToSort[n] = dataToSort[pivot]; dataToSort[pivot] = temp2; } return(n); }
public void Sort(AntiAliasingCell[] dataToSort) { Sort(dataToSort, 0, (uint)(dataToSort.Length- 1)); }
public void Style(AntiAliasingCell style_cell) { m_style_cell.Style = style_cell; }
public void Styles(int left, int right) { AntiAliasingCell cell = new AntiAliasingCell(); cell.Initial(); cell.left = (short)left; cell.right = (short)right; _rasterizer.Style(cell); if (left >= 0 && left < _minStyle) _minStyle = left; if (left >= 0 && left > _maxStyle) _maxStyle = left; if (right >= 0 && right < _minStyle) _minStyle = right; if (right >= 0 && right > _maxStyle) _maxStyle = right; }
//-------------------------------------------------------------------- public bool SweepScanline(IScanline sl) { #if use_timers SweepSacanLine.Start(); #endif for (; ;) { if (m_scan_y > m_outline.MaxY()) { #if use_timers SweepSacanLine.Stop(); #endif return(false); } sl.ResetSpans(); uint scan_y_uint = 0; // it is going to Get initialize to 0 anyway so make it Clear. if (m_scan_y > 0) { scan_y_uint = (uint)m_scan_y; } uint num_cells = m_outline.ScanlineNumCells(scan_y_uint); AntiAliasingCell[] cells; uint Offset; m_outline.ScanlineCells(scan_y_uint, out cells, out Offset); int cover = 0; while (num_cells != 0) { AntiAliasingCell cur_cell = cells[Offset]; int x = cur_cell.x; int area = cur_cell.area; uint 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 << ((int)poly_subpixel_scale_e.Shift + 1)) - area); if (alpha != 0) { sl.AddCell(x, alpha); } x++; } if ((num_cells != 0) && (cur_cell.x > x)) { alpha = CalculateAlpha(cover << ((int)poly_subpixel_scale_e.Shift + 1)); if (alpha != 0) { sl.AddSpan(x, (cur_cell.x - x), alpha); } } } if (sl.NumberOfSpans != 0) { break; } ++m_scan_y; } sl.Finalize(m_scan_y); ++m_scan_y; #if use_timers SweepSacanLine.Stop(); #endif return(true); }
///<summary> ///</summary> ///<param name="sl"></param> ///<param name="styleIdx"></param> ///<returns></returns> public bool SweepScanline(IScanline sl, int styleIdx) { int scanY = _scanY - 1; if (scanY > _rasterizer.MaxY()) { return(false); } sl.ResetSpans(); uint masterAlpha = AntiAliasingMask; if (styleIdx < 0) { styleIdx = 0; } else { styleIdx++; masterAlpha = _masterAlpha[(uint)(_activeStyleTable[(uint)styleIdx] + _minStyle - 1)]; } StyleInfo st = _activeStyles[_activeStyleTable[styleIdx]]; int numCells = (int)st.NumCells; uint cellOffset = st.StartCell; AntiAliasingCell cell = _cells[cellOffset]; int cover = 0; while (numCells-- != 0) { uint alpha; int x = cell.x; int area = cell.area; cover += cell.cover; cell = _cells[++cellOffset]; if (area != 0) { alpha = CalculateAlpha((cover << (PolygonSubpixelShift + 1)) - area, masterAlpha); sl.AddCell(x, alpha); x++; } if (numCells == 0 || cell.x <= x) { continue; } alpha = CalculateAlpha(cover << (PolygonSubpixelShift + 1), masterAlpha); if (alpha != 0) { sl.AddSpan(x, cell.x - x, alpha); } } if (sl.NumberOfSpans == 0) { return(false); } sl.Finalize(scanY); return(true); }
public void ScanlineCells(uint y, out AntiAliasingCell[] CellData, out uint Offset) { CellData = m_sorted_cells.Data(); Offset = m_sorted_y[(int)y - m_min_y].start; }