Libraryless. Click here for Pure Java version (5311L/30K).
1 | static BufferedImage renderableToImage(Renderable r) { |
2 | if (r == null) null; |
3 | ret renderableToImage(r.preferredSize(), r); |
4 | } |
5 | |
6 | static BufferedImage renderableToImage(int w, int h, Color backgroundColor default white(), Renderable r) { |
7 | ret renderableToImage(pt(w, h), backgroundColor, r); |
8 | } |
9 | |
10 | static BufferedImage renderableToImage(Pt size, Color backgroundColor default white(), Renderable r) { |
11 | var img = newImage(size.x, size.y, backgroundColor); |
12 | r.renderOn(imageGraphics(img), size.x, size.y); |
13 | ret img; |
14 | } |
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: | 171 / 261 |
Version history: | 4 change(s) |
Referenced in: | [show references] |