Exemple #1
0
        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);
        }
Exemple #2
0
        public static Bitmap Sphere(Bitmap bitmap, PixelPoint pixelPoint)
        {
            SphereFilter sFilter = new SphereFilter(pixelPoint);

            return(sFilter.ApplyFilter(bitmap));
        }
Exemple #3
0
 public MeanSphereConfig(int nWeight, PaddingType paddingType, PixelPoint sphereMidPoint)
 {
     this.nWeight        = nWeight;
     this.paddingType    = paddingType;
     this.sphereMidPoint = sphereMidPoint;
 }
Exemple #4
0
 public SphereFilter(int xMid, int yMid)
 {
     this.midPoint = new PixelPoint(xMid, yMid);
 }
Exemple #5
0
 public SphereFilter(PixelPoint midPoint)
 {
     this.midPoint = midPoint;
 }
Exemple #6
0
 protected virtual PixelPoint GetOffset(PixelPoint startPoint)
 {
     return(startPoint);
 }