Transpiled version (9246L) is out of date.
1 | static BufferedImage scaleBufferedImageToMaxWidthOrHeight(WidthAndHeight size, BufferedImage img) { |
2 | ret img == null ?: scaleBufferedImageToMaxWidthOrHeight(size.w(), size.h(), img); |
3 | } |
4 | |
5 | static BufferedImage scaleBufferedImageToMaxWidthOrHeight(int maxW, int maxH default maxW, BufferedImage img) { |
6 | if (img == null) null; |
7 | int w = img.getWidth(), h = img.getHeight(); |
8 | if (w <= maxW && h <= maxH) ret img; |
9 | double scale = min(doubleRatio(maxW, w), doubleRatio(maxH, h)); |
10 | ret scaleImage(img, scale); |
11 | } |
12 | |
13 | static BufferedImage scaleBufferedImageToMaxWidthOrHeight(BufferedImage img, int max) { |
14 | ret scaleBufferedImageToMaxWidthOrHeight(max, img); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015057 |
Snippet name: | scaleBufferedImageToMaxWidthOrHeight |
Eternal ID of this version: | #1015057/6 |
Text MD5: | 68495bce051bd30d667bcbf0037a78ed |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-05 16:41:58 |
Source code size: | 668 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 421 / 523 |
Version history: | 5 change(s) |
Referenced in: | [show references] |