Libraryless. Click here for Pure Java version (13736L/80K).
1 | srecord noeq RegionToGSI(IPixelSet region) extends Meta { |
2 | Color color; |
3 | gettable GSI gsi; |
4 | |
5 | GSI get() { |
6 | if (region == null) null; |
7 | |
8 | if (region cast IImageRegion) |
9 | gsi.color(region.color()); |
10 | Rect r = region.bounds(); |
11 | int x1 = r.x1(), y1 = r.y1(); |
12 | int y2 = r.y2(), w = r.w, h = y2-y1; |
13 | |
14 | gsi = new GSI; |
15 | gsi.y1 = y1; |
16 | gsi.rowStarts = new int[h]; |
17 | |
18 | new IntBuffer xData; |
19 | |
20 | for (int y = y1; y < y2; y++) { |
21 | reMutable y; |
22 | |
23 | gsi.rowStarts[y-y1] = l(xData); |
24 | |
25 | L<IntRange> streaks = shiftIntRanges(x1, genericStreaks(w, x -> region.contains(x1+x, y))); |
26 | |
27 | xData.addAll(intRangesToIntArray_startAndLength(streaks)); |
28 | } |
29 | |
30 | gsi.xData = xData.toArray(); |
31 | ret gsi; |
32 | } |
33 | } |
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035883 |
Snippet name: | RegionToGSI [dev.] |
Eternal ID of this version: | #1035883/8 |
Text MD5: | 0f2bc8faf885d535b2faf5a9eb095744 |
Transpilation MD5: | 68ae5cb88f7e7decb1aa0ceecc514245 |
Author: | stefan |
Category: | javax / gazelle 22 |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-15 20:39:41 |
Source code size: | 790 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 216 / 313 |
Version history: | 7 change(s) |
Referenced in: | [show references] |