Janilabo

Untitled

Aug 31st, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.74 KB | None | 0 0
  1. {==============================================================================]
  2.   Explanation: Returns all the color points from bitmap as TPointArray.
  3.                Result is based on Row-by-Row.
  4. [==============================================================================}
  5. function GetBitmapColorTPA(bmp: Integer; color: Integer): TPointArray;
  6. var
  7.   w, h, x, y, r: Integer;
  8. begin
  9.   try
  10.     GetBitmapSize(bmp, w, h);
  11.   except
  12.   end;
  13.   if ((w > 0) and (h > 0)) then
  14.   begin
  15.     SetLength(Result, (w * h));
  16.     for y := 0 to (h - 1) do
  17.       for x := 0 to (w - 1) do
  18.         if (FastGetPixel(bmp, x, y) = color) then
  19.         begin
  20.           Result[r] := Point(x, y);
  21.           Inc(r);
  22.         end;
  23.   end;
  24.   SetLength(Result, r);
  25. end;
Advertisement
Add Comment
Please, Sign In to add comment