o patch by Ondrej Pokorny: adds a simple box/pixelate interpolation to fcl-image, resolves #32665

git-svn-id: trunk@37622 -
This commit is contained in:
florian 2017-11-26 15:20:41 +00:00
parent 2be94d3c78
commit 32f305d2a8
2 changed files with 21 additions and 0 deletions

View File

@ -191,6 +191,13 @@ type
property Image : TFPCustomImage read fimage;
end;
{ TFPBoxInterpolation }
TFPBoxInterpolation = class(TFPCustomInterpolation)
public
procedure Execute (x,y,w,h:integer); override;
end;
{ TFPBaseInterpolation }
TFPBaseInterpolation = class (TFPCustomInterpolation)

View File

@ -6,6 +6,20 @@ begin
fcanvas := acanvas;
end;
{ TFPBoxInterpolation }
procedure TFPBoxInterpolation.Execute(x,y,w,h:integer);
var
dx, dy, iw, ih: Integer;
begin
iw := Image.Width;
ih := Image.Height;
for dx := 0 to w-1 do
for dy := 0 to h-1 do
Canvas.Colors[x+dx,y+dy] := Image.Colors[dx*iw div w, dy*ih div h];
end;
{ TFPBaseInterpolation }
procedure TFPBaseInterpolation.CreatePixelWeights(OldSize, NewSize: integer;