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

17
LINES

< > BotCompany Repo | #1033307 // grabbableIntPixels_fastOrSlow

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

Libraryless. Click here for Pure Java version (9343L/52K).

static GrabbableIntPixels grabbableIntPixels_fastOrSlow(BufferedImage image) ctex {
  pcall {
    GrabbableIntPixels gp = grabbableIntPixels(image);
    if (gp != null) ret gp;
  }
    
  // TODO: use GrabbableRGBBytePixels and convert manually
  // - should be way faster than PixelGrabber
  
  int w = image.getWidth(), h = image.getHeight();
  int[] data = new[w*h];
  PixelGrabber pixelGrabber = new(image, 0, 0, w, h, data, 0, w);
  if (!pixelGrabber.grabPixels())
    fail("Could not grab pixels");
      
  ret GrabbableIntPixels(data, w, h, 0, w);
}

Author comment

Began life as a copy of #1030544

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033307
Snippet name: grabbableIntPixels_fastOrSlow
Eternal ID of this version: #1033307/6
Text MD5: 44a512397bcf910e778548ed17272667
Transpilation MD5: 027890dd222aebbe54a0452c25416a73
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-07 21:13:29
Source code size: 573 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 285
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1033437 - grabbableBytePixels_fastOrSlow
#1035897 - grabbableRGBBytePixels_fastOrSlow [doesn't work, use grabbableIntPixels_fastOrSlow instead]