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

33
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 g, Color color, int x, int y, int w, int h) {
  fillRect(g, x, y, w, h, color);
}

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 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009141
Snippet name: fillRect - works on BufferedImage or Graphics2D
Eternal ID of this version: #1009141/11
Text MD5: 3f5d1af49de62f2a3fa339a6ae2f50cc
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-20 16:57:08
Source code size: 931 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 570 / 625
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1014942 - drawRect - works on BufferedImage or Graphics2D
#1015004 - fillRoundedBox