public Bitmap ApplyFilter(Bitmap bitmap) { Bitmap newB = (Bitmap)bitmap.Clone(); PixelPoint curPoint = new PixelPoint(); PixelPoint newPoint = new PixelPoint(); for (int y = 0; y < bitmap.Height; ++y) { for (int x = 0; x < bitmap.Width; ++x) { curPoint.x = x; curPoint.y = y; newPoint = GetOffset(curPoint); newPoint.x = MathUtils.Clamp(newPoint.x, 0, bitmap.Width - 1); newPoint.y = MathUtils.Clamp(newPoint.y, 0, bitmap.Height - 1); newB.SetPixel(x, y, bitmap.GetPixel(newPoint.x, newPoint.y)); } } return(newB); }
public static Bitmap Sphere(Bitmap bitmap, PixelPoint pixelPoint) { SphereFilter sFilter = new SphereFilter(pixelPoint); return(sFilter.ApplyFilter(bitmap)); }
public MeanSphereConfig(int nWeight, PaddingType paddingType, PixelPoint sphereMidPoint) { this.nWeight = nWeight; this.paddingType = paddingType; this.sphereMidPoint = sphereMidPoint; }
public SphereFilter(int xMid, int yMid) { this.midPoint = new PixelPoint(xMid, yMid); }
public SphereFilter(PixelPoint midPoint) { this.midPoint = midPoint; }
protected virtual PixelPoint GetOffset(PixelPoint startPoint) { return(startPoint); }