public Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { (int w, int h) = pixels.EnsureArray2D(ref _res); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { _res[x, y] = RGBPixel.Max(_res[x, y] * Faktor, pixels[x, y]); } } return(Task.FromResult(_res)); }
public virtual Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { (int w, int h) = pixels.EnsureArray2D(ref _res); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { _res[x, y] = Kern(pixels, x, y, w, h); } } return(Task.FromResult(_res)); }
public Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { if (Richtung == Bewegungrichtung.GenOst || Richtung == Bewegungrichtung.GenWest) { offset = (offset + 1) % sizex; } else { offset = (offset + 1) % sizey; } (int w, int h) = pixels.EnsureArray2D(ref _res); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { switch (Richtung) { case Bewegungrichtung.GenOst: { long xx = (x + offset) % (Abstand + sizex); _res[x, y] = xx >= sizex ? RGBPixel.P0 : pixels[xx, y]; } break; case Bewegungrichtung.GenWest: { long xx = (x + offset) % (Abstand + sizex); _res[x, y] = xx >= sizex ? RGBPixel.P0 : pixels[xx, y]; } break; case Bewegungrichtung.GenNord: { long yy = (y + offset) % (Abstand + sizey); _res[x, y] = yy >= sizey ? RGBPixel.P0 : pixels[x, yy]; } break; default: { long yy = (y - offset) % (Abstand + sizey); _res[x, y] = yy >= sizey ? RGBPixel.P0 : pixels[x, yy]; } break; } } } return(Task.FromResult(_res)); }
public Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { (int w, int h) = pixels.EnsureArray2D(ref _res); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { HSVPixel hsv = pixels[x, y]; _res[x, y] = hsv.Grau(); } } return(Task.FromResult(_res)); }
public Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { (int w, int h) = pixels.EnsureArray2D(ref res); if (_schritt++ == _sprung) { // füge Ausrutscher hinzu var gl = Enumerable.Range(1, Num).Select(_ => (rnd.Next(h), rnd.Next() % 2 == 0)); // erstelle lookup-array mit schiebung je zeile int[] shft = new int[h]; // alles 0!! == nix schieben foreach (var g in gl) { shft[g.Item1] = g.Item2 ? Weite : -Weite; } // kopie mit schift for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { int nx = shft[y] + x; if (nx < 0 || nx >= w) { res[x, y] = RGBPixel.P0; } else { res[x, y] = pixels[nx, y]; } } } ErzeugeNextSprung(); } else { // normale Kopie for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { res[x, y] = pixels[x, y]; } } } return(Task.FromResult(res)); }
public Task <RGBPixel[, ]> Filter(RGBPixel[,] pixels, ulong frame) { Punkt spot = this.weg.Current; (int w, int h) = pixels.EnsureArray2D(ref _res); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { if ((spot.x == x && spot.y == y && !Invers) || ((spot.x != x || spot.y != y) && Invers)) { _res[x, y] = this.Farbe; } else { _res[x, y] = pixels[x, y]; } } } this.weg.MoveNext(); return(Task.FromResult(_res)); }