Mercurial > hg > forks > multipaint-js
changeset 160:546146bc2247
More changes integrated from v1.8.2018.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 20 Aug 2018 13:04:20 +0300 |
parents | fec2088cdd31 |
children | 4b1690fbddf0 |
files | exporters.pde |
diffstat | 1 files changed, 210 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/exporters.pde Thu Aug 16 15:53:13 2018 +0300 +++ b/exporters.pde Mon Aug 20 13:04:20 2018 +0300 @@ -1216,30 +1216,31 @@ 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++; - } + 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++; } - rr = rr / (avg); - gg = gg / (avg); - bb = bb / (avg); + + rr = int(rr / avg); + gg = int(gg / avg); + bb = int(bb / avg); g_farge = 0; target = -1; compa = 9999; - for (j = 0; j < limitter; j++) { + for (j = 0; j < limitter; j++) + { fld = dist(rr, gg, bb, g_r[idx[j]], g_g[idx[j]], g_b[idx[j]]); if (fld < compa) { compa = fld; target = idx[j]; } } - if (i == target) { - + if (i == target) + { g_farge = target; makepoint(xx, yy); } @@ -1278,7 +1279,8 @@ if (g_pixelw == 2) f = getmultic(chop2(xx), yy, 0); else - f = getabsa(xx, yy, 0); + f = easygetcolor(xx, yy); +// f = getabsa(xx, yy, 0); if (machine == MSX && f == 0) f = g_map[1]; @@ -1353,6 +1355,11 @@ } +void make_coco_palette() +{ +} + + void make_plus4_palette() { int rgb[] = @@ -1486,6 +1493,68 @@ } +void make_bk_palette() +{ + int rgb[] = + { + 0x000000, + 0x0000ff, + 0x00ff00, + 0xff0000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + }; + for (int i = 0; i < g_maxcolors; i++) + { + if (i <= 8) + g_grids[i] = rgb[i] + 0xff282828; + + makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); + } +} + + +void make_ql_palette() +{ + int rgb[] = + { + 0x000000, + 0x0000ff, + 0xff0000, + 0xff00ff, + 0x00ff00, + 0x00ffff, + 0xffff00, + 0xffffff + }; + g_grids[0] = 0xff282828; + g_grids[1] = 0xff0000d8; + g_grids[2] = 0xffd80000; + g_grids[3] = 0xffd800d8; + g_grids[4] = 0xff00d800; + g_grids[5] = 0xff00d8d8; + g_grids[6] = 0xffd8d800; + g_grids[7] = 0xffd8d8d8; + + for (int i = 0; i < g_maxcolors; i++) + { + // if(i<=8){g_grids[i]=rgb[i]+0xff282828;} + makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); + } + g_gridmode = NEW; +} + + void make_msx_palette() { int rgb[] = @@ -1588,7 +1657,9 @@ X = 320; Y = 200; - if (machine == C64) { //c64 hires + if (machine == C64) + { + //c64 hires g_name = "c64"; g_exportext = "prg"; g_exportname = "PRG file"; @@ -1601,7 +1672,9 @@ make_c64_palette(); } else - if (machine == CPC) { //Amstrad CPC mode 0 + if (machine == CPC) + { + //Amstrad CPC mode 0 g_name = "cpc"; g_exportext = "bin"; g_exportname = "BIN file" @@ -1611,7 +1684,7 @@ g_hzoomer = 2; g_palsteps = 3; g_multic = 2; - g_attrimode = 0; + g_attrimode = 2; g_map[1] = byte(255); g_map[0] = 1; @@ -1633,7 +1706,9 @@ makecolor(15, 0xFF, 0xFF, 0xFF); } else - if (machine == MSX) { // MSX + if (machine == MSX) + { + // MSX g_name = "msx"; g_exportext = "com"; g_exportname = "COM file"; @@ -1644,6 +1719,7 @@ Y = 192; g_attrimode = 0; g_backmode = 1; + g_aspect = FLATRATIO; g_farge = 15; g_backg = 0; @@ -1671,7 +1747,9 @@ make_msx_palette(); } else - if (machine == SPECTRUM) { // ZX Spectrum + if (machine == SPECTRUM) + { + // ZX Spectrum g_name = "spec"; g_exportext = "tap"; g_exportname = "TAP file"; @@ -1689,7 +1767,9 @@ make_spectrum_palette(); } else - if (machine == TIMEX) { // timex sinclair + if (machine == TIMEX) + { + // timex sinclair g_name = "tmx"; X = 256; @@ -1702,7 +1782,9 @@ make_spectrum_palette(); } else - if (machine == JR200) { // Panasonic JR200 + if (machine == JR200) + { + // Panasonic JR200 g_name = "jr200"; X = 256; @@ -1715,7 +1797,9 @@ make_spectrum_palette(); //cheating } else - if (machine == PLUS4M || machine == PLUS4) { // Commodore plus/4 + if (machine == PLUS4M || machine == PLUS4) + { + // Commodore plus/4 g_name = "plus4m"; g_exportext = "prg"; g_exportname = "PRG file"; @@ -1732,7 +1816,9 @@ g_map[2] = 61; g_farge = 61; - if (machine == PLUS4) { // plus/4 hires + if (machine == PLUS4) + { + // plus/4 hires g_name = "plus4"; g_formatname = "Botticelli"; g_formatext = "prg"; @@ -1745,7 +1831,9 @@ make_plus4_palette(); } else - if (machine == C64M) { //c64 multicolor + if (machine == C64M) + { + //c64 multicolor g_name = "c64m"; g_exportext = "prg"; g_exportname = "PRG file"; @@ -1761,8 +1849,39 @@ make_c64_palette(); } else - if (machine == AMIGA) { //generic 16bit - g_name = "test"; + if (machine == QLLOW) + { + // Sinclair QL low + g_backmode = 0; + g_maxcolors = 8; + X = 256; + Y = 256; + g_name = "QL"; + g_multic = 2; + g_attrimode = 2; + g_aspect = FLATRATIO; + g_map[1] = byte(0); + make_ql_palette(); + } + else + if (machine == BK0010) + { + // BK0010 patch + g_backmode = 0; + g_maxcolors = 4; + X = 256; + Y = 256; + g_name = "BK"; + g_multic = 2; + g_attrimode = 2; + g_aspect = FLATRATIO; + g_map[1] = byte(0); + make_bk_palette(); + } + else + if (machine == AMIGA) + { + g_name = "amiga"; g_exportext = ""; g_exportname = ""; g_formatname = ""; @@ -1774,16 +1893,42 @@ g_multic = 2; g_attrimode = 2; g_map[1] = byte(0); - for (int z = 0; z < g_maxcolors; z++) { - if (z < 16) { - makecolor(z, z * 17, z * 17, z * 17); - } else { - makecolor(z, (z - 16) * 17, 0, 0); - } + + for (int cindex = 0; cindex < g_maxcolors; cindex++) + { + if (cindex < 16) + makecolor(cindex, cindex * 17, cindex * 17, cindex * 17); + else + makecolor(cindex, (cindex - 16) * 17, 0, 0); } } else - if (machine == C64FLI) { //c64 hires FLI = AFLI + if (machine == ATARIST) + { + //ATARI ST 512 color + g_name = "st"; + g_exportext = ""; + g_exportname = ""; + g_formatname = ""; + g_formatext = ""; + + g_backmode = 1; + g_maxcolors = 16; + g_palsteps = 8; + g_multic = 2; + g_attrimode = 2; + g_map[1] = byte(0); + + for (int cindex = 0; cindex < 8; cindex++) + { + makecolor(cindex, cindex * 36, cindex * 36, cindex * 36); + makecolor(cindex + 8, cindex * 36, 36, 0); + } + } + else + if (machine == C64FLI) + { + //c64 hires FLI = AFLI g_name = "afli"; g_exportext = "prg"; g_exportname = "PRG file"; @@ -1796,7 +1941,9 @@ make_c64_palette(); } else - if (machine == C64FLIM) { //C64 FLI multicolor + if (machine == C64FLIM) + { + //C64 FLI multicolor g_name = "fli"; g_exportext = ""; g_exportname = "PRG file"; @@ -1812,15 +1959,16 @@ make_c64_palette(); } else - if (machine == FAKEX) { // Fake 8-bit computer - g_name = "fake"; + if (machine == C64NOLIMIT) + { + g_name = "c64hino"; g_exportext = ""; g_exportname = ""; g_formatname = ""; g_formatext = ""; X = 320; - Y = 200; + Y = 256; g_multic = 2; g_attrimode = 2; //g_palsteps=4; g_farge = 15; @@ -1828,7 +1976,9 @@ make_c64_palette(); } else - if (machine == PICO8) { // Pico-8 fantasy console + if (machine == PICO8) + { + // Pico-8 fantasy console g_name = "pico8"; g_exportext = ""; g_exportname = ""; @@ -1859,7 +2009,27 @@ makecolor(15, 255, 214, 197); } else - if (machine == UNIA) { // Unia digital palette + if (machine == COCO3) + { + //6-bit RGB, 16 out of 64 possible + g_name = "coco"; + g_exportext = ""; + g_exportname = ""; + g_formatname = ""; + g_formatext = ""; + + g_backmode = 1; + g_maxcolors = 16; + g_palsteps = 4; //00 00 00 + g_multic = 2; + g_attrimode = 2; + g_map[1] = byte(0); + make_coco_palette(); + } + else + if (machine == UNIA) + { + // Unia digital palette g_name = "unia"; g_exportext = ""; g_exportname = "";