Added c64 picture samples
Put the correct version of loadsave.c. Sorry I'm a little ill today. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1014 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
cc47a21eca
commit
62ba2fd885
77
loadsave.c
77
loadsave.c
@ -635,8 +635,7 @@ void Load_image(byte image)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cas d'un chargement dans la brosse
|
// Cas d'un chargement dans la brosse
|
||||||
if (Convert_24b_bitmap_to_256(Brush, Buffer_image_24b, Brush_width,
|
if (Convert_24b_bitmap_to_256(Brush,Buffer_image_24b,Brush_width,Brush_height,Main_palette))
|
||||||
Brush_height, Main_palette))
|
|
||||||
File_error=2;
|
File_error=2;
|
||||||
}
|
}
|
||||||
//if (!File_error)
|
//if (!File_error)
|
||||||
@ -655,9 +654,7 @@ void Load_image(byte image)
|
|||||||
if (Pixel_load_function==Pixel_load_in_preview)
|
if (Pixel_load_function==Pixel_load_in_preview)
|
||||||
{
|
{
|
||||||
dword color_usage[256];
|
dword color_usage[256];
|
||||||
Count_used_colors_screen_area(color_usage, Preview_pos_X,
|
Count_used_colors_area(color_usage,Preview_pos_X,Preview_pos_Y,Main_image_width/Preview_factor_X,Main_image_height/Preview_factor_Y);
|
||||||
Preview_pos_Y, Main_image_width / Preview_factor_X,
|
|
||||||
Main_image_height / Preview_factor_Y);
|
|
||||||
//Count_used_colors(color_usage);
|
//Count_used_colors(color_usage);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Set_nice_menu_colors(color_usage,1);
|
Set_nice_menu_colors(color_usage,1);
|
||||||
@ -6003,12 +6000,13 @@ void Load_C64(void)
|
|||||||
File_error = 1;
|
File_error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Save_C64_hires(FILE *file)
|
int Save_C64_hires(char *filename)
|
||||||
{
|
{
|
||||||
int cx,cy,x,y,c1,c2,i,pixel,bits;
|
int cx,cy,x,y,c1,c2,i,pixel,bits,pos=0;
|
||||||
word numcolors;
|
word numcolors;
|
||||||
dword cusage[256];
|
dword cusage[256];
|
||||||
byte colors[1000];
|
byte colors[1000],bitmap[8000];
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
for(x=0;x<1000;x++)colors[x]=1; // init colormem to black/white
|
for(x=0;x<1000;x++)colors[x]=1; // init colormem to black/white
|
||||||
|
|
||||||
@ -6018,7 +6016,7 @@ int Save_C64_hires(FILE *file)
|
|||||||
{
|
{
|
||||||
for(i=0;i<256;i++) cusage[i]=0;
|
for(i=0;i<256;i++) cusage[i]=0;
|
||||||
|
|
||||||
numcolors=Count_used_colors_area(cusage,cx*8,cy*8,8,8);
|
numcolors=Count_used_colors_screen_area(cusage,cx*8,cy*8,8,8);
|
||||||
if (numcolors>2)
|
if (numcolors>2)
|
||||||
{
|
{
|
||||||
Warning_message("More than 2 colors in 8x8 pixels");
|
Warning_message("More than 2 colors in 8x8 pixels");
|
||||||
@ -6040,7 +6038,6 @@ int Save_C64_hires(FILE *file)
|
|||||||
if(cusage[i])
|
if(cusage[i])
|
||||||
{
|
{
|
||||||
c1=i;
|
c1=i;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
colors[cx+cy*40]=(c2<<4)|c1;
|
colors[cx+cy*40]=(c2<<4)|c1;
|
||||||
@ -6062,15 +6059,29 @@ int Save_C64_hires(FILE *file)
|
|||||||
bits=bits<<1;
|
bits=bits<<1;
|
||||||
if (pixel==c1) bits|=1;
|
if (pixel==c1) bits|=1;
|
||||||
}
|
}
|
||||||
Write_byte(file,bits&255);
|
bitmap[pos++]=bits;
|
||||||
|
//Write_byte(file,bits&255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file = fopen(filename,"wb");
|
||||||
|
|
||||||
|
if(!file)
|
||||||
|
{
|
||||||
|
Warning_message("File open failed");
|
||||||
|
File_error = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Write_bytes(file,bitmap,8000);
|
||||||
Write_bytes(file,colors,1000);
|
Write_bytes(file,colors,1000);
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Save_C64_multi(FILE *file)
|
int Save_C64_multi(char *filename)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
BITS COLOR INFORMATION COMES FROM
|
BITS COLOR INFORMATION COMES FROM
|
||||||
@ -6080,11 +6091,13 @@ BITS COLOR INFORMATION COMES FROM
|
|||||||
11 Color nybble (nybble = 1/2 byte = 4 bits)
|
11 Color nybble (nybble = 1/2 byte = 4 bits)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int cx,cy,x,y,c[4]={0,0,0,0},color,lut[16],bits,pixel;
|
int cx,cy,x,y,c[4]={0,0,0,0},color,lut[16],bits,pixel,pos=0;
|
||||||
byte screen[1000],nybble[1000];
|
byte bitmap[8000],screen[1000],nybble[1000];
|
||||||
word numcolors,count;
|
word numcolors,count;
|
||||||
dword cusage[256];
|
dword cusage[256];
|
||||||
byte i,background=0;
|
byte i,background=0;
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
numcolors=Count_used_colors(cusage);
|
numcolors=Count_used_colors(cusage);
|
||||||
|
|
||||||
count=0;
|
count=0;
|
||||||
@ -6104,7 +6117,7 @@ BITS COLOR INFORMATION COMES FROM
|
|||||||
//printf("\ny:%2d ",cy);
|
//printf("\ny:%2d ",cy);
|
||||||
for(cx=0; cx<40; cx++)
|
for(cx=0; cx<40; cx++)
|
||||||
{
|
{
|
||||||
numcolors=Count_used_colors_area(cusage,cx*4,cy*8,4,8);
|
numcolors=Count_used_colors_screen_area(cusage,cx*4,cy*8,4,8);
|
||||||
if(numcolors>4)
|
if(numcolors>4)
|
||||||
{
|
{
|
||||||
Warning_message("More than 4 colors in 4x8");
|
Warning_message("More than 4 colors in 4x8");
|
||||||
@ -6151,24 +6164,38 @@ BITS COLOR INFORMATION COMES FROM
|
|||||||
bits|=lut[pixel];
|
bits|=lut[pixel];
|
||||||
|
|
||||||
}
|
}
|
||||||
Write_byte(file,bits&255);
|
//Write_byte(file,bits&255);
|
||||||
|
bitmap[pos++]=bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file = fopen(filename,"wb");
|
||||||
|
|
||||||
|
if(!file)
|
||||||
|
{
|
||||||
|
Warning_message("File open failed");
|
||||||
|
File_error = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Write_bytes(file,bitmap,8000);
|
||||||
Write_bytes(file,screen,1000);
|
Write_bytes(file,screen,1000);
|
||||||
Write_bytes(file,nybble,1000);
|
Write_bytes(file,nybble,1000);
|
||||||
Write_byte(file,background);
|
Write_byte(file,background);
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
//printf("\nbg:%d\n",background);
|
//printf("\nbg:%d\n",background);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Save_C64(void)
|
void Save_C64(void)
|
||||||
{
|
{
|
||||||
FILE* file;
|
|
||||||
char filename[MAX_PATH_CHARACTERS];
|
char filename[MAX_PATH_CHARACTERS];
|
||||||
dword numcolors,cusage[256];
|
dword numcolors,cusage[256];
|
||||||
numcolors=Count_used_colors(cusage);
|
numcolors=Count_used_colors(cusage);
|
||||||
|
|
||||||
|
Get_full_filename(filename,0);
|
||||||
|
|
||||||
if (numcolors>16)
|
if (numcolors>16)
|
||||||
{
|
{
|
||||||
Warning_message("Error: Max 16 colors");
|
Warning_message("Error: Max 16 colors");
|
||||||
@ -6182,22 +6209,12 @@ void Save_C64(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Get_full_filename(filename,0);
|
|
||||||
file = fopen(filename,"wb");
|
|
||||||
|
|
||||||
if(!file)
|
|
||||||
{
|
|
||||||
Warning_message("File open failed");
|
|
||||||
File_error = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Main_image_width==320)
|
if (Main_image_width==320)
|
||||||
File_error = Save_C64_hires(file);
|
File_error = Save_C64_hires(filename);
|
||||||
else
|
else
|
||||||
File_error = Save_C64_multi(file);
|
File_error = Save_C64_multi(filename);
|
||||||
|
|
||||||
fclose(file);
|
//fclose(file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
pic-samples/hires.c64
Normal file
BIN
pic-samples/hires.c64
Normal file
Binary file not shown.
BIN
pic-samples/multicolor.c64
Normal file
BIN
pic-samples/multicolor.c64
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user