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

16
LINES

< > BotCompany Repo | #1006979 // renderShape

JavaX fragment (include)

static BufferedImage renderShape(Color bg default Color.white, Shape shape, int w, int h) {
  BufferedImage img = newBufferedImage(w, h, bg);
  Graphics2D g = img.createGraphics();
  g.setColor(Color.black);
  g.fill(shape);
  ret img;
}

static BufferedImage renderShape(Color bg default Color.white, Shape shape, Rect bounds) {
  BufferedImage img = newBufferedImage(bounds.w, bounds.h, bg);
  Graphics2D g = img.createGraphics();
  g.translate(-bounds.x, -bounds.y);
  g.setColor(Color.black);
  g.fill(shape);
  ret img;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006979
Snippet name: renderShape
Eternal ID of this version: #1006979/5
Text MD5: 4e27b36ec2543d9d426809658be4cc5c
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-28 17:29:20
Source code size: 541 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 565
Version history: 4 change(s)
Referenced in: [show references]