Libraryless. Click here for Pure Java version (3889L/22K).
static Matrix<Int> rgbaWithSizeToIntMatrix(L<Int> data) { if (l(data) < 2) null; int _w = data.get(0); int _h = data.get(1); if (l(data)-2 < _w*_h) null; class RGAWithSizeMatrix extends AbstractMatrix<Int> { *() { super(_w, _h); } int xyToIndex(int x, int y) { ret 2+y*w+x; } public Int get(int x, int y) { ret data.get(xyToIndex(x, y)); } public void set(int x, int y, Int a) { data.set(xyToIndex(x, y), a); } }; ret new RGAWithSizeMatrix; }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033120 |
Snippet name: | rgbaWithSizeToIntMatrix |
Eternal ID of this version: | #1033120/6 |
Text MD5: | db6496b5d2538520e59dfff17d455fd1 |
Transpilation MD5: | 51eaa3bdb5cddd453654c2eb90b00cba |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-15 16:52:07 |
Source code size: | 514 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 190 / 271 |
Version history: | 5 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1033125 - matrixToMNGrid #1033127 - listOfListsToMatrix #1033239 - listToMatrix |