Libraryless. Click here for Pure Java version (3889L/22K).
1 | static Matrix<Int> rgbaWithSizeToIntMatrix(L<Int> data) { |
2 | if (l(data) < 2) null; |
3 | int _w = data.get(0); |
4 | int _h = data.get(1); |
5 | if (l(data)-2 < _w*_h) null; |
6 | |
7 | class RGAWithSizeMatrix extends AbstractMatrix<Int> { |
8 | *() { super(_w, _h); } |
9 | |
10 | int xyToIndex(int x, int y) { |
11 | ret 2+y*w+x; |
12 | } |
13 | |
14 | public Int get(int x, int y) { ret data.get(xyToIndex(x, y)); } |
15 | public void set(int x, int y, Int a) { data.set(xyToIndex(x, y), a); } |
16 | }; |
17 | |
18 | ret new RGAWithSizeMatrix; |
19 | } |
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: | 189 / 270 |
Version history: | 5 change(s) |
Referenced in: | [show references] |