srecord noeq G22_RegionToSSI(IImageRegion region) { SSI get() { if (region == null) null; Rect r = region.bounds(); int x1 = r.x1(), y1 = r.y1(), y2 = r.y2(), h = y2-y1, w = r.w; SSI ssi = new SSI(y1, y2); ssi.color(region.color()); short[] data = new[h*2]; for (int y = y1; y < y2; y++) { reMutable y; L streaks = genericStreaks(w, x -> region.contains(x1+x, y)); IntRange range = selectHorizontalPart(streaks); int i = (y-y1)*2; data[i] = toShort_enforce(x1+range.start); data[i+1] = toShort_enforce(x1+range.end); } ssi.data(data); ret ssi; } swappable IntRange selectHorizontalPart(L parts) { ret first(parts); } }