Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Returns all the color points from bitmap as TPointArray.
- Result is based on Row-by-Row.
- [==============================================================================}
- function GetBitmapColorTPA(bmp: Integer; color: Integer): TPointArray;
- var
- w, h, x, y, r: Integer;
- begin
- try
- GetBitmapSize(bmp, w, h);
- except
- end;
- if ((w > 0) and (h > 0)) then
- begin
- SetLength(Result, (w * h));
- for y := 0 to (h - 1) do
- for x := 0 to (w - 1) do
- if (FastGetPixel(bmp, x, y) = color) then
- begin
- Result[r] := Point(x, y);
- Inc(r);
- end;
- end;
- SetLength(Result, r);
- end;
Advertisement
Add Comment
Please, Sign In to add comment