Libraryless. Click here for Pure Java version (5548L/31K).
// Results for ThinkPad in MPixels/s: // 852 (alpha 0) / 158 (alpha 0x80) / 401 (alpha 0xFF) sclass BenchDrawingImageOnImageWithAlpha { int w = 1000, h = w; long nanos; settable int alphaValue = 0x80; // alpha 0 (draw nothing) and alpha 255 (draw opaque) are faster than other values run { int[] pixels = repIntAsArray(w*h, -1); var img = bufferedImageWithoutAlpha(w, h, pixels); pixels = repIntAsArray(w*h, alphaValue << 24); var img2 = bufferedImageWithAlpha(w, h, pixels); var g = graphics(img); nanos = benchFor5("draw " + nPixels(w*h), -> drawImage(g, img2)); print("Fastest result for alpha " + alphaValue + ": Can draw " + n2(w*h*1000/nanos) + " MPixels/s"); } } svoid benchDrawingImageOnImageWithAlpha() { new BenchDrawingImageOnImageWithAlpha().alphaValue(0).run(); new BenchDrawingImageOnImageWithAlpha().alphaValue(0x80).run(); new BenchDrawingImageOnImageWithAlpha().alphaValue(0xFF).run(); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034533 |
Snippet name: | (b|B)enchDrawingImageOnImageWithAlpha |
Eternal ID of this version: | #1034533/9 |
Text MD5: | 16ab6f41ef4002ec725de08c21474d7b |
Transpilation MD5: | 98c62908a229ff04572ca952607b48be |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-11 14:10:00 |
Source code size: | 978 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 198 / 352 |
Version history: | 8 change(s) |
Referenced in: | [show references] |