Color cycling: saved in ILBM format.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1574 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
4ea23b3e9a
commit
c474208860
@ -653,7 +653,6 @@ void Load_LBM(T_IO_Context * context)
|
|||||||
byte min_col;
|
byte min_col;
|
||||||
byte max_col;
|
byte max_col;
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( (Read_dword_be(LBM_file,§ion_size))
|
if ( (Read_dword_be(LBM_file,§ion_size))
|
||||||
&& (Read_word_be(LBM_file,&padding))
|
&& (Read_word_be(LBM_file,&padding))
|
||||||
&& (Read_word_be(LBM_file,&rate))
|
&& (Read_word_be(LBM_file,&rate))
|
||||||
@ -963,6 +962,7 @@ void Save_LBM(T_IO_Context * context)
|
|||||||
byte temp_byte;
|
byte temp_byte;
|
||||||
word real_width;
|
word real_width;
|
||||||
int file_size;
|
int file_size;
|
||||||
|
int i;
|
||||||
|
|
||||||
File_error=0;
|
File_error=0;
|
||||||
Get_full_filename(filename, context->File_name, context->File_directory);
|
Get_full_filename(filename, context->File_name, context->File_directory);
|
||||||
@ -1013,6 +1013,18 @@ void Save_LBM(T_IO_Context * context)
|
|||||||
|
|
||||||
Write_bytes(LBM_file,context->Palette,sizeof(T_Palette));
|
Write_bytes(LBM_file,context->Palette,sizeof(T_Palette));
|
||||||
|
|
||||||
|
for (i=0; i<context->Color_cycles; i++)
|
||||||
|
{
|
||||||
|
Write_bytes(LBM_file,"CRNG",4);
|
||||||
|
Write_dword_be(LBM_file,8); // Section size
|
||||||
|
Write_word_be(LBM_file,0); // Padding
|
||||||
|
Write_word_be(LBM_file,context->Cycle_range[i].Speed*78); // Rate
|
||||||
|
Write_word_be(LBM_file,1|(context->Cycle_range[i].Inverse?2:0)); // Flags
|
||||||
|
Write_byte(LBM_file,context->Cycle_range[i].Start); // Min color
|
||||||
|
Write_byte(LBM_file,context->Cycle_range[i].End); // Max color
|
||||||
|
// No padding, size is multiple of 2
|
||||||
|
}
|
||||||
|
|
||||||
Write_bytes(LBM_file,"BODY",4);
|
Write_bytes(LBM_file,"BODY",4);
|
||||||
Write_dword_be(LBM_file,0); // On mettra la taille à jour à la fin
|
Write_dword_be(LBM_file,0); // On mettra la taille à jour à la fin
|
||||||
|
|
||||||
@ -1037,8 +1049,8 @@ void Save_LBM(T_IO_Context * context)
|
|||||||
file_size=File_length(filename);
|
file_size=File_length(filename);
|
||||||
|
|
||||||
LBM_file=fopen(filename,"rb+");
|
LBM_file=fopen(filename,"rb+");
|
||||||
fseek(LBM_file,820,SEEK_SET);
|
fseek(LBM_file,820+context->Color_cycles*16,SEEK_SET);
|
||||||
Write_dword_be(LBM_file,file_size-824);
|
Write_dword_be(LBM_file,file_size-824-context->Color_cycles*16);
|
||||||
|
|
||||||
if (!File_error)
|
if (!File_error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -608,6 +608,9 @@ void Load_image(T_IO_Context *context)
|
|||||||
T_Format *format = &(File_formats[2]); // Format du fichier à charger
|
T_Format *format = &(File_formats[2]); // Format du fichier à charger
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// Not sure it's the best place...
|
||||||
|
context->Color_cycles=0;
|
||||||
|
|
||||||
// On place par défaut File_error à vrai au cas où on ne sache pas
|
// On place par défaut File_error à vrai au cas où on ne sache pas
|
||||||
// charger le format du fichier:
|
// charger le format du fichier:
|
||||||
File_error=1;
|
File_error=1;
|
||||||
@ -1082,6 +1085,8 @@ void Init_context_backup_image(T_IO_Context * context, char *file_name, char *fi
|
|||||||
/// Setup for loading/saving the current main image
|
/// Setup for loading/saving the current main image
|
||||||
void Init_context_layered_image(T_IO_Context * context, char *file_name, char *file_directory)
|
void Init_context_layered_image(T_IO_Context * context, char *file_name, char *file_directory)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
memset(context, 0, sizeof(T_IO_Context));
|
memset(context, 0, sizeof(T_IO_Context));
|
||||||
|
|
||||||
context->Type = CONTEXT_MAIN_IMAGE;
|
context->Type = CONTEXT_MAIN_IMAGE;
|
||||||
@ -1104,6 +1109,18 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
|
|||||||
context->Target_address=Main_backups->Pages->Image[0];
|
context->Target_address=Main_backups->Pages->Image[0];
|
||||||
context->Pitch=Main_image_width;
|
context->Pitch=Main_image_width;
|
||||||
|
|
||||||
|
// Color cyling ranges:
|
||||||
|
for (i=0; i<16; i++)
|
||||||
|
{
|
||||||
|
if (Gradient_array[i].Start!=Gradient_array[i].End && Gradient_array[i].Speed)
|
||||||
|
{
|
||||||
|
context->Cycle_range[context->Color_cycles].Start=Gradient_array[i].Start;
|
||||||
|
context->Cycle_range[context->Color_cycles].End=Gradient_array[i].End;
|
||||||
|
context->Cycle_range[context->Color_cycles].Inverse=Gradient_array[i].Inverse;
|
||||||
|
context->Cycle_range[context->Color_cycles].Speed=Gradient_array[i].Speed;
|
||||||
|
context->Color_cycles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Setup for loading/saving the flattened version of current main image
|
/// Setup for loading/saving the flattened version of current main image
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user