Libraryless. Click here for Pure Java version (5311L/30K).
static BufferedImage renderableToImage(Renderable r) { if (r == null) null; ret renderableToImage(r.preferredSize(), r); } static BufferedImage renderableToImage(int w, int h, Color backgroundColor default white(), Renderable r) { ret renderableToImage(pt(w, h), backgroundColor, r); } static BufferedImage renderableToImage(Pt size, Color backgroundColor default white(), Renderable r) { var img = newImage(size.x, size.y, backgroundColor); r.renderOn(imageGraphics(img), size.x, size.y); ret img; }
Began life as a copy of #1030558
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033623 |
Snippet name: | renderableToImage |
Eternal ID of this version: | #1033623/5 |
Text MD5: | bbc5dde4233c204bc7cde85d42f36312 |
Transpilation MD5: | a097968c84b24b9e23d0842901154b00 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-01 20:58:57 |
Source code size: | 527 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 170 / 258 |
Version history: | 4 change(s) |
Referenced in: | [show references] |