mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:09:31 +02:00
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:
parent
2be94d3c78
commit
32f305d2a8
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user