public override void SetRaster(int x, int y, int xerr, int yerr, int w, int h, int bWidth, int bHeight, int colincx, int colincxerr, int colincy, int colincyerr, int rowincx, int rowincxerr, int rowincy, int rowincyerr) { sbyte[] inData = this.InData; int[] outData = this.OutData; int @out = OutOff; int inSpan = this.InSpan; int inOff = this.InOff; int outSpan = this.OutSpan; int rowx = x; int rowy = y; int rowxerr = xerr; int rowyerr = yerr; int[] rgbs = new int[4]; for (int j = 0; j < h; j++) { x = rowx; y = rowy; xerr = rowxerr; yerr = rowyerr; for (int i = 0; i < w; i++) { int nextx, nexty; if ((nextx = x + 1) >= bWidth) { nextx = 0; } if ((nexty = y + 1) >= bHeight) { nexty = 0; } rgbs[0] = InPalette[0xff & inData[inOff + x + inSpan * y]]; rgbs[1] = InPalette[0xff & inData[inOff + nextx + inSpan * y]]; rgbs[2] = InPalette[0xff & inData[inOff + x + inSpan * nexty]]; rgbs[3] = InPalette[0xff & inData[inOff + nextx + inSpan * nexty]]; outData[@out + i] = TexturePaintContext.Blend(rgbs, xerr, yerr); if ((xerr += colincxerr) < 0) { xerr &= Integer.MaxValue; x++; } if ((x += colincx) >= bWidth) { x -= bWidth; } if ((yerr += colincyerr) < 0) { yerr &= Integer.MaxValue; y++; } if ((y += colincy) >= bHeight) { y -= bHeight; } } if ((rowxerr += rowincxerr) < 0) { rowxerr &= Integer.MaxValue; rowx++; } if ((rowx += rowincx) >= bWidth) { rowx -= bWidth; } if ((rowyerr += rowincyerr) < 0) { rowyerr &= Integer.MaxValue; rowy++; } if ((rowy += rowincy) >= bHeight) { rowy -= bHeight; } @out += outSpan; } }
public override void SetRaster(int x, int y, int xerr, int yerr, int w, int h, int bWidth, int bHeight, int colincx, int colincxerr, int colincy, int colincyerr, int rowincx, int rowincxerr, int rowincy, int rowincyerr) { Object data = null; int rowx = x; int rowy = y; int rowxerr = xerr; int rowyerr = yerr; WritableRaster srcRas = this.SrcRas; WritableRaster outRas = this.OutRas; int[] rgbs = Filter ? new int[4] : null; for (int j = 0; j < h; j++) { x = rowx; y = rowy; xerr = rowxerr; yerr = rowyerr; for (int i = 0; i < w; i++) { data = srcRas.GetDataElements(x, y, data); if (Filter) { int nextx, nexty; if ((nextx = x + 1) >= bWidth) { nextx = 0; } if ((nexty = y + 1) >= bHeight) { nexty = 0; } rgbs[0] = ColorModel_Renamed.GetRGB(data); data = srcRas.GetDataElements(nextx, y, data); rgbs[1] = ColorModel_Renamed.GetRGB(data); data = srcRas.GetDataElements(x, nexty, data); rgbs[2] = ColorModel_Renamed.GetRGB(data); data = srcRas.GetDataElements(nextx, nexty, data); rgbs[3] = ColorModel_Renamed.GetRGB(data); int rgb = TexturePaintContext.Blend(rgbs, xerr, yerr); data = ColorModel_Renamed.GetDataElements(rgb, data); } outRas.SetDataElements(i, j, data); if ((xerr += colincxerr) < 0) { xerr &= Integer.MaxValue; x++; } if ((x += colincx) >= bWidth) { x -= bWidth; } if ((yerr += colincyerr) < 0) { yerr &= Integer.MaxValue; y++; } if ((y += colincy) >= bHeight) { y -= bHeight; } } if ((rowxerr += rowincxerr) < 0) { rowxerr &= Integer.MaxValue; rowx++; } if ((rowx += rowincx) >= bWidth) { rowx -= bWidth; } if ((rowyerr += rowincyerr) < 0) { rowyerr &= Integer.MaxValue; rowy++; } if ((rowy += rowincy) >= bHeight) { rowy -= bHeight; } } }
public override void SetRaster(int x, int y, int xerr, int yerr, int w, int h, int bWidth, int bHeight, int colincx, int colincxerr, int colincy, int colincyerr, int rowincx, int rowincxerr, int rowincy, int rowincyerr) { int[] inData = this.InData; int[] outData = this.OutData; int @out = OutOff; int inSpan = this.InSpan; int inOff = this.InOff; int outSpan = this.OutSpan; bool filter = this.Filter; bool normalx = (colincx == 1 && colincxerr == 0 && colincy == 0 && colincyerr == 0) && !filter; int rowx = x; int rowy = y; int rowxerr = xerr; int rowyerr = yerr; if (normalx) { outSpan -= w; } int[] rgbs = filter ? new int[4] : null; for (int j = 0; j < h; j++) { if (normalx) { int @in = inOff + rowy * inSpan + bWidth; x = bWidth - rowx; @out += w; if (bWidth >= 32) { int i = w; while (i > 0) { int copyw = (i < x) ? i : x; System.Array.Copy(inData, @in - x, outData, @out - i, copyw); i -= copyw; if ((x -= copyw) == 0) { x = bWidth; } } } else { for (int i = w; i > 0; i--) { outData[@out - i] = inData[@in - x]; if (--x == 0) { x = bWidth; } } } } else { x = rowx; y = rowy; xerr = rowxerr; yerr = rowyerr; for (int i = 0; i < w; i++) { if (filter) { int nextx, nexty; if ((nextx = x + 1) >= bWidth) { nextx = 0; } if ((nexty = y + 1) >= bHeight) { nexty = 0; } rgbs[0] = inData[inOff + y * inSpan + x]; rgbs[1] = inData[inOff + y * inSpan + nextx]; rgbs[2] = inData[inOff + nexty * inSpan + x]; rgbs[3] = inData[inOff + nexty * inSpan + nextx]; outData[@out + i] = TexturePaintContext.Blend(rgbs, xerr, yerr); } else { outData[@out + i] = inData[inOff + y * inSpan + x]; } if ((xerr += colincxerr) < 0) { xerr &= Integer.MaxValue; x++; } if ((x += colincx) >= bWidth) { x -= bWidth; } if ((yerr += colincyerr) < 0) { yerr &= Integer.MaxValue; y++; } if ((y += colincy) >= bHeight) { y -= bHeight; } } } if ((rowxerr += rowincxerr) < 0) { rowxerr &= Integer.MaxValue; rowx++; } if ((rowx += rowincx) >= bWidth) { rowx -= bWidth; } if ((rowyerr += rowincyerr) < 0) { rowyerr &= Integer.MaxValue; rowy++; } if ((rowy += rowincy) >= bHeight) { rowy -= bHeight; } @out += outSpan; } }