Transpiled version (2874L) is out of date.
1 | static GrabbableIntPixels grabbableIntPixels_ComponentSampleModel(BufferedImage img) { |
2 | if (img == null) null; |
3 | |
4 | Raster raster = img.getRaster(); |
5 | ComponentSampleModel sampleModel = cast raster.getSampleModel(); |
6 | DataBufferByte dataBuffer = cast raster.getDataBuffer(); |
7 | assertEquals(1, dataBuffer.getNumBanks()); |
8 | assertEquals(DataBuffer.TYPE_INT, dataBuffer.getDataType()); |
9 | |
10 | // Let's at this point assume the raster data is what we |
11 | // think it is... (TODO: test on unusual platforms) |
12 | |
13 | int w = img.getWidth(), h = img.getHeight(); |
14 | int scanlineStride = sampleModel.getScanlineStride(); |
15 | int[] pixels = dataBuffer.getData(); |
16 | int offset = dataBuffer.getOffset(); |
17 | int translateX = raster.getSampleModelTranslateX(); |
18 | int translateY = raster.getSampleModelTranslateY(); |
19 | offset += -translateX-translateY*scanlineStride; |
20 | ret GrabbableIntPixels(pixels, w, h, offset, scanlineStride); |
21 | } |
Began life as a copy of #1030544
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030563 |
Snippet name: | grabbableIntPixels_ComponentSampleModel - try to rip int[] pixels from a BufferedImage without copying [dev.] |
Eternal ID of this version: | #1030563/3 |
Text MD5: | 4e3c9c642748c31c177d093b86fd3e0e |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-07 19:11:53 |
Source code size: | 926 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 162 / 242 |
Version history: | 2 change(s) |
Referenced in: | [show references] |