示例#1
0
        private unsafe void ApplySepiaToPixel(byte *blue, double factor)
        {
            int tone = RgbComponentOperations.ComputeSepiaTone(*blue, *(blue + (byte)Argb.green), *(blue + (byte)Argb.red));

            *blue = RgbComponentOperations.ComputeSepiaBlue(tone);
            *(blue + (byte)Argb.green) = RgbComponentOperations.ComputeSepiaGreen(tone);
            *(blue + (byte)Argb.red)   = RgbComponentOperations.ComputeSepiaRed(tone);
        }
示例#2
0
 private unsafe void ApplyInversionToPixel(byte *blue, double factor)
 {
     for (Argb i = Argb.blue; i <= Argb.red; ++i)
     {
         byte componentValue = *(blue + (byte)i);
         *(blue + (byte)i) = RgbComponentOperations.Invert(componentValue, (int)factor);
     }
 }
示例#3
0
 private unsafe void ApplyGammaCorrectionToPixel(byte *blue, double factor)
 {
     for (Argb i = Argb.blue; i <= Argb.red; ++i)
     {
         byte componentValue = *(blue + (byte)i);
         *(blue + (byte)i) = RgbComponentOperations.Gamma(componentValue, factor);
     }
 }
示例#4
0
 private unsafe void ApplyExposureCompensationToPixel(byte *blue, double factor)
 {
     for (Argb i = Argb.blue; i <= Argb.red; ++i)
     {
         byte componentValue = *(blue + (byte)i);
         *(blue + (byte)i) = RgbComponentOperations.Exposure(componentValue, factor);
     }
 }
示例#5
0
 private unsafe void ApplyBrightnessToPixel(byte *blue, double factor)
 {
     for (Argb i = Argb.blue; i <= Argb.red; ++i)
     {
         byte componentValue = *(blue + (byte)i);
         *(blue + (byte)i) = RgbComponentOperations.ChangeBrightness(componentValue, factor);
     }
 }
示例#6
0
        private byte ApplyBlur(byte[] neighborhood)
        {
            int sum = 0;

            for (int i = 0; i < neighborhoodSize; ++i)
            {
                sum += neighborhood[i];
            }

            return(RgbComponentOperations.ControlOverflow(sum / neighborhoodSize));
        }
示例#7
0
        protected override byte ComputeNewRgbComponentValue(byte[] neighborhood)
        {
            double sum = 0;

            for (int i = 0; i < neighborhood.Length; ++i)
            {
                sum += neighborhood[i] * kernel[i];
            }

            sum *= factor;

            return(RgbComponentOperations.ControlOverflow(sum));
        }
示例#8
0
        private unsafe void ApplyBrightnessToPixelBlue(byte *blue, double factor)
        {
            byte componentValue = *blue;

            *blue = RgbComponentOperations.ChangeBrightness(componentValue, factor);
        }
示例#9
0
        private unsafe void ApplyBrightnessToPixelGreen(byte *blue, double factor)
        {
            byte componentValue = *(blue + (byte)Argb.green);

            *(blue + (byte)Argb.green) = RgbComponentOperations.ChangeBrightness(componentValue, factor);
        }
示例#10
0
 private unsafe void ApplyBlackAndWhiteToPixel(byte *blue, double factor)
 {
     *blue = *(blue + (byte)Argb.green) = *(blue + (byte)Argb.red) =
         RgbComponentOperations.BlackAndWhite(*blue, *(blue + (byte)Argb.green), *(blue + (byte)Argb.red));
 }
示例#11
0
 private unsafe void ApplyThresholdToPixel(byte *blue, double factor)
 {
     *blue = *(blue + (byte)Argb.green) = *(blue + (byte)Argb.red) =
         RgbComponentOperations.Threshold(*blue, *(blue + (byte)Argb.green), *(blue + (byte)Argb.red), (byte)factor);
 }