Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1034223 // calcFitScale

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (120L) is out of date.

static double calcFitScale(BufferedImage image, Component c) {
  ret calcFitScale(image, c.getWidth(), c.getHeight());
}

static double calcFitScale(BufferedImage image, int w, int h default w) {
  int iw = image.getWidth(), ih = image.getHeight();
  ret max(doubleRatio(h, ih), doubleRatio(w, iw));
}

Author comment

Began life as a copy of #1019468

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034223
Snippet name: calcFitScale
Eternal ID of this version: #1034223/4
Text MD5: fd3820063d5c14c890df2dc318fb34d6
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-29 03:03:34
Source code size: 308 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 141 / 211
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1034404 - scaleToFitInside