public unsafe void Render(ISurface <ColorAlpha8> dst, PointInt32 renderOffset) { this.cancelToken.ThrowIfCancellationRequested <ICancellationToken>(); int width = dst.Width; int height = dst.Height; RectInt32 bounds = RectInt32.Inflate(new RectInt32(renderOffset, new SizeInt32(width, height)), 1, 1); byte[] buffer = toleranceToMaskValueLookupTable(this.tolerance); this.cancelToken.ThrowIfCancellationRequested <ICancellationToken>(); using (ISurface <ColorAlpha8> surface = UseTileOrToSurfaceWithEdgePadding(this.stencilSource, bounds, ColorAlpha8.Transparent)) { for (int i = 0; i < height; i++) { this.cancelToken.ThrowIfCancellationRequested <ICancellationToken>(); byte *rowPointer = (byte *)dst.GetRowPointer <ColorAlpha8>(i); byte *numPtr2 = (byte *)surface.GetPointPointer <ColorAlpha8>(0, i); byte *numPtr3 = (byte *)surface.GetPointPointer <ColorAlpha8>(0, (i + 1)); byte *numPtr4 = (byte *)surface.GetPointPointer <ColorAlpha8>(0, (i + 2)); for (int j = 0; j < width; j++) { byte num6; byte num7 = numPtr3[1]; if (num7 != 0) { num6 = num7; } else { byte num8 = numPtr2[0]; byte num9 = numPtr2[1]; byte num10 = numPtr2[2]; byte num11 = numPtr3[0]; byte num12 = numPtr3[2]; byte num13 = numPtr4[0]; byte num14 = numPtr4[1]; byte num15 = numPtr4[2]; if ((((num8 == 0xff) || (num9 == 0xff)) || ((num10 == 0xff) || (num11 == 0xff))) || (((num12 == 0xff) || (num13 == 0xff)) || ((num14 == 0xff) || (num15 == 0xff)))) { ColorBgra b = this.colorSource.GetPointSlow(j + renderOffset.X, i + renderOffset.Y); byte distance = FloodFillAlgorithm.GetDistance(this.basis, b); byte mask = buffer[distance]; byte coverage = this.GetCoverageValue(num8, num9, num10, num11, num12, num13, num14, num15); num6 = this.CombineMaskAndCoverageValues(mask, coverage); } else { num6 = 0; } } rowPointer[0] = num6; rowPointer++; numPtr2++; numPtr3++; numPtr4++; } } } }
public unsafe void Render(ISurface <ColorAlpha8> dst, PointInt32 renderOffset) { int width = dst.Width; int height = dst.Height; RectInt32 bounds = new RectInt32(renderOffset, new SizeInt32(width, height)); if (!this.isCancellationRequestedFn()) { using (ISurface <ColorBgra> surface = this.sampleSource.UseTileOrToSurface(bounds)) { for (int i = 0; i < height; i++) { if (this.isCancellationRequestedFn()) { return; } ColorBgra *rowPointer = (ColorBgra *)surface.GetRowPointer <ColorBgra>(i); byte * numPtr = (byte *)dst.GetPointPointer <ColorAlpha8>(0, i); for (int j = 0; j < width; j++) { byte num6; ColorBgra b = rowPointer[0]; if (b == this.basis) { num6 = 0xff; } else if (FloodFillAlgorithm.GetDistance(this.basis, b) <= this.tolerance) { num6 = 0xff; } else { num6 = 0; } numPtr[0] = num6; numPtr++; rowPointer++; } } } } }