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

107
LINES

< > BotCompany Repo | #1001346 // showImage

JavaX fragment (include)

1  
static S showImage_defaultIcon = "#1004230"; // "#1004227";
2  
3  
static ImageSurface showImage(S snippetIDOrURL, S title) {
4  
  return showImage(loadImage(snippetIDOrURL), title);
5  
}
6  
7  
static ImageSurface showImage(S title, BufferedImage img) {
8  
  ret showImage(img, title);
9  
}
10  
11  
static ImageSurface showImage(final BufferedImage img, fS title) {
12  
  ret (ImageSurface) swing(func {
13  
    ImageSurface is = showImage(img);
14  
    getFrame(is).setTitle(title);
15  
    return is;
16  
  });
17  
}
18  
19  
static ImageSurface showImage(final BufferedImage img) {
20  
  ret (ImageSurface) swing(func {
21  
    ImageSurface is = new ImageSurface(img);
22  
    JFrame frame = showPackedFrame(new JScrollPane(is));
23  
    moveToTopRightCorner(frame);
24  
    frameIcon(frame, showImage_defaultIcon);
25  
    return is;
26  
  });
27  
}
28  
29  
static ImageSurface showImage(S imageID) {
30  
  return showImage(loadImage2(imageID));
31  
}
32  
33  
static ImageSurface showImage(ImageSurface surface, BufferedImage img) {
34  
  ret showImage(img, surface);
35  
}
36  
37  
static ImageSurface showImage(ImageSurface surface, S title, BufferedImage img) {
38  
  ret showImage(surface, img, title);
39  
}
40  
41  
static ImageSurface showImage(ImageSurface surface, BufferedImage img, S title) {
42  
  ret setFrameTitle(showImage(img, surface), title);
43  
}
44  
45  
static ImageSurface showImage(BufferedImage img, ImageSurface surface) {
46  
  if (surface == null)
47  
    ret showImage(img);
48  
  else {
49  
    surface.setImage(img);
50  
    ret surface;
51  
  }
52  
}
53  
54  
ifclass MakesBufferedImage
55  
  static ImageSurface showImage(S title, MakesBufferedImage img) {
56  
    return showImage(title, img.getBufferedImage());
57  
  }
58  
  
59  
  static ImageSurface showImage(ImageSurface is, MakesBufferedImage img) {
60  
    return showImage(is, img.getBufferedImage());
61  
  }
62  
  
63  
  static ImageSurface showImage(RGBImage img) {
64  
    return showImage(img.getBufferedImage());
65  
  }
66  
  
67  
  static ImageSurface showImage(RGBImage img, S title) {
68  
    ImageSurface is = showImage(img.getBufferedImage());
69  
    getFrame(is).setTitle(title);
70  
    return is;
71  
  }
72  
  
73  
  static ImageSurface showImage(ImageSurface surface, RGBImage img) {
74  
    ret showImage(img, surface);
75  
  }
76  
  
77  
  static ImageSurface showImage(RGBImage img, ImageSurface surface) {
78  
    if (surface == null)
79  
      ret showImage(img);
80  
    else {
81  
      surface.setImage(img);
82  
      ret surface;
83  
    }
84  
  }
85  
  
86  
  static ImageSurface showImage(ImageSurface surface, S title, RGBImage img) {
87  
    ret showImage(surface, img, title);
88  
  }
89  
  
90  
  static ImageSurface showImage(ImageSurface surface, RGBImage img, S title) {
91  
    ret setFrameTitle(showImage(img, surface), title);
92  
  }
93  
endif
94  
95  
ifclass MakesBufferedImage
96  
  static ImageSurface showImage(MakesBufferedImage img) {
97  
    return showImage(img.getBufferedImage());
98  
  }
99  
endif
100  
101  
static ImageSurface showImage() {
102  
  ret showImage(currentImage());
103  
}
104  
105  
static ImageSurface showImage(File f) {
106  
  ret showImage(f2s(f), loadImage2(f)).setFile(f);
107  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, ofpaelxlmzfo, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001346
Snippet name: showImage
Eternal ID of this version: #1001346/19
Text MD5: 81dfd137d82dd375ad04248dfc7a5bd3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-26 18:29:34
Source code size: 2937 bytes / 107 lines
Pitched / IR pitched: No / No
Views / Downloads: 1282 / 1652
Version history: 18 change(s)
Referenced in: [show references]