Janilabo

DrawMatrixBitmap

Oct 24th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.94 KB | None | 0 0
  1. procedure DrawMatrixBitmap(bitmap: Integer; matrix: T2DIntegerArray);
  2. var
  3.   x, y, w, h: Integer;
  4. begin
  5.   h := High(matrix);
  6.   for y := 0 to (h - 1) do
  7.   begin
  8.     w := High(matrix[y]);
  9.     for x := 0 to (w - 1) do
  10.       FastSetPixel(bitmap, x, y, matrix[y][x]);
  11.   end;
  12. end;
  13.  
  14. procedure DebugBitmap(bmp: Integer);
  15. var
  16.   w, h: Integer;
  17. begin
  18.   GetBitmapSize(bmp, w, h);
  19.   DisplayDebugImgWindow(w, h);
  20.   DrawBitmapDebugImg(bmp);
  21. end;
  22.  
  23. var
  24.   colors: T2DIntegerArray;
  25.   bmp: Integer;
  26.  
  27. begin
  28.   bmp := CreateBitmap(10, 5);
  29.   SetLength(colors, 5);
  30.   colors[0] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
  31.   colors[1] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
  32.   colors[2] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
  33.   colors[3] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
  34.   colors[4] := [255, 255, 0, 0, 65535, 65535, 0, 0, 255, 255];
  35.   DrawMatrixBitmap(bmp, colors);
  36.   DebugBitmap(bmp);
  37.   FreeBitmap(bmp);
  38. end.
Advertisement
Add Comment
Please, Sign In to add comment