Transpiled version (13072L) is out of date.
// from: https://stackoverflow.com/questions/14416107/int-array-to-bufferedimage // pixels are RGB pixels static BufferedImageWithMeta intArrayToBufferedImage(int[] pixels, int w, int h default pixels.length/w) { if (w == 0 || h == 0) null; int[] bitMasks = new int[]{0xFF0000, 0xFF00, 0xFF, 0xFF000000}; SinglePixelPackedSampleModel sm = new(DataBuffer.TYPE_INT, w, h, bitMasks); DataBufferInt db = new DataBufferInt(pixels, pixels.length); WritableRaster wr = Raster.createWritableRaster(sm, db, new Point); ret new BufferedImageWithMeta(ColorModel.getRGBdefault(), wr, false, null); } static BufferedImageWithMeta intArrayToBufferedImage(int w, int... pixels) { ret intArrayToBufferedImage(pixels, w); }
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj
No comments. add comment
Snippet ID: | #1025281 |
Snippet name: | intArrayToBufferedImage - note: with alpha and meta |
Eternal ID of this version: | #1025281/12 |
Text MD5: | 901b190ad648e1d181c99041cb257962 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-12 07:01:43 |
Source code size: | 738 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 309 / 478 |
Version history: | 11 change(s) |
Referenced in: | [show references] |