Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1034813 // bwImagesIdentical

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (8153L/46K).

sbool bwImagesIdentical(BWImage img1, BWImage img2) {
  if (img1 == img2) true;
  if (img1 == null) ret img2 == null;
  if (img2 == null) false;
  
  int w = img1.getWidth(), h = img1.getHeight();
  if (w != img2.getWidth() || h != img2.getHeight()) false;
  
  byte[] pixels1 = img1.pixels, pixels2 = img2.pixels;
  ret Arrays.equals(pixels1, pixels2);
}

Author comment

Began life as a copy of #1015234

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034813
Snippet name: bwImagesIdentical
Eternal ID of this version: #1034813/1
Text MD5: 8019f39a2fabd6bcaf10c29412ccbb5d
Transpilation MD5: b1a2fdacff6325246b01b7fb9cad52e8
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:25:30
Source code size: 365 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 169 / 227
Referenced in: [show references]