Transpiled version (13275L) is out of date.
srecord noeq CutOutRegionFromImage(IImageRegion region) { settable double alphaNonContained = 0.5; // optional settable BufferedImage fullImage; // grow bounds by this many pixels to include surroundings settable int margin; // optional settable Rect rect; BufferedImage get() { if (region == null) null; fullImage if null = toBufferedImage(region.image()); if (fullImage == null) null; rect = region.bounds(); rect = intersectRects(growRect(rect, margin), imageRect(fullImage)); var clipped = clipBufferedImage(fullImage, rect); int[] pixels = pixelsOfBufferedImage(clipped); int w = rect.w, h = rect.h, i = 0; for y to h: for x to w: { if (!region.contains(rect.x+x, rect.y+y)) pixels[i] = withAlpha(alphaNonContained, pixels[i]); ++i; } ret bufferedImageWithAlpha(w, h, pixels); } }
Began life as a copy of #1035974
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
| Snippet ID: | #1035977 |
| Snippet name: | CutOutRegionFromImage |
| Eternal ID of this version: | #1035977/6 |
| Text MD5: | df5ed334708eba6dff40658abb64a9d7 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-08-20 20:15:01 |
| Source code size: | 922 bytes / 30 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 587 / 733 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |