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

18
LINES

< > BotCompany Repo | #1007126 - toBufferedImageOpt

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

Libraryless. Compilation Failed (4857L/27K).

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();
  if (o cast File)
    if (isImageFile(o))
      ret loadBufferedImageFile(o);
  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");
    
  if (eq(c, "main$PNGFile"))
    ret (BufferedImage) call(o, "getImage");
  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/8
Text MD5: 3b79e031d9bbd6acc879cdf8c0aacb2f
Transpilation MD5: 5784aa930b45bdc776de8249aa115b8b
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-27 14:32:08
Source code size: 556 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 355 / 394
Version history: 7 change(s)
Referenced in: [show references]