public HSLFiltering() { this.hue = new Range(0, 0x167); this.saturation = new RangeD(0.0, 1.0); this.luminance = new RangeD(0.0, 1.0); this.fillOutsideRange = true; this.updateH = true; this.updateS = true; this.updateL = true; }
public HistogramD(int[] values, RangeD range) { int num; int num2; this.values = values; this.range = range; int length = values.Length; int num4 = length - 1; double num5 = range.Max - range.Min; this.max = 0.0; this.min = length; for (num2 = 0; num2 < length; num2++) { num = values[num2]; if (num != 0) { if (num2 > this.max) { this.max = num2; } if (num2 < this.min) { this.min = num2; } } this.total += num; this.mean += (((((double)num2) / ((double)num4)) * num5) + range.Min) * num; } this.mean /= (double)this.total; this.min = ((this.min / ((double)num4)) * num5) + range.Min; this.max = ((this.max / ((double)num4)) * num5) + range.Min; for (num2 = 0; num2 < length; num2++) { num = values[num2]; this.stdDev += Math.Pow((((((double)num2) / ((double)num4)) * num5) + range.Min) - this.mean, 2.0) * num; } this.stdDev = Math.Sqrt(this.stdDev / ((double)this.total)); int num7 = this.total / 2; int index = 0; num = 0; while (this.median < length) { num += values[index]; if (num >= num7) { break; } index++; } this.median = ((((double)index) / ((double)num4)) * num5) + range.Min; }