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

26
LINES

< > BotCompany Repo | #1035743 // G22ThumbnailCache - probably superceded by ScaledGrayscaleCache

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

Transpiled version (12971L) is out of date.

// A = the objects to be cached (each associated with a BWImage
// which is scaled down to the thumbnail size.)
sclass G22ThumbnailCache<A> extends Meta is WidthAndHeight {
  int w, h;
  int bitsPerPixel, bitsPerImage;
  new MultiMap<Long, A> elementsByThumbnail;
  
  *(int *w, int *h, int *bitsPerPixel) {
    bitsPerImage = safeMul(w, h, bitsPerPixel);
    if (bitsPerImage >= 64)
      fail("Too many bits per thumbnail (64 allowed max)", +w, +h, +bitsPerPixel, +bitsPerImage);
  }
  
  public int getWidth() { ret w; }
  public int getHeight() { ret h; }
  
  void add(A element, IBWIntegralImage image) {
    long thumbnail = getThumbnail(image);
    elementsByCacheImage.add(thumbnail, element);
  }
  
  long getThumbnail(IBWIntegralImage image) {
    
    bitsPerImage
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035743
Snippet name: G22ThumbnailCache - probably superceded by ScaledGrayscaleCache
Eternal ID of this version: #1035743/5
Text MD5: 170c2eaf5912e85599f8a55b6d3a18f5
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-21 20:05:13
Source code size: 808 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 65 / 102
Version history: 4 change(s)
Referenced in: [show references]