Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public static Bitmap Sphere(Bitmap bitmap, PixelPoint pixelPoint)
        {
            SphereFilter sFilter = new SphereFilter(pixelPoint);

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