Libraryless. Click here for Pure Java version (1125L/8K/25K).
1 | !747 |
2 | !image classes |
3 | !FrameWithImages |
4 | |
5 | m { |
6 | static int g = 8; |
7 | static RGBImage img; |
8 | |
9 | !include #1000522 // helper functions |
10 | !include #1000898 // exitOnFrameClose |
11 | |
12 | p { |
13 | img = loadImage("#1000326"); |
14 | int w = img.getWidth(), h = img.getHeight(); |
15 | RGBImage img2 = new RGBImage(img.getWidth(), img.getHeight(), Color.white); |
16 | for (int y = g; y < h-g; y += g) |
17 | for (int x = g; x < w-g; x += g) { |
18 | double d = calcDiffs(x, y); |
19 | paintBlock(img2, new RGB(d), x, y); |
20 | } |
21 | showImage(img2); |
22 | } |
23 | |
24 | static double calcDiffs(int x, int y) { |
25 | RGB col = img.getPixel(x, y); |
26 | return (pixelDiff(img.getPixel(x, y-g), col) |
27 | +pixelDiff(img.getPixel(x-g, y), col) |
28 | +pixelDiff(img.getPixel(x+g, y), col) |
29 | +pixelDiff(img.getPixel(x, y+g), col))/4; |
30 | } |
31 | |
32 | static void paintBlock(RGBImage img, RGB col, int x, int y) { |
33 | for (int yy = 0; yy < g; yy++) |
34 | for (int xx = 0; xx < g; xx++) |
35 | img.setPixel(x+xx, y+yy, col); |
36 | } |
37 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000965 |
Snippet name: | Bla |
Eternal ID of this version: | #1000965/1 |
Text MD5: | 2605eb53db07680f36c812bd2b4e5b9b |
Transpilation MD5: | 7c04c4a50a29fc2001402efc962d3bac |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-10-14 17:25:24 |
Source code size: | 1017 bytes / 37 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 552 / 614 |
Referenced in: | [show references] |