Libraryless. Click here for Pure Java version (10614L/61K).
srecord noeq HashBWImage(BWImage img) { long hash; long get() { if (img == null) ret hash; int w = img.getWidth(), h = img.getHeight(); int n = w*h; byte[] pixels = img.pixels; addToHash(w); addToHash(h); for i to n: addToHash(0xFF000000 | rgbIntFromGrayscale(ubyteToInt(pixels[i]))); ret hash; } void addToHash(long x) { hash = boostHashCombine64(hash, x); printVars ifdef HashBWImage_debug(x := longToHex(x), +hash); } }
Began life as a copy of #1034798
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034815 |
Snippet name: | HashBWImage - makes a 64 bit hash of an BWImage (compatible with HashBufferedImage) |
Eternal ID of this version: | #1034815/7 |
Text MD5: | b878e2b6f75e654bd7f9cfbb03000f13 |
Transpilation MD5: | 6289a0d9c3100f31ca6ae4558e9f0cf9 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-10 22:57:47 |
Source code size: | 519 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 195 / 269 |
Version history: | 6 change(s) |
Referenced in: | [show references] |