Libraryless. Click here for Pure Java version (5034L/28K).
1 | sclass RecognitionGrid { |
2 | double cellW, cellH; |
3 | int rows, cols; |
4 | Cell[] cells; |
5 | |
6 | *() {} |
7 | *(double *cellW, double *cellH, int w, int h) { |
8 | rows = iceil(w/cellW); |
9 | cols = iceil(h/cellH); |
10 | cells = new Cell[rows*cols]; |
11 | } |
12 | |
13 | sclass Cell { |
14 | int outerColor, middleColor, centerColor; // RGB + alpha |
15 | } |
16 | |
17 | Cell getCell(int col, int row) { |
18 | ret inRange(col, 0, cols) && inRange(row, 0, rows) ? cells[row*cols+col] : null; |
19 | } |
20 | |
21 | Rect cellRect(int col, int row) { |
22 | ret rectFromPoints(iround(col*cellW), iround(row*cellH), |
23 | iround((col+1)*cellW), iround((row+1)*cellH)); |
24 | } |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024314 |
Snippet name: | RecognitionGrid - 3 colors per cell ("outer, middle, center") for visualizing stuff. probably not used anymore |
Eternal ID of this version: | #1024314/7 |
Text MD5: | 31dba946756d32a9793963a4d5ec167b |
Transpilation MD5: | 572dfa132cbc0199deaad1bcc5884469 |
Author: | stefan |
Category: | javax / image recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-15 17:23:28 |
Source code size: | 628 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 290 / 735 |
Version history: | 6 change(s) |
Referenced in: | [show references] |