Libraryless. Click here for Pure Java version (58L/1K).
1 | sclass CachedPosterizer is IPosterizer {
|
2 | IPosterizer posterizer; |
3 | int[] cache; |
4 | |
5 | *(IPosterizer *posterizer) {
|
6 | makeCache(); |
7 | } |
8 | |
9 | // 0..255 to 0..255 |
10 | public int get(int brightness) {
|
11 | ret cache[brightness]; |
12 | } |
13 | |
14 | void makeCache {
|
15 | cache = new int[256]; |
16 | for brightness to 256: |
17 | cache[brightness] = posterizer.get(brightness); |
18 | } |
19 | } |
Began life as a copy of #1034808
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035736 |
| Snippet name: | CachedPosterizer |
| Eternal ID of this version: | #1035736/4 |
| Text MD5: | aad366c946c8c96d04f1e2d8a9410f06 |
| Transpilation MD5: | 2bcb3b49f9db3adb8943dee31c7d0cac |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-07-17 21:17:08 |
| Source code size: | 378 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 563 / 676 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |