Transpiled version (9656L) is out of date.
1 | static BWImage decolorizeImage(Decolorizer decolorizer, BufferedImage image) { |
2 | if (image == null) null; |
3 | var gp = grabbableIntPixels_fastOrSlow(image); |
4 | if (gp == null) null; |
5 | |
6 | var ping = pingSource(); |
7 | int[] pixelsIn = gp.data; |
8 | int w = gp.w, h = gp.h; |
9 | int scanlineExtra = gp.scanlineStride-w; |
10 | int iIn = gp.offset, iOut = 0; |
11 | byte[] pixelsOut = new[w*h]; |
12 | |
13 | for y to h: { |
14 | for x to w: { |
15 | int packed = pixelsIn[iIn++]; |
16 | int brightness = decolorizer.toGrayScale(packed); |
17 | pixelsOut[iOut++] = (byte) brightness; |
18 | } |
19 | |
20 | iIn += scanlineExtra; |
21 | ping?!; |
22 | } |
23 | |
24 | ret BWImage(w, h, pixelsOut); |
25 | } |
26 | |
27 | static BWImage decolorizeImage(BufferedImage image, Decolorizer decolorizer) { |
28 | ret decolorizeImage(decolorizer, image); |
29 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034182 |
Snippet name: | decolorizeImage |
Eternal ID of this version: | #1034182/3 |
Text MD5: | d013e4f2e9a971e52718447140d626c6 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-25 23:04:30 |
Source code size: | 778 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 148 / 226 |
Version history: | 2 change(s) |
Referenced in: | [show references] |