Libraryless. Click here for Pure Java version (94L/1K).
1 | static double scaleToFitInside(BufferedImage image, Component c) { |
2 | ret scaleToFitInside(image, c.getWidth(), c.getHeight()); |
3 | } |
4 | |
5 | static double scaleToFitInside(BufferedImage image, int w, int h default w) { |
6 | int iw = image.getWidth(), ih = image.getHeight(); |
7 | ret min(doubleRatio(h, ih), doubleRatio(w, iw)); |
8 | } |
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: | 148 / 220 |
Version history: | 2 change(s) |
Referenced in: | [show references] |