1 | static BufferedImage img_getCenterPortion(BufferedImage img, int w, int h) { |
2 | int iw = img.getWidth(), ih = img.getHeight(); |
3 | if (iw < w || ih < h) fail("Too small"); |
4 | int x = (iw-w)/2, y = (ih-h)/2; |
5 | ret clipBufferedImage(img, x, y, w, h); |
6 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007276 |
Snippet name: | img_getCenterPortion |
Eternal ID of this version: | #1007276/1 |
Text MD5: | 821506b279b7ab3e6675c39e8a181a36 |
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 14:57:06 |
Source code size: | 251 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 505 / 554 |
Referenced in: | [show references] |