Libraryless. Click here for Pure Java version (6326L/37K).
static BufferedImage toBufferedImageOpt(O o) { if (o cast BufferedImage) ret o; if (o cast Image) ret copyImage(o); if (o cast MakesBufferedImage) ret o.getBufferedImage(); ifdef toBufferedImageOpt_acceptFile if (o cast File) if (isImageFile(o)) ret loadBufferedImageFile(o); endifdef S c = getClassName(o); // Keep this because it also works on imported objects if (eqOneOf(c, "main$BWImage", "main$RGBImage")) ret (BufferedImage) call(o, "getBufferedImage"); ifdef PNGFile // Who uses this anymore? if (eq(c, "main$PNGFile")) ret (BufferedImage) call(o, "getImage"); endifdef ret null; }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007126 |
Snippet name: | toBufferedImageOpt |
Eternal ID of this version: | #1007126/11 |
Text MD5: | f7a8619c771fa5f72a346feb3196aa22 |
Transpilation MD5: | 291fc0e0e26715e5b8c01fa00a3f8412 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-13 02:51:04 |
Source code size: | 684 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 548 / 670 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1007288 - asBufferedImage |