// public void Rebuild(Imaging.IImageFilterFunc filterFunc, bool normalization = true) { double r = filterFunc.GetRadius(); //--------------- _radius = r; _diameter = AggMath.uceil(r) * 2; _start = -((_diameter / 2) - 1); int size = _diameter << ImgSubPixConst.SHIFT; if (size > _weight_array.Length) { _weight_array = new int[size]; } else if (size < _weight_array.Length) { _weight_array = new int[size]; } //--------------- int i; int pivot = Diameter << (ImgSubPixConst.SHIFT - 1); for (i = 0; i < pivot; i++) { double x = (double)i / (double)ImgSubPixConst.SCALE; double y = filterFunc.CalculateWeight(x); _weight_array[pivot + i] = _weight_array[pivot - i] = AggMath.iround(y * ImgFilterConst.SCALE); } int end = (Diameter << ImgSubPixConst.SHIFT) - 1; _weight_array[0] = _weight_array[end]; if (normalization) { Normalize(); } }
public ImageFilterLookUpTable(Imaging.IImageFilterFunc filterFunc, bool normalization = true) { _weight_array = new int[256]; Rebuild(filterFunc, normalization); }