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

29
LINES

< > BotCompany Repo | #1009141 - fillRect - works on BufferedImage or Graphics2D

JavaX fragment (include)

static void fillRect(BufferedImage image, int x, int y, int w, int h, Color color) {
  Graphics2D g = imageGraphics(image);
  fillRect(g, x, y, w, h, color);
  g.dispose();
}

static void fillRect(Graphics/*2D*/ g, int x, int y, int w, int h, Color color) {
  g.setColor(color);
  g.fillRect(x, y, w, h);
}

// draw on currentImage()
static void fillRect(int x, int y, int w, int h, Color color) {
  fillRect(currentImage(), x, y, w, h, color);
}

static void fillRect(Rect r, Color color) {
  fillRect(r.x, r.y, r.w, r.h, color);
}

ifclass Rect
static void fillRect(BufferedImage image, Rect r, Color c) {
  if (r != null) fillRect(image, r.x, r.y, r.w, r.h, c);
}

static void fillRect(Graphics/*2D*/ g, Rect r, Color c) {
  if (r != null) fillRect(g, r.x, r.y, r.w, r.h, c);
}
endif

Author comment

Began life as a copy of #1006920

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009141
Snippet name: fillRect - works on BufferedImage or Graphics2D
Eternal ID of this version: #1009141/10
Text MD5: 20cdb0acd5b13726622b566829ffaf8f
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-27 01:07:24
Source code size: 814 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 412 / 436
Version history: 9 change(s)
Referenced in: [show references]

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