Libraryless. Click here for Pure Java version (9291L/53K).
static BufferedImage centerImageOnBackground(Color bg, WidthAndHeight size, BufferedImage img) { if (img == null) null; BufferedImage canvas = newBufferedImage(size, bg); drawImageOnImage(img, canvas, (size.w()-img.getWidth())/2, (size.h()-img.getHeight())/2); ret canvas; }
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: | 128 / 179 |
Version history: | 3 change(s) |
Referenced in: | [show references] |