Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure GetMatrixTPAColors(matrix: T2DIntegerArray; var TPA: TPointArray; var colors: TIntegerArray);
- var
- x, y, z, w, h, l, i: Integer;
- begin
- z := 0;
- h := High(matrix);
- for y := 0 to (h - 1) do
- begin
- w := High(matrix[y]);
- if (w > 0) then
- begin
- l := (z + w);
- SetLength(TPA, l);
- SetLength(colors, l);
- for x := 0 to (w - 1) do
- begin
- i := (z + x);
- TPA[i].X := x;
- TPA[i].Y := y;
- colors[i] := matrix[y][x];
- end;
- z := l;
- end;
- end;
- SetLength(TPA, z);
- SetLength(colors, z);
- end;
- procedure DebugBitmap(bmp: Integer);
- var
- w, h: Integer;
- begin
- GetBitmapSize(bmp, w, h);
- DisplayDebugImgWindow(w, h);
- DrawBitmapDebugImg(bmp);
- end;
- var
- pixels: T2DIntegerArray;
- bmp: Integer;
- TPA: TPointArray;
- color: TIntegerArray;
- begin
- bmp := CreateBitmap(10, 5);
- SetLength(pixels, 5);
- pixels[0] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
- pixels[1] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
- pixels[2] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
- pixels[3] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
- pixels[4] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
- GetMatrixTPAColors(pixels, TPA, color);
- FastSetPixels(bmp, TPA, color);
- DebugBitmap(bmp);
- FreeBitmap(bmp);
- end.
Advertisement
Add Comment
Please, Sign In to add comment