Libraryless. Click here for Pure Java version (15754L/91K).
1 | srecord noeq G22_RegionToSSI(IImageRegion region) { |
2 | SSI get() { |
3 | if (region == null) null; |
4 | Rect r = region.bounds(); |
5 | int x1 = r.x1(), y1 = r.y1(), y2 = r.y2(), h = y2-y1, w = r.w; |
6 | SSI ssi = new SSI(y1, y2); |
7 | ssi.color(region.color()); |
8 | short[] data = new[h*2]; |
9 | for (int y = y1; y < y2; y++) { |
10 | reMutable y; |
11 | L<IntRange> streaks = genericStreaks(w, x -> region.contains(x1+x, y)); |
12 | IntRange range = selectHorizontalPart(streaks); |
13 | int i = (y-y1)*2; |
14 | data[i] = toShort_enforce(x1+range.start); |
15 | data[i+1] = toShort_enforce(x1+range.end); |
16 | } |
17 | ssi.data(data); |
18 | ret ssi; |
19 | } |
20 | |
21 | swappable IntRange selectHorizontalPart(L<IntRange> parts) { |
22 | ret first(parts); |
23 | } |
24 | } |
Began life as a copy of #1035603
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035605 |
Snippet name: | G22_RegionToSSI - chooses the leftmost scanline (not good) |
Eternal ID of this version: | #1035605/11 |
Text MD5: | 69d7389201c154f9e1e818ffe796164b |
Transpilation MD5: | 2c915fb9f2ceec0b56a10bd508546c85 |
Author: | stefan |
Category: | javax / gazelle 22 |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-06-26 23:14:32 |
Source code size: | 752 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 161 / 257 |
Version history: | 10 change(s) |
Referenced in: | [show references] |