Libraryless. Click here for Pure Java version (9291L/53K).
1 | static BufferedImage centerImageOnBackground(Color bg, WidthAndHeight size, BufferedImage img) { |
2 | if (img == null) null; |
3 | BufferedImage canvas = newBufferedImage(size, bg); |
4 | drawImageOnImage(img, canvas, |
5 | (size.w()-img.getWidth())/2, |
6 | (size.h()-img.getHeight())/2); |
7 | ret canvas; |
8 | } |
Began life as a copy of #1035292
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035952 |
Snippet name: | centerImageOnBackground |
Eternal ID of this version: | #1035952/4 |
Text MD5: | 6b9b53d23f16758108346e0ec244e9c0 |
Transpilation MD5: | 1be992f8c6e4f6669bb6e8b14cdaaf20 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-17 18:09:58 |
Source code size: | 297 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 130 / 182 |
Version history: | 3 change(s) |
Referenced in: | [show references] |