Libraryless. Click here for Pure Java version (9242L/51K).
svoid drawScaledPixelatedImage(Graphics2D etc g, BufferedImage img, Rect r) { if (g == null || img == null || r == null) ret; g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); double scaleX = doubleRatio(r.w, img.getWidth()); double scaleY = doubleRatio(r.h, img.getHeight()); //print("drawScaledPixelatedImage: " + r + " " + scaleX + "/" + scaleY); g.translate(r.x, r.y); g.scale(scaleX, scaleY); g.drawImage(img, 0, 0, null); }
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1019542 |
| Snippet name: | drawScaledPixelatedImage |
| Eternal ID of this version: | #1019542/7 |
| Text MD5: | 137b3c4fce88cc3881f37c69214761f2 |
| Transpilation MD5: | 849d692f245b6cc00eecd4969406b3ba |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-09-05 03:04:16 |
| Source code size: | 511 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 513 / 658 |
| Version history: | 6 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031217 - drawScaledImage |