Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function BitmapToMatrix(bmp: Integer): T2DIntegerArray;
- var
- w, h, x, y, i: Integer;
- p: TPointArray;
- c: TIntegerArray;
- begin
- GetBitmapSize(bmp, w, h);
- p := TPAFromBox(IntToBox(0, 0, (w - 1), (h - 1)));
- c := FastGetPixels(bmp, p);
- SetLength(p, 0);
- SetLength(Result, h, w);
- i := 0;
- for y := 0 to (h - 1) do
- for x := 0 to (w - 1) do
- begin
- Result[y][x] := c[i];
- i := (i + 1);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement