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

19
LINES

< > BotCompany Repo | #1015864 // paintSkyBackground

JavaX fragment (include)

import java.awt.geom.*;

static void paintSkyBackground(Component c, Graphics _g, BufferedImage image) {
  Graphics2D g = cast _g;
  RenderingHints hints = g.getRenderingHints();
  antiAliasOn(g);
  int w = c.getWidth(), h = c.getHeight();
  int iw = image.getWidth(), ih = image.getHeight();
  g.setColor(c.getBackground());
  g.fillRect(0, 0, w, h);
  double imgScale = doubleRatio(w, iw);
  AffineTransform before = g.getTransform();
  double y1 = h-ih*imgScale;
  g.translate(0, y1);
  g.scale(imgScale, imgScale);
  g.drawImage(image, 0, 0, c);
  g.setTransform(before);
  g.setRenderingHints(hints);
}

Author comment

Began life as a copy of #1014537

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: #1015864
Snippet name: paintSkyBackground
Eternal ID of this version: #1015864/6
Text MD5: bfae0ddec819e9d14505514406d9f39f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-29 00:51:31
Source code size: 625 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 382
Version history: 5 change(s)
Referenced in: [show references]