public unsafe bool IsBackgroundPixel(int val, int axis, bool horizontal) { var i = IndexOf(val, axis, horizontal); if (i == -1) { return(true); } var x = horizontal ? val : axis; var y = horizontal ? axis : val; bool yes = false; int *src = (int *)Pixels; if (BackgroundPen != null) { IBufferPen pen = Factory.Get <IBufferPen>(BackgroundPen, ObjType.Buffer); if (pen == null) { return(false); } yes = src[i] == pen.ReadPixel(val, axis, horizontal); } else { yes = src[i] == 0; } return(yes); }
static unsafe void Scan(IScanner src, int y, int w, int* bkg, IBufferPen pen, int dy, int blen, ref int srcX, ref int srcY, ref int maxX, ref int maxY) { for (int x = 0; x <= w; x++) { var i = x + dy; if (i > blen) break; if (bkg[i] == Geometry.TransparentColor || bkg[i] == pen.ReadPixel(x, y, true)) continue; Add(src, x, y, bkg[i].Alpha(), ref srcX, ref srcY, ref maxX, ref maxY); } }
public void DrawTo(IBuffer Writer, IBufferPen reader) { Writer.WritePixel(X, Y, true, reader.ReadPixel((int)X, (int)Y, true), Implementation.Renderer.AntiAlised); }