Mercurial > hg > forks > multipaint-js
changeset 87:8dd5146c881f
Indentation cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Jul 2018 00:19:38 +0300 |
parents | 6e5b619861c8 |
children | 03823fa2cb01 |
files | exporters.pde |
diffstat | 1 files changed, 71 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/exporters.pde Thu Jul 05 23:58:43 2018 +0300 +++ b/exporters.pde Fri Jul 06 00:19:38 2018 +0300 @@ -573,33 +573,34 @@ outputter(".byte " + (str(g_map[0])) + " ;border", true); mpWriteByte(int(g_map[0])); checksum = checksum ^ int(g_map[0]); - for (y = 0; y <= 2; y++) { - for (y2 = 0; y2 <= 7; y2++) { - for (yy = 0; yy <= 7; yy++) { - - outputter(".byte ", false); - for (x = 0; x <= 31; x++) { - yp = y * 64 + yy * 8 + y2; - xp = x; - ad = 1024 + yp * 256 + x * 8; - valu = g_map[ad + 0] * 128 + g_map[ad + 1] * 64 + g_map[ad + 2] * 32 + g_map[ad + 3] * 16 + g_map[ad + 4] * 8 + g_map[ad + 5] * 4 + g_map[ad + 6] * 2 + g_map[ad + 7] * 1; - outputter(str(int(valu)), false); - by++; - mpWriteByte(int(valu)); - checksum = checksum ^ int(valu); - if (x <= 30) { - outputter(",", false); - } - } - outputter("", true); + for (y = 0; y <= 2; y++) + for (y2 = 0; y2 <= 7; y2++) + for (yy = 0; yy <= 7; yy++) + { + outputter(".byte ", false); + for (x = 0; x <= 31; x++) + { + yp = y * 64 + yy * 8 + y2; + xp = x; + ad = 1024 + yp * 256 + x * 8; + valu = g_map[ad + 0] * 128 + g_map[ad + 1] * 64 + g_map[ad + 2] * 32 + g_map[ad + 3] * 16 + g_map[ad + 4] * 8 + g_map[ad + 5] * 4 + g_map[ad + 6] * 2 + g_map[ad + 7] * 1; + outputter(str(int(valu)), false); + by++; + mpWriteByte(int(valu)); + checksum = checksum ^ int(valu); + if (x <= 30) { + outputter(",", false); } } + outputter("", true); } outputter("; attributes", true); - for (y = 0; y <= 23; y++) { + for (y = 0; y <= 24; y++) + { outputter(".byte ", false); - for (x = 0; x <= 31; x++) { + for (x = 0; x <= 31; x++) + { ad = 65536 + x + y * 256; valu = int(g_map[ad]); valu2 = int(g_map[ad + MX * MY * 8]); @@ -639,7 +640,9 @@ mpSetDataOffs(16453); outputter(";palette", true); outputter(".byte ", false); - for (int i = 0; i < g_maxcolors; i++) { //fixed # of palette entries, just trying to be generic + //fixed # of palette entries, just trying to be generic + for (int i = 0; i < g_maxcolors; i++) + { val1 = int(g_g[i] / (256 / g_palsteps)); val2 = int(g_r[i] / (256 / g_palsteps)); val3 = int(g_b[i] / (256 / g_palsteps)); @@ -986,62 +989,61 @@ psteps = int(g_palsteps - 1); maxhis = 0; palls = int(255 / psteps); - for (cy = 0; cy < MY * erkki; cy++) { - for (cx = 0; cx < MX; cx++) { - for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) { - for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) { - x2 = int(ww / X) * xx; - y2 = int(hh / Y) * yy; - rr = 0; - gg = 0; - bb = 0; - avg = 0; + + for (cy = 0; cy < MY * erkki; cy++) + for (cx = 0; cx < MX; cx++) + for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) + for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) + { + x2 = int(ww / X) * xx; + y2 = int(hh / Y) * yy; + rr = 0; + gg = 0; + bb = 0; + avg = 0; - for (avy = 0; avy < baly; avy++) { - for (avx = 0; avx < balx; avx++) { - c = image.get(x2 + avx, y2 + avy); - rr = rr + int(red(c)); - gg = gg + int(green(c)); - bb = bb + int(blue(c)); - avg++; - } - } - rh = rr / (avg); - gh = gg / (avg); - bh = bb / (avg); - rh = int(rh) / palls; - gh = int(gh) / palls; - bh = int(bh) / palls; - histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]++; - if (histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)] > maxhis) { - maxhis = histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]; - } - } - } + for (avy = 0; avy < baly; avy++) + for (avx = 0; avx < balx; avx++) + { + c = image.get(x2 + avx, y2 + avy); + rr = rr + int(red(c)); + gg = gg + int(green(c)); + bb = bb + int(blue(c)); + avg++; + } + + rh = rr / (avg); + gh = gg / (avg); + bh = bb / (avg); + rh = int(rh) / palls; + gh = int(gh) / palls; + bh = int(bh) / palls; + histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]++; + if (histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)] > maxhis) { + maxhis = histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]; } } int step; step = 0; - for (j = maxhis; j > 0; j--) { - for (i = 0; i <= 4096; i++) { - if (histog[i] == j) { - rh = i / int(g_palsteps * g_palsteps); - gh = i - int(rh * (g_palsteps * g_palsteps)); - gh = gh / int(g_palsteps); - bh = i - int(rh * (g_palsteps * g_palsteps)); - bh = bh - int(gh * g_palsteps); - rh = rh * int(palls); - gh = gh * int(palls); - bh = bh * int(palls); - if (step < g_maxcolors) { - makecolor(step, rh, gh, bh); - step++; - } + for (j = maxhis; j > 0; j--) + for (i = 0; i <= 4096; i++) + { + if (histog[i] == j) { + rh = i / int(g_palsteps * g_palsteps); + gh = i - int(rh * (g_palsteps * g_palsteps)); + gh = gh / int(g_palsteps); + bh = i - int(rh * (g_palsteps * g_palsteps)); + bh = bh - int(gh * g_palsteps); + rh = rh * int(palls); + gh = gh * int(palls); + bh = bh * int(palls); + if (step < g_maxcolors) { + makecolor(step, rh, gh, bh); + step++; } } } - } for (cy = 0; cy < MY * erkki; cy++) {