Libraryless. Click here for Pure Java version (11223L/64K).
static IBinaryImage scaledIBinaryImage(WidthAndHeight size, IBinaryImage img) { ret scaledIBinaryImage(size.w(), size.h(), img); } static IBinaryImage scaledIBinaryImage(int w, int h default widthToHeight(w, img), IBinaryImage img) { if (img == null) null; int w1 = img.getWidth(), h1 = img.getHeight(); if (w == w1 && h == h1) ret img; double factorX = doubleRatio(w1, w); double factorY = doubleRatio(h1, h); ret iBinaryImageFromFunction(w, h, (x, y) -> img.getBoolPixel(ifloor(x*factorX), ifloor(y*factorY))); }
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: | 160 / 207 |
Version history: | 2 change(s) |
Referenced in: | [show references] |