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


< > BotCompany Repo | #1014942 - drawRect - works on BufferedImage or Graphics2D

JavaX fragment (include)

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

static void drawRect(Graphics2D g, int x, int y, int w, int h, Color color) {
  g.drawRect(x, y, w, h);

static void drawRect(Graphics2D g, Rect r) {
  g.drawRect(r.x, r.y, r.w, r.h);

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

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

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

Author comment

Began life as a copy of #1009141

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: #1014942
Snippet name: drawRect - works on BufferedImage or Graphics2D
Eternal ID of this version: #1014942/3
Text MD5: b64e4152f40ab8e4b113e052f59d6a4e
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-05 06:06:03
Source code size: 778 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 288 / 306
Version history: 2 change(s)
Referenced in: [show references]