|
@@ -118,14 +118,14 @@ begin
|
|
|
Factor:=double(OldSize-1)/double(NewSize);
|
|
Factor:=double(OldSize-1)/double(NewSize);
|
|
|
for i:=0 to NewSize-1 do
|
|
for i:=0 to NewSize-1 do
|
|
|
begin
|
|
begin
|
|
|
- StartPos:=Factor*i+Factor/2;
|
|
|
|
|
|
|
+ StartPos:=Factor*(i+0.5);
|
|
|
StartIndex:=Floor(StartPos);
|
|
StartIndex:=Floor(StartPos);
|
|
|
PInteger(Entry)^:=StartIndex;
|
|
PInteger(Entry)^:=StartIndex;
|
|
|
inc(Entry,SizeOf(Integer));
|
|
inc(Entry,SizeOf(Integer));
|
|
|
// first pixel
|
|
// first pixel
|
|
|
- FirstValue:=(1.0-(StartPos-double(StartIndex)));
|
|
|
|
|
|
|
+ FirstValue := StartPos-double(StartIndex);
|
|
|
// convert linear distribution
|
|
// convert linear distribution
|
|
|
- FirstValue:=Min(1.0,Max(0.0,Filter(FirstValue/MaxSupport)));
|
|
|
|
|
|
|
+ FirstValue:=Min(1.0,Max(0.0,Filter(FirstValue)));
|
|
|
PSingle(Entry)^:=FirstValue;
|
|
PSingle(Entry)^:=FirstValue;
|
|
|
inc(Entry,SizeOf(Single));
|
|
inc(Entry,SizeOf(Single));
|
|
|
// last pixel
|
|
// last pixel
|
|
@@ -247,7 +247,7 @@ end;
|
|
|
|
|
|
|
|
function TFPBaseInterpolation.Filter(x: double): double;
|
|
function TFPBaseInterpolation.Filter(x: double): double;
|
|
|
begin
|
|
begin
|
|
|
- Result:=x;
|
|
|
|
|
|
|
+ Result := 1.0 - x;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
function TFPBaseInterpolation.MaxSupport: double;
|
|
function TFPBaseInterpolation.MaxSupport: double;
|
|
@@ -255,9 +255,9 @@ begin
|
|
|
Result:=1.0;
|
|
Result:=1.0;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-{ TMitchelInterpolation }
|
|
|
|
|
|
|
+{ TMitchellInterpolation }
|
|
|
|
|
|
|
|
-function TMitchelInterpolation.Filter(x: double): double;
|
|
|
|
|
|
|
+function TMitchellInterpolation.Filter(x: double): double;
|
|
|
const
|
|
const
|
|
|
B = (1.0/3.0);
|
|
B = (1.0/3.0);
|
|
|
C = (1.0/3.0);
|
|
C = (1.0/3.0);
|
|
@@ -283,7 +283,7 @@ begin
|
|
|
result := 0.0;
|
|
result := 0.0;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-function TMitchelInterpolation.MaxSupport: double;
|
|
|
|
|
|
|
+function TMitchellInterpolation.MaxSupport: double;
|
|
|
begin
|
|
begin
|
|
|
result := 2.0;
|
|
result := 2.0;
|
|
|
end;
|
|
end;
|