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

9
LINES

< > BotCompany Repo | #1034967 // pointsToImage - white image with list of points marked black (cropped)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6289L/36K).

static BufferedImage pointsToImage(Iterable<Pt> points) {
  var pointsList = asList(points);
  if (empty(pointsList)) ret whiteImage(1);
  Rect bounds = boundsOfPts(pointsList);
  var img = whiteImage(bounds.w+2, bounds.h+2);
  for ping (p : pointsList)
    setPixel(img, p.x-bounds.x+1, p.y-bounds.y+1, Color.black);
  ret img;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034967
Snippet name: pointsToImage - white image with list of points marked black (cropped)
Eternal ID of this version: #1034967/5
Text MD5: 40ae07fe0efcc01626ce6a8b40c417c8
Transpilation MD5: b923b0464992d06207a7ef18f730496e
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-19 18:02:00
Source code size: 338 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 211
Version history: 4 change(s)
Referenced in: [show references]