[layers] work on layer sharing (still stable)
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1045 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
057d5e76e4
commit
2fd88b81bb
@ -507,6 +507,7 @@ void Button_Clear(void)
|
|||||||
Hide_current_image_with_stencil(0,Stencil);
|
Hide_current_image_with_stencil(0,Stencil);
|
||||||
else
|
else
|
||||||
Hide_current_image(0);
|
Hide_current_image(0);
|
||||||
|
Redraw_layered_image();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
Unselect_button(BUTTON_CLEAR);
|
Unselect_button(BUTTON_CLEAR);
|
||||||
@ -521,6 +522,7 @@ void Button_Clear_with_backcolor(void)
|
|||||||
Hide_current_image_with_stencil(Back_color,Stencil);
|
Hide_current_image_with_stencil(Back_color,Stencil);
|
||||||
else
|
else
|
||||||
Hide_current_image(Back_color);
|
Hide_current_image(Back_color);
|
||||||
|
Redraw_layered_image();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
Unselect_button(BUTTON_CLEAR);
|
Unselect_button(BUTTON_CLEAR);
|
||||||
|
|||||||
3
graph.c
3
graph.c
@ -662,7 +662,8 @@ void Get_colors_from_brush(void)
|
|||||||
|
|
||||||
if (Confirmation_box("Modify current palette ?"))
|
if (Confirmation_box("Modify current palette ?"))
|
||||||
{
|
{
|
||||||
Backup();
|
// Backup with unchanged layers, only palette is modified
|
||||||
|
Backup_layers(0);
|
||||||
|
|
||||||
// On commence par initialiser le tableau de booléen à faux
|
// On commence par initialiser le tableau de booléen à faux
|
||||||
for (color=0;color<=255;color++)
|
for (color=0;color<=255;color++)
|
||||||
|
|||||||
10
misc.c
10
misc.c
@ -175,16 +175,16 @@ void Hide_current_image_with_stencil(byte color, byte * stencil)
|
|||||||
int nb_pixels=0; //ECX
|
int nb_pixels=0; //ECX
|
||||||
//al=color
|
//al=color
|
||||||
//edi=Screen_pixels
|
//edi=Screen_pixels
|
||||||
byte* Pixel_Courant=Screen_pixels; //dl
|
byte* pixel=Main_backups->Pages->Image[Main_current_layer];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
nb_pixels=Main_image_height*Main_image_width;
|
nb_pixels=Main_image_height*Main_image_width;
|
||||||
|
|
||||||
for(i=0;i<nb_pixels;i++)
|
for(i=0;i<nb_pixels;i++)
|
||||||
{
|
{
|
||||||
if (stencil[*Pixel_Courant]==0)
|
if (stencil[*pixel]==0)
|
||||||
*Pixel_Courant=color;
|
*pixel=color;
|
||||||
Pixel_Courant++;
|
pixel++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ void Hide_current_image(byte color)
|
|||||||
// Effacer l'image courante avec une certaine couleur
|
// Effacer l'image courante avec une certaine couleur
|
||||||
{
|
{
|
||||||
memset(
|
memset(
|
||||||
Main_screen ,
|
Main_backups->Pages->Image[Main_current_layer],
|
||||||
color ,
|
color ,
|
||||||
Main_image_width * Main_image_height
|
Main_image_width * Main_image_height
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3909,12 +3909,15 @@ void Scroll_12_0(void)
|
|||||||
//
|
//
|
||||||
{
|
{
|
||||||
Init_start_operation();
|
Init_start_operation();
|
||||||
Backup();
|
|
||||||
Operation_push(Paintbrush_X);
|
Operation_push(Paintbrush_X);
|
||||||
Operation_push(Paintbrush_Y);
|
Operation_push(Paintbrush_Y);
|
||||||
Operation_push(Paintbrush_X);
|
Operation_push(Paintbrush_X);
|
||||||
Operation_push(Paintbrush_Y);
|
Operation_push(Paintbrush_Y);
|
||||||
Operation_push(Mouse_K); // LEFT_SIDE or RIGHT_SIDE
|
Operation_push(Mouse_K); // LEFT_SIDE or RIGHT_SIDE
|
||||||
|
if (Mouse_K == LEFT_SIDE)
|
||||||
|
Backup();
|
||||||
|
else
|
||||||
|
Backup_layers(Main_layers_visible);
|
||||||
|
|
||||||
Cursor_hidden_before_scroll=Cursor_hidden;
|
Cursor_hidden_before_scroll=Cursor_hidden;
|
||||||
Cursor_hidden=1;
|
Cursor_hidden=1;
|
||||||
|
|||||||
7
pages.c
7
pages.c
@ -649,7 +649,12 @@ void Backup(void)
|
|||||||
// Sauve la page courante comme première page de backup et crée une nouvelle page
|
// Sauve la page courante comme première page de backup et crée une nouvelle page
|
||||||
// pur continuer à dessiner. Utilisé par exemple pour le fill
|
// pur continuer à dessiner. Utilisé par exemple pour le fill
|
||||||
{
|
{
|
||||||
int i;
|
Backup_layers(1<<Main_current_layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Backup_layers(byte layer_mask)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
T_Page *new_page;
|
T_Page *new_page;
|
||||||
|
|
||||||
|
|||||||
3
pages.h
3
pages.h
@ -72,7 +72,10 @@ int Init_all_backup_lists(int width,int height);
|
|||||||
void Set_number_of_backups(int nb_backups);
|
void Set_number_of_backups(int nb_backups);
|
||||||
int Backup_with_new_dimensions(int upload,int width,int height);
|
int Backup_with_new_dimensions(int upload,int width,int height);
|
||||||
int Backup_and_resize_the_spare(int width,int height);
|
int Backup_and_resize_the_spare(int width,int height);
|
||||||
|
/// Backup with a new copy for the working layer, and references for all others.
|
||||||
void Backup(void);
|
void Backup(void);
|
||||||
|
/// Backup with a new copy of some layers (the others are references).
|
||||||
|
void Backup_layers(byte layer_mask);
|
||||||
void Undo(void);
|
void Undo(void);
|
||||||
void Redo(void);
|
void Redo(void);
|
||||||
void Free_current_page(void); // 'Kill' button
|
void Free_current_page(void); // 'Kill' button
|
||||||
|
|||||||
14
palette.c
14
palette.c
@ -1276,7 +1276,7 @@ void Button_Palette(void)
|
|||||||
// est en mode X-SWAP.
|
// est en mode X-SWAP.
|
||||||
if (!image_is_backed_up)
|
if (!image_is_backed_up)
|
||||||
{
|
{
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
image_is_backed_up=1;
|
image_is_backed_up=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1403,7 +1403,7 @@ void Button_Palette(void)
|
|||||||
memcpy(backup_palette,working_palette,sizeof(T_Palette));
|
memcpy(backup_palette,working_palette,sizeof(T_Palette));
|
||||||
if (!image_is_backed_up)
|
if (!image_is_backed_up)
|
||||||
{
|
{
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
image_is_backed_up=1;
|
image_is_backed_up=1;
|
||||||
}
|
}
|
||||||
Reduce_palette(&used_colors,reduce_colors_number,working_palette,color_usage);
|
Reduce_palette(&used_colors,reduce_colors_number,working_palette,color_usage);
|
||||||
@ -1780,7 +1780,7 @@ void Button_Palette(void)
|
|||||||
{
|
{
|
||||||
if (!image_is_backed_up)
|
if (!image_is_backed_up)
|
||||||
{
|
{
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
image_is_backed_up=1;
|
image_is_backed_up=1;
|
||||||
}
|
}
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -1880,7 +1880,7 @@ void Button_Palette(void)
|
|||||||
// Make a backup because remapping is an undoable modification
|
// Make a backup because remapping is an undoable modification
|
||||||
if (!image_is_backed_up)
|
if (!image_is_backed_up)
|
||||||
{
|
{
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
image_is_backed_up=1;
|
image_is_backed_up=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2024,7 +2024,7 @@ void Button_Palette(void)
|
|||||||
// de ne pas trop modifier l'image.
|
// de ne pas trop modifier l'image.
|
||||||
if (!image_is_backed_up)
|
if (!image_is_backed_up)
|
||||||
{
|
{
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
image_is_backed_up=1;
|
image_is_backed_up=1;
|
||||||
}
|
}
|
||||||
if (used_colors==-1)
|
if (used_colors==-1)
|
||||||
@ -2126,9 +2126,9 @@ void Button_Palette(void)
|
|||||||
{
|
{
|
||||||
if ( (!image_is_backed_up)
|
if ( (!image_is_backed_up)
|
||||||
&& memcmp(Main_palette,working_palette,sizeof(T_Palette)) )
|
&& memcmp(Main_palette,working_palette,sizeof(T_Palette)) )
|
||||||
Backup();
|
Backup_layers(-1);
|
||||||
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
memcpy(Main_palette,working_palette,sizeof(T_Palette));
|
||||||
// End_of_modification();
|
End_of_modification();
|
||||||
// Not really needed, the change was in palette entries
|
// Not really needed, the change was in palette entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
char Program_version[]="2.2wip";
|
char Program_version[]="layers wip";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user