Пример #1
0
        private void GreyalizePixel(int x, int y, EditableBitmap _outputImage)
        {
            Color originalColor = _inputImage.GetPixel(x, y);
            int   colorValue    = SumColorValues(originalColor);

            colorValue = colorValue / 4;
            Color newColor = ColorFromValue(colorValue);

            _outputImage.SetPixelColor(x, y, newColor);
        }
Пример #2
0
 private void SetColor(EditableBitmap image, Int32Rect area, Color color)
 {
     for (int x = area.X; x < area.X + area.Width; x++)
     {
         for (int y = area.Y; y < area.Y + area.Height; y++)
         {
             image.SetPixelColor(x, y, color);
         }
     }
 }
Пример #3
0
        public EditableBitmap Greyalize()
        {
            EditableBitmap outputImage = new EditableBitmap(_inputImage.Width, _inputImage.Height);

            for (int x = 0; x < _inputImage.Width; x++)
            {
                for (int y = 0; y < _inputImage.Height; y++)
                {
                    GreyalizePixel(x, y, outputImage);
                }
            }
            return(outputImage);
        }
Пример #4
0
        public EditableBitmap Pixelize()
        {
            EditableBitmap myBmp = new EditableBitmap(_inputImage.Width, _inputImage.Height);

            for (int offsetX = 0; offsetX < _inputImage.Width; offsetX += _spacingX)
            {
                for (int offsetY = 0; offsetY < _inputImage.Height; offsetY += _spacingY)
                {
                    Int32Rect area         = DetermineSpacingArea(offsetX, offsetY);
                    Color     averageColor = AverageColor(_inputImage, area);
                    SetColor(myBmp, area, averageColor);
                }
            }
            return(myBmp);
        }
        private void PixelateBTN_Click(object sender, RoutedEventArgs e)
        {
            EditableBitmap bmp = ImageEffects.Pixelize(_images.GetCurrentCopyableBitmap());

            image.Source = bmp.GetBMPSource();
        }
Пример #6
0
        private void BlurPixel(int x, int y, EditableBitmap outputImage)
        {
            Color blurredColor = GetBlurredColor(GetSurroundingColors(x, y, _inputImage));

            outputImage.SetPixelColor(x, y, blurredColor);
        }