Libraryless. Click here for Pure Java version (13736L/80K).
srecord noeq RegionToGSI(IPixelSet region) extends Meta { Color color; gettable GSI gsi; GSI get() { if (region == null) null; if (region cast IImageRegion) gsi.color(region.color()); Rect r = region.bounds(); int x1 = r.x1(), y1 = r.y1(); int y2 = r.y2(), w = r.w, h = y2-y1; gsi = new GSI; gsi.y1 = y1; gsi.rowStarts = new int[h]; new IntBuffer xData; for (int y = y1; y < y2; y++) { reMutable y; gsi.rowStarts[y-y1] = l(xData); L<IntRange> streaks = shiftIntRanges(x1, genericStreaks(w, x -> region.contains(x1+x, y))); xData.addAll(intRangesToIntArray_startAndLength(streaks)); } gsi.xData = xData.toArray(); ret gsi; } }
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: | 215 / 312 |
Version history: | 7 change(s) |
Referenced in: | [show references] |