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

22
LINES

< > BotCompany Repo | #1006917 - newBufferedImage

JavaX fragment (include)

// undefined color, seems to be all black in practice
static BufferedImage newBufferedImage(int w, int h) {
  ret new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
}

static BufferedImage newBufferedImage(int w, int h, RGB rgb) {
  ret newBufferedImage(w, h, toColor(rgb));
}

static BufferedImage newBufferedImage(int w, int h, Color color) {
  BufferedImage img = newBufferedImage(w, h);
  Graphics2D g = img.createGraphics();
  g.setColor(color);
  g.fillRect(0, 0, w, h);
  ret img;
}

ifclass Pt
static BufferedImage newBufferedImage(Pt p, Color color) {
  ret newBufferedImage(p.x, p.y, color);
}
endif

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006917
Snippet name: newBufferedImage
Eternal ID of this version: #1006917/6
Text MD5: fc6e8d1aa040d831fd7b7fbaed0fd16a
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-22 23:51:47
Source code size: 632 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 350 / 360
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1006917 & http://1006917.tinybrain.de