Libraryless. Click here for Pure Java version (94L/1K).
static double scaleToFitInside(BufferedImage image, Component c) { ret scaleToFitInside(image, c.getWidth(), c.getHeight()); } static double scaleToFitInside(BufferedImage image, int w, int h default w) { int iw = image.getWidth(), ih = image.getHeight(); ret min(doubleRatio(h, ih), doubleRatio(w, iw)); }
Began life as a copy of #1034223
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034404 |
| Snippet name: | scaleToFitInside |
| Eternal ID of this version: | #1034404/3 |
| Text MD5: | 3930c23f1badbba5ac1de4eb8bb9d4b3 |
| Transpilation MD5: | 1cc9a6d0b4591bffb3e5eaf08107e17f |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-07-17 23:09:49 |
| Source code size: | 320 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 368 / 486 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |