marpis
2011-01-09 14:00:16
How do I use GetPixel with Lazarus? I want to have this function in a plugin:
And I really want the bmp parameter to be an integer, so I can first call
CopyClientCanvas()
in Simba and input that bitmap into the function above.
function G_MakeColorBoxEx(bmp, x1, y1: integer): Array of Integer; //[0]=Red [1]=Green [2]=Blue
var
x, y: integer;
R, G, B: integer;
begin
SetLength(Result, 3);
for x := x1 to (x1 + 4) do
for y := y1 to (y1 + 4) do
begin
try
ColorToRGB(FastGetPixel(bmp, x, y), R, G, B); // <--- How is this done in a plugin?
Result[0] := Result[0] + R;
Result[1] := Result[1] + G;
Result[2] := Result[2] + B;
except
//writeln('ColorToRGB exception: '+inttostr(x)+', '+inttostr(y));
end;
end;
end; And I really want the bmp parameter to be an integer, so I can first call
CopyClientCanvas()
in Simba and input that bitmap into the function above.