Libraryless. Click here for Pure Java version (85L/1K).
1 | static BufferedImage img_addBorder(BufferedImage img, Color color, int border) {
|
2 | int top = border, bottom = border, left = border, right = border; |
3 | int w = img.getWidth(), h = img.getHeight(); |
4 | BufferedImage img2 = createBufferedImage(left+w+right, top+h+bottom, color); |
5 | Graphics2D g = img2.createGraphics(); |
6 | g.drawImage(img, left, top, null); |
7 | g.dispose(); |
8 | ret img2; |
9 | } |
Began life as a copy of #1007135
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007278 |
| Snippet name: | img_addBorder |
| Eternal ID of this version: | #1007278/2 |
| Text MD5: | 2ff71898326cf70c40aebe89e6b5c30f |
| Transpilation MD5: | b43969dc785ae1d532785aba5e87ab25 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-03-14 15:02:55 |
| Source code size: | 388 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 780 / 894 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |