Transpiled version (11449L) is out of date.
// result image is as large as the region's bounds // with black pixels inside and white pixels outside the region srecord noeq RegionToImage2B(IPixelSet region) { settable Rect bounds; Image2B image; run { bounds if null = region.bounds(); int x1 = bounds.x, y1 = bounds.y, w = bounds.w, h = bounds.h, i = 0; byte[] pixels = new[(w*h+7)/8]; for y to h: for x to w: { if (!region.contains(x1+x, y1+y)) pixels[i/8] |= 1 << (i & 7); i++; } image = new Image2B(w, h, pixels); } Image2B get() { if (image == null) run(); ret image; } }
Began life as a copy of #1034574
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035818 |
Snippet name: | RegionToImage2B - also works for IPixelSet |
Eternal ID of this version: | #1035818/5 |
Text MD5: | 6c7672dff4cf985befd3ea47bcbf33b4 |
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:26:55 |
Source code size: | 646 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 134 / 211 |
Version history: | 4 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) #1035822 - iBinaryImageToImage2B |