Transpiled version (12971L) is out of date.
1 | // A = the objects to be cached (each associated with a BWImage |
2 | // which is scaled down to the thumbnail size.) |
3 | sclass G22ThumbnailCache<A> extends Meta is WidthAndHeight { |
4 | int w, h; |
5 | int bitsPerPixel, bitsPerImage; |
6 | new MultiMap<Long, A> elementsByThumbnail; |
7 | |
8 | *(int *w, int *h, int *bitsPerPixel) { |
9 | bitsPerImage = safeMul(w, h, bitsPerPixel); |
10 | if (bitsPerImage >= 64) |
11 | fail("Too many bits per thumbnail (64 allowed max)", +w, +h, +bitsPerPixel, +bitsPerImage); |
12 | } |
13 | |
14 | public int getWidth() { ret w; } |
15 | public int getHeight() { ret h; } |
16 | |
17 | void add(A element, IBWIntegralImage image) { |
18 | long thumbnail = getThumbnail(image); |
19 | elementsByCacheImage.add(thumbnail, element); |
20 | } |
21 | |
22 | long getThumbnail(IBWIntegralImage image) { |
23 | |
24 | bitsPerImage |
25 | } |
26 | } |
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: | 134 / 192 |
Version history: | 4 change(s) |
Referenced in: | [show references] |