mirror of https://github.com/weiju/amiga-stuff
improved playfield1 and png2image
fixed issue when number of colors is less than 2^n, output and use colors from png2image
This commit is contained in:
parent
f545f5dfa5
commit
c0d859fb88
|
@ -15,12 +15,14 @@
|
|||
|
||||
#ifdef USE_PAL
|
||||
#if NUM_BITPLANES == 1
|
||||
#include "test-320x256.h"
|
||||
#include "test320x256.h"
|
||||
#define NUM_COLORS 2
|
||||
#else
|
||||
#include "test-320x256x2.h"
|
||||
#include "test320x256x2.h"
|
||||
#define NUM_COLORS 4
|
||||
#endif
|
||||
#else
|
||||
#include "test-320x200.h"
|
||||
#include "test320x200.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -123,8 +125,8 @@ int main(int argc, char **argv)
|
|||
UWORD lib_version = ((struct Library *) GfxBase)->lib_Version;
|
||||
|
||||
BOOL is_pal = init_display(lib_version);
|
||||
ULONG pl1data = (ULONG) imdata;
|
||||
ULONG pl2data = ((ULONG) &imdata[20 * NUM_RASTER_LINES]);
|
||||
ULONG pl1data = (ULONG) image_data;
|
||||
ULONG pl2data = ((ULONG) &image_data[20 * NUM_RASTER_LINES]);
|
||||
|
||||
// hardcoded for UAE, since it seems that the mode returned is always NTSC
|
||||
is_pal = USE_PAL;
|
||||
|
@ -141,10 +143,9 @@ int main(int argc, char **argv)
|
|||
|
||||
custom.diwstrt = DIWSTRT_VALUE;
|
||||
custom.diwstop = DIWSTOP_VALUE;
|
||||
custom.color[0] = COLOR0; // background red
|
||||
custom.color[1] = COLOR1; // color 1 is yellow
|
||||
custom.color[2] = COLOR2;
|
||||
custom.color[3] = COLOR3;
|
||||
for (int i = 0; i < NUM_COLORS; i++) {
|
||||
custom.color[i] = image_colors[i];
|
||||
}
|
||||
|
||||
// Initialize copper list with image data address
|
||||
coplist[1] = (pl1data >> 16) & 0xffff;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Ensure that this data is within chip memory or you'll see nothing !!! */
|
||||
UWORD __chip imdata[] = {
|
||||
UWORD __chip image_data[] = {
|
||||
// plane 0
|
||||
0xe000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007f,0xffff,
|
||||
0xf800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00ff,0xffff,
|
||||
|
@ -202,3 +202,8 @@ UWORD __chip imdata[] = {
|
|||
0xffff,0xff80,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x000f,0xfe00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xffff,
|
||||
0xffff,0xff00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0003,0xfc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xffff
|
||||
};
|
||||
|
||||
UWORD image_colors[2] = {
|
||||
0xfff,0x000
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* Ensure that this data is within chip memory or you'll see nothing !!! */
|
||||
UWORD __chip imdata[] = {
|
||||
UWORD __chip image_data[] = {
|
||||
// plane 0
|
||||
0xe000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007f,0xffff,
|
||||
0xf800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00ff,0xffff,
|
||||
|
@ -259,3 +259,7 @@ UWORD __chip imdata[] = {
|
|||
0xffff,0xff00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0003,0xfc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xffff
|
||||
};
|
||||
|
||||
UWORD image_colors[2] = {
|
||||
0xfff,0x000
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* Ensure that this data is within chip memory or you'll see nothing !!! */
|
||||
UWORD __chip imdata[] = {
|
||||
UWORD __chip image_data[] = {
|
||||
// plane 0
|
||||
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xe000,0x03fe,
|
||||
0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xc000,0x01f8,
|
||||
|
@ -515,3 +515,8 @@ UWORD __chip imdata[] = {
|
|||
0x0000,0x0000,0x01ff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xff80,0x0000,0x0000,0x0000,
|
||||
0x0018,0x0000,0x03ff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xff80,0x0000,0x0000,0x0000
|
||||
};
|
||||
|
||||
UWORD image_colors[4] = {
|
||||
0x000,0x40b,0x2f1,0xfff
|
||||
};
|
||||
|
|
@ -27,7 +27,7 @@ def write_amiga_image(image, outfile, img_name, use_intuition):
|
|||
|
||||
# colors is a list of 3-integer lists ([[r1, g1, b1], ...])
|
||||
colors = [i for i in chunks([b for b in im.palette.tobytes()], 3)]
|
||||
depth = int(math.log(len(colors), 2))
|
||||
depth = round(math.log(len(colors), 2))
|
||||
|
||||
map_words_per_row = int(width / 16)
|
||||
if width % 16 > 0:
|
||||
|
@ -58,12 +58,13 @@ def write_amiga_image(image, outfile, img_name, use_intuition):
|
|||
outfile.write('UWORD __chip %s[] = {\n' % imgdata_varname)
|
||||
indent = 4
|
||||
for i, plane in enumerate(planes):
|
||||
if i > 0:
|
||||
outfile.write(',\n')
|
||||
outfile.write(' ' * indent + '// plane %d\n' % i)
|
||||
lines = [(' ' * indent) + ','.join(['0x%04x' % i for i in chunk])
|
||||
for chunk in chunks(plane, map_words_per_row)]
|
||||
outfile.write(',\n'.join(lines))
|
||||
outfile.write('\n')
|
||||
outfile.write('};\n\n')
|
||||
outfile.write('\n};\n\n')
|
||||
|
||||
|
||||
planepick = 2 ** depth - 1 # currently we always use all of the planes
|
||||
|
|
Loading…
Reference in New Issue