Libraryless. Click here for Pure Java version (11223L/64K).
1 | static IBinaryImage scaledIBinaryImage(WidthAndHeight size, IBinaryImage img) { |
2 | ret scaledIBinaryImage(size.w(), size.h(), img); |
3 | } |
4 | |
5 | static IBinaryImage scaledIBinaryImage(int w, int h default widthToHeight(w, img), IBinaryImage img) { |
6 | if (img == null) null; |
7 | int w1 = img.getWidth(), h1 = img.getHeight(); |
8 | if (w == w1 && h == h1) ret img; |
9 | double factorX = doubleRatio(w1, w); |
10 | double factorY = doubleRatio(h1, h); |
11 | ret iBinaryImageFromFunction(w, h, |
12 | (x, y) -> img.getBoolPixel(ifloor(x*factorX), ifloor(y*factorY))); |
13 | } |
Began life as a copy of #1035819
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035824 |
Snippet name: | scaledIBinaryImage (pixelated) |
Eternal ID of this version: | #1035824/3 |
Text MD5: | 432ee2811f8bbc0dd3a82e9751a50035 |
Transpilation MD5: | bc24e2f48d500e62e42751e5426214f6 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-02 21:07:29 |
Source code size: | 545 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 161 / 208 |
Version history: | 2 change(s) |
Referenced in: | [show references] |