[layers] Fix a merge error from last commit which disabled layer selection. Implemented Fill. Color replacer in progress (ie: it crashes).
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1067 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
0b07b43722
commit
eb1878e413
396
engine.c
396
engine.c
@ -476,11 +476,12 @@ void Main_handler(void)
|
|||||||
int button_index; // Numéro de bouton de menu en cours
|
int button_index; // Numéro de bouton de menu en cours
|
||||||
int prev_button_number=0; // Numéro de bouton de menu sur lequel on était précédemment
|
int prev_button_number=0; // Numéro de bouton de menu sur lequel on était précédemment
|
||||||
byte blink; // L'opération demande un effacement du curseur
|
byte blink; // L'opération demande un effacement du curseur
|
||||||
int shortcut_button; // Button à enclencher d'après la touche de raccourci enfoncée
|
|
||||||
byte clicked_button = 0; // Côté du bouton à enclencher d'après la touche de raccourci enfoncée
|
|
||||||
int key_index; // index du tableau de touches spéciales correspondant à la touche enfoncée
|
int key_index; // index du tableau de touches spéciales correspondant à la touche enfoncée
|
||||||
char str[25];
|
char str[25];
|
||||||
byte temp;
|
byte temp;
|
||||||
|
byte effect_modified;
|
||||||
|
byte action;
|
||||||
|
dword key_pressed;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -498,6 +499,13 @@ void Main_handler(void)
|
|||||||
|
|
||||||
if(Get_input())
|
if(Get_input())
|
||||||
{
|
{
|
||||||
|
action = 0;
|
||||||
|
|
||||||
|
// Inhibit all keys if a drawing operation is in progress.
|
||||||
|
// We make an exception for the freehand operations, but these will
|
||||||
|
// only accept a very limited number of shortcuts.
|
||||||
|
if (Operation_stack_size!=0 && !Allow_color_change_during_operation)
|
||||||
|
Key=0;
|
||||||
|
|
||||||
// Evenement de fermeture
|
// Evenement de fermeture
|
||||||
if (Quit_is_required)
|
if (Quit_is_required)
|
||||||
@ -506,144 +514,154 @@ void Main_handler(void)
|
|||||||
Button_Quit();
|
Button_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion des touches
|
|
||||||
if (Key)
|
if (Key)
|
||||||
{
|
{
|
||||||
for (key_index=0;(key_index<NB_SPECIAL_SHORTCUTS) && !Is_shortcut(Key,key_index);key_index++);
|
effect_modified = 0;
|
||||||
|
|
||||||
// Gestion des touches spéciales:
|
for (key_index=SPECIAL_CLICK_RIGHT+1;key_index<NB_SPECIAL_SHORTCUTS;key_index++)
|
||||||
if (key_index>SPECIAL_CLICK_RIGHT)
|
{
|
||||||
|
if (Is_shortcut(Key,key_index))
|
||||||
|
{
|
||||||
|
// Special keys (functions not hooked to a UI button)
|
||||||
switch(key_index)
|
switch(key_index)
|
||||||
|
{
|
||||||
|
case SPECIAL_NEXT_FORECOLOR : // Next foreground color
|
||||||
|
Special_next_forecolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color
|
||||||
|
Special_previous_forecolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_NEXT_BACKCOLOR : // Next background color
|
||||||
|
Special_next_backcolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color
|
||||||
|
Special_previous_backcolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau
|
||||||
|
Smaller_paintbrush();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau
|
||||||
|
Bigger_paintbrush();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color
|
||||||
|
Special_next_user_forecolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color
|
||||||
|
Special_previous_user_forecolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color
|
||||||
|
Special_next_user_backcolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color
|
||||||
|
Special_previous_user_backcolor();
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other shortcuts are forbidden while an operation is in progress
|
||||||
|
if (Operation_stack_size!=0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (key_index)
|
||||||
{
|
{
|
||||||
case SPECIAL_SCROLL_UP : // Scroll up
|
case SPECIAL_SCROLL_UP : // Scroll up
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,-(Main_magnifier_height>>2));
|
Scroll_magnifier(0,-(Main_magnifier_height>>2));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-(Screen_height>>3));
|
Scroll_screen(0,-(Screen_height>>3));
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN : // Scroll down
|
case SPECIAL_SCROLL_DOWN : // Scroll down
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,(Main_magnifier_height>>2));
|
Scroll_magnifier(0,(Main_magnifier_height>>2));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,(Screen_height>>3));
|
Scroll_screen(0,(Screen_height>>3));
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT : // Scroll left
|
case SPECIAL_SCROLL_LEFT : // Scroll left
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(-(Main_magnifier_width>>2),0);
|
Scroll_magnifier(-(Main_magnifier_width>>2),0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-(Screen_width>>3),0);
|
Scroll_screen(-(Screen_width>>3),0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT : // Scroll right
|
case SPECIAL_SCROLL_RIGHT : // Scroll right
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier((Main_magnifier_width>>2),0);
|
Scroll_magnifier((Main_magnifier_width>>2),0);
|
||||||
else
|
else
|
||||||
Scroll_screen((Screen_width>>3),0);
|
Scroll_screen((Screen_width>>3),0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_UP_FAST : // Scroll up faster
|
case SPECIAL_SCROLL_UP_FAST : // Scroll up faster
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,-(Main_magnifier_height>>1));
|
Scroll_magnifier(0,-(Main_magnifier_height>>1));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-(Screen_height>>2));
|
Scroll_screen(0,-(Screen_height>>2));
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster
|
case SPECIAL_SCROLL_DOWN_FAST : // Scroll down faster
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,(Main_magnifier_height>>1));
|
Scroll_magnifier(0,(Main_magnifier_height>>1));
|
||||||
else
|
else
|
||||||
Scroll_screen(0,(Screen_height>>2));
|
Scroll_screen(0,(Screen_height>>2));
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster
|
case SPECIAL_SCROLL_LEFT_FAST : // Scroll left faster
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(-(Main_magnifier_width>>1),0);
|
Scroll_magnifier(-(Main_magnifier_width>>1),0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-(Screen_width>>2),0);
|
Scroll_screen(-(Screen_width>>2),0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster
|
case SPECIAL_SCROLL_RIGHT_FAST : // Scroll right faster
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier((Main_magnifier_width>>1),0);
|
Scroll_magnifier((Main_magnifier_width>>1),0);
|
||||||
else
|
else
|
||||||
Scroll_screen((Screen_width>>2),0);
|
Scroll_screen((Screen_width>>2),0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower
|
case SPECIAL_SCROLL_UP_SLOW : // Scroll up slower
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,-1);
|
Scroll_magnifier(0,-1);
|
||||||
else
|
else
|
||||||
Scroll_screen(0,-1);
|
Scroll_screen(0,-1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower
|
case SPECIAL_SCROLL_DOWN_SLOW : // Scroll down slower
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(0,1);
|
Scroll_magnifier(0,1);
|
||||||
else
|
else
|
||||||
Scroll_screen(0,1);
|
Scroll_screen(0,1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower
|
case SPECIAL_SCROLL_LEFT_SLOW : // Scroll left slower
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(-1,0);
|
Scroll_magnifier(-1,0);
|
||||||
else
|
else
|
||||||
Scroll_screen(-1,0);
|
Scroll_screen(-1,0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower
|
case SPECIAL_SCROLL_RIGHT_SLOW : // Scroll right slower
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Scroll_magnifier(1,0);
|
Scroll_magnifier(1,0);
|
||||||
else
|
else
|
||||||
Scroll_screen(1,0);
|
Scroll_screen(1,0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
|
||||||
case SPECIAL_NEXT_FORECOLOR : // Next foreground color
|
|
||||||
Special_next_forecolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_PREVIOUS_FORECOLOR : // Previous foreground color
|
|
||||||
Special_previous_forecolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_NEXT_BACKCOLOR : // Next background color
|
|
||||||
Special_next_backcolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_PREVIOUS_BACKCOLOR : // Previous background color
|
|
||||||
Special_previous_backcolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_SMALLER_PAINTBRUSH: // Rétrécir le pinceau
|
|
||||||
Smaller_paintbrush();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_BIGGER_PAINTBRUSH: // Grossir le pinceau
|
|
||||||
Bigger_paintbrush();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_NEXT_USER_FORECOLOR : // Next user-defined foreground color
|
|
||||||
Special_next_user_forecolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_PREVIOUS_USER_FORECOLOR : // Previous user-defined foreground color
|
|
||||||
Special_previous_user_forecolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_NEXT_USER_BACKCOLOR : // Next user-defined background color
|
|
||||||
Special_next_user_backcolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
|
||||||
case SPECIAL_PREVIOUS_USER_BACKCOLOR : // Previous user-defined background color
|
|
||||||
Special_previous_user_backcolor();
|
|
||||||
Key=0;
|
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor
|
case SPECIAL_SHOW_HIDE_CURSOR : // Show / Hide cursor
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Cursor_hidden=!Cursor_hidden;
|
Cursor_hidden=!Cursor_hidden;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_DOT_PAINTBRUSH : // Paintbrush = "."
|
case SPECIAL_DOT_PAINTBRUSH : // Paintbrush = "."
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -651,32 +669,32 @@ void Main_handler(void)
|
|||||||
Set_paintbrush_size(1,1);
|
Set_paintbrush_size(1,1);
|
||||||
Change_paintbrush_shape(PAINTBRUSH_SHAPE_ROUND);
|
Change_paintbrush_shape(PAINTBRUSH_SHAPE_ROUND);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_CONTINUOUS_DRAW : // Continuous freehand drawing
|
case SPECIAL_CONTINUOUS_DRAW : // Continuous freehand drawing
|
||||||
Select_button(BUTTON_DRAW,LEFT_SIDE);
|
Select_button(BUTTON_DRAW,LEFT_SIDE);
|
||||||
// ATTENTION CE TRUC EST MOCHE ET VA MERDER SI ON SE MET A UTILISER DES BOUTONS POPUPS
|
// ATTENTION CE TRUC EST MOCHE ET VA MERDER SI ON SE MET A UTILISER DES BOUTONS POPUPS
|
||||||
while (Current_operation!=OPERATION_CONTINUOUS_DRAW)
|
while (Current_operation!=OPERATION_CONTINUOUS_DRAW)
|
||||||
Select_button(BUTTON_DRAW,RIGHT_SIDE);
|
Select_button(BUTTON_DRAW,RIGHT_SIDE);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_FLIP_X : // Flip X
|
case SPECIAL_FLIP_X : // Flip X
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Flip_X_lowlevel(Brush, Brush_width, Brush_height);
|
Flip_X_lowlevel(Brush, Brush_width, Brush_height);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_FLIP_Y : // Flip Y
|
case SPECIAL_FLIP_Y : // Flip Y
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Flip_Y_lowlevel(Brush, Brush_width, Brush_height);
|
Flip_Y_lowlevel(Brush, Brush_width, Brush_height);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ROTATE_90 : // 90° brush rotation
|
case SPECIAL_ROTATE_90 : // 90° brush rotation
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Rotate_90_deg();
|
Rotate_90_deg();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ROTATE_180 : // 180° brush rotation
|
case SPECIAL_ROTATE_180 : // 180° brush rotation
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
@ -684,322 +702,368 @@ void Main_handler(void)
|
|||||||
Brush_offset_X=(Brush_width>>1);
|
Brush_offset_X=(Brush_width>>1);
|
||||||
Brush_offset_Y=(Brush_height>>1);
|
Brush_offset_Y=(Brush_height>>1);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_STRETCH : // Stretch brush
|
case SPECIAL_STRETCH : // Stretch brush
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Start_operation_stack(OPERATION_STRETCH_BRUSH);
|
Start_operation_stack(OPERATION_STRETCH_BRUSH);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_DISTORT : // Distort brush
|
case SPECIAL_DISTORT : // Distort brush
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Start_operation_stack(OPERATION_DISTORT_BRUSH);
|
Start_operation_stack(OPERATION_DISTORT_BRUSH);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ROTATE_ANY_ANGLE : // Rotate brush by any angle
|
case SPECIAL_ROTATE_ANY_ANGLE : // Rotate brush by any angle
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Start_operation_stack(OPERATION_ROTATE_BRUSH);
|
Start_operation_stack(OPERATION_ROTATE_BRUSH);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_OUTLINE : // Outline brush
|
case SPECIAL_OUTLINE : // Outline brush
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Outline_brush();
|
Outline_brush();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_NIBBLE : // Nibble brush
|
case SPECIAL_NIBBLE : // Nibble brush
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Nibble_brush();
|
Nibble_brush();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_GET_BRUSH_COLORS : // Get colors from brush
|
case SPECIAL_GET_BRUSH_COLORS : // Get colors from brush
|
||||||
Get_colors_from_brush();
|
Get_colors_from_brush();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_RECOLORIZE_BRUSH : // Recolorize brush
|
case SPECIAL_RECOLORIZE_BRUSH : // Recolorize brush
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Remap_brush();
|
Remap_brush();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_LOAD_BRUSH :
|
case SPECIAL_LOAD_BRUSH :
|
||||||
Load_picture(0);
|
Load_picture(0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SAVE_BRUSH :
|
case SPECIAL_SAVE_BRUSH :
|
||||||
Save_picture(0);
|
Save_picture(0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_IN : // Zoom in
|
case SPECIAL_ZOOM_IN : // Zoom in
|
||||||
Zoom(+1);
|
Zoom(+1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_OUT : // Zoom out
|
case SPECIAL_ZOOM_OUT : // Zoom out
|
||||||
Zoom(-1);
|
Zoom(-1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_CENTER_ATTACHMENT : // Center brush attachment
|
case SPECIAL_CENTER_ATTACHMENT : // Center brush attachment
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Brush_offset_X=(Brush_width>>1);
|
Brush_offset_X=(Brush_width>>1);
|
||||||
Brush_offset_Y=(Brush_height>>1);
|
Brush_offset_Y=(Brush_height>>1);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TOP_LEFT_ATTACHMENT : // Top-left brush attachment
|
case SPECIAL_TOP_LEFT_ATTACHMENT : // Top-left brush attachment
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Brush_offset_X=0;
|
Brush_offset_X=0;
|
||||||
Brush_offset_Y=0;
|
Brush_offset_Y=0;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TOP_RIGHT_ATTACHMENT : // Top-right brush attachment
|
case SPECIAL_TOP_RIGHT_ATTACHMENT : // Top-right brush attachment
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Brush_offset_X=(Brush_width-1);
|
Brush_offset_X=(Brush_width-1);
|
||||||
Brush_offset_Y=0;
|
Brush_offset_Y=0;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_BOTTOM_LEFT_ATTACHMENT : // Bottom-left brush attachment
|
case SPECIAL_BOTTOM_LEFT_ATTACHMENT : // Bottom-left brush attachment
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Brush_offset_X=0;
|
Brush_offset_X=0;
|
||||||
Brush_offset_Y=(Brush_height-1);
|
Brush_offset_Y=(Brush_height-1);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_BOTTOM_RIGHT_ATTACHMENT : // Bottom right brush attachment
|
case SPECIAL_BOTTOM_RIGHT_ATTACHMENT : // Bottom right brush attachment
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Brush_offset_X=(Brush_width-1);
|
Brush_offset_X=(Brush_width-1);
|
||||||
Brush_offset_Y=(Brush_height-1);
|
Brush_offset_Y=(Brush_height-1);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_EXCLUDE_COLORS_MENU : // Exclude colors menu
|
case SPECIAL_EXCLUDE_COLORS_MENU : // Exclude colors menu
|
||||||
Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU);
|
Menu_tag_colors("Tag colors to exclude",Exclude_color,&temp,1, NULL, SPECIAL_EXCLUDE_COLORS_MENU);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_INVERT_SIEVE :
|
case SPECIAL_INVERT_SIEVE :
|
||||||
Invert_trame();
|
Invert_trame();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SHADE_MODE :
|
case SPECIAL_SHADE_MODE :
|
||||||
Button_Shade_mode();
|
Button_Shade_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SHADE_MENU :
|
case SPECIAL_SHADE_MENU :
|
||||||
Button_Shade_menu();
|
Button_Shade_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_QUICK_SHADE_MODE :
|
case SPECIAL_QUICK_SHADE_MODE :
|
||||||
Button_Quick_shade_mode();
|
Button_Quick_shade_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_QUICK_SHADE_MENU :
|
case SPECIAL_QUICK_SHADE_MENU :
|
||||||
Button_Quick_shade_menu();
|
Button_Quick_shade_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_STENCIL_MODE :
|
case SPECIAL_STENCIL_MODE :
|
||||||
Button_Stencil_mode();
|
Button_Stencil_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_STENCIL_MENU :
|
case SPECIAL_STENCIL_MENU :
|
||||||
Button_Stencil_menu();
|
Button_Stencil_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_MASK_MODE :
|
case SPECIAL_MASK_MODE :
|
||||||
Button_Mask_mode();
|
Button_Mask_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_MASK_MENU :
|
case SPECIAL_MASK_MENU :
|
||||||
Button_Mask_menu();
|
Button_Mask_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_GRID_MODE :
|
case SPECIAL_GRID_MODE :
|
||||||
Button_Snap_mode();
|
Button_Snap_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_GRID_MENU :
|
case SPECIAL_GRID_MENU :
|
||||||
Button_Grid_menu();
|
Button_Grid_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SHOW_GRID :
|
case SPECIAL_SHOW_GRID :
|
||||||
Button_Show_grid();
|
Button_Show_grid();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SIEVE_MODE :
|
case SPECIAL_SIEVE_MODE :
|
||||||
Button_Sieve_mode();
|
Button_Sieve_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SIEVE_MENU :
|
case SPECIAL_SIEVE_MENU :
|
||||||
Button_Sieve_menu();
|
Button_Sieve_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_COLORIZE_MODE :
|
case SPECIAL_COLORIZE_MODE :
|
||||||
Button_Colorize_mode();
|
Button_Colorize_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_COLORIZE_MENU :
|
case SPECIAL_COLORIZE_MENU :
|
||||||
Button_Colorize_menu();
|
Button_Colorize_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SMOOTH_MODE :
|
case SPECIAL_SMOOTH_MODE :
|
||||||
Button_Smooth_mode();
|
Button_Smooth_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SMOOTH_MENU :
|
case SPECIAL_SMOOTH_MENU :
|
||||||
Button_Smooth_menu();
|
Button_Smooth_menu();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_SMEAR_MODE :
|
case SPECIAL_SMEAR_MODE :
|
||||||
Button_Smear_mode();
|
Button_Smear_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TILING_MODE :
|
case SPECIAL_TILING_MODE :
|
||||||
Button_Tiling_mode();
|
Button_Tiling_mode();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TILING_MENU :
|
case SPECIAL_TILING_MENU :
|
||||||
|
effect_modified = 1;
|
||||||
Button_Tiling_menu();
|
Button_Tiling_menu();
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_EFFECTS_OFF :
|
case SPECIAL_EFFECTS_OFF :
|
||||||
Effects_off();
|
Effects_off();
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_1 :
|
case SPECIAL_TRANSPARENCY_1 :
|
||||||
Layer_activate(0, LEFT_SIDE);
|
Transparency_set(1);
|
||||||
//Transparency_set(1);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_2 :
|
case SPECIAL_TRANSPARENCY_2 :
|
||||||
Layer_activate(1, LEFT_SIDE);
|
Transparency_set(2);
|
||||||
//Transparency_set(2);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_3 :
|
case SPECIAL_TRANSPARENCY_3 :
|
||||||
Layer_activate(2, LEFT_SIDE);
|
Transparency_set(3);
|
||||||
//Transparency_set(3);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_4 :
|
case SPECIAL_TRANSPARENCY_4 :
|
||||||
Layer_activate(3, LEFT_SIDE);
|
Transparency_set(4);
|
||||||
//Transparency_set(4);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_5 :
|
case SPECIAL_TRANSPARENCY_5 :
|
||||||
Layer_activate(0, RIGHT_SIDE);
|
Transparency_set(5);
|
||||||
//Transparency_set(5);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_6 :
|
case SPECIAL_TRANSPARENCY_6 :
|
||||||
Layer_activate(1, RIGHT_SIDE);
|
Transparency_set(6);
|
||||||
//Transparency_set(6);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_7 :
|
case SPECIAL_TRANSPARENCY_7 :
|
||||||
Layer_activate(2, RIGHT_SIDE);
|
Transparency_set(7);
|
||||||
//Transparency_set(7);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_8 :
|
case SPECIAL_TRANSPARENCY_8 :
|
||||||
Layer_activate(3, RIGHT_SIDE);
|
Transparency_set(8);
|
||||||
//Transparency_set(8);
|
effect_modified = 1;
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_9 :
|
case SPECIAL_TRANSPARENCY_9 :
|
||||||
Transparency_set(9);
|
Transparency_set(9);
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_TRANSPARENCY_0 :
|
case SPECIAL_TRANSPARENCY_0 :
|
||||||
Transparency_set(0);
|
Transparency_set(0);
|
||||||
Key=0;
|
effect_modified = 1;
|
||||||
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_1 :
|
case SPECIAL_ZOOM_1 :
|
||||||
Zoom_set(-1);
|
Zoom_set(-1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_2 :
|
case SPECIAL_ZOOM_2 :
|
||||||
Zoom_set(0);
|
Zoom_set(0);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_3 :
|
case SPECIAL_ZOOM_3 :
|
||||||
Zoom_set(1);
|
Zoom_set(1);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_4 :
|
case SPECIAL_ZOOM_4 :
|
||||||
Zoom_set(2);
|
Zoom_set(2);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_5 :
|
case SPECIAL_ZOOM_5 :
|
||||||
Zoom_set(3);
|
Zoom_set(3);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_6 :
|
case SPECIAL_ZOOM_6 :
|
||||||
Zoom_set(4);
|
Zoom_set(4);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_8 :
|
case SPECIAL_ZOOM_8 :
|
||||||
Zoom_set(5);
|
Zoom_set(5);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_10 :
|
case SPECIAL_ZOOM_10 :
|
||||||
Zoom_set(6);
|
Zoom_set(6);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_12 :
|
case SPECIAL_ZOOM_12 :
|
||||||
Zoom_set(7);
|
Zoom_set(7);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_14 :
|
case SPECIAL_ZOOM_14 :
|
||||||
Zoom_set(8);
|
Zoom_set(8);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_16 :
|
case SPECIAL_ZOOM_16 :
|
||||||
Zoom_set(9);
|
Zoom_set(9);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_18 :
|
case SPECIAL_ZOOM_18 :
|
||||||
Zoom_set(10);
|
Zoom_set(10);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_ZOOM_20 :
|
case SPECIAL_ZOOM_20 :
|
||||||
Zoom_set(11);
|
Zoom_set(11);
|
||||||
Key=0;
|
action++;
|
||||||
break;
|
break;
|
||||||
default : // Gestion des touches de raccourci de bouton:
|
case SPECIAL_LAYER1_SELECT:
|
||||||
// Pour chaque bouton
|
case SPECIAL_LAYER2_SELECT:
|
||||||
shortcut_button=-1;
|
case SPECIAL_LAYER3_SELECT:
|
||||||
|
case SPECIAL_LAYER4_SELECT:
|
||||||
|
case SPECIAL_LAYER5_SELECT:
|
||||||
|
case SPECIAL_LAYER6_SELECT:
|
||||||
|
case SPECIAL_LAYER7_SELECT:
|
||||||
|
case SPECIAL_LAYER8_SELECT:
|
||||||
|
Layer_activate((key_index-SPECIAL_LAYER1_SELECT)/2, LEFT_SIDE);
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
case SPECIAL_LAYER1_TOGGLE:
|
||||||
|
case SPECIAL_LAYER2_TOGGLE:
|
||||||
|
case SPECIAL_LAYER3_TOGGLE:
|
||||||
|
case SPECIAL_LAYER4_TOGGLE:
|
||||||
|
case SPECIAL_LAYER5_TOGGLE:
|
||||||
|
case SPECIAL_LAYER6_TOGGLE:
|
||||||
|
case SPECIAL_LAYER7_TOGGLE:
|
||||||
|
case SPECIAL_LAYER8_TOGGLE:
|
||||||
|
Layer_activate((key_index-SPECIAL_LAYER1_TOGGLE)/2, RIGHT_SIDE);
|
||||||
|
action++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // End of special keys
|
||||||
|
|
||||||
|
|
||||||
|
// Shortcut for clicks of Menu buttons.
|
||||||
|
// Disable all of them when an operation is in progress
|
||||||
|
if (Operation_stack_size==0)
|
||||||
|
{
|
||||||
|
// Some functions open windows that clear the Key variable,
|
||||||
|
// so we need to use a temporary replacement.
|
||||||
|
key_pressed = Key;
|
||||||
for (button_index=0;button_index<NB_BUTTONS;button_index++)
|
for (button_index=0;button_index<NB_BUTTONS;button_index++)
|
||||||
{
|
{
|
||||||
if (Is_shortcut(Key,0x100+button_index))
|
if (Is_shortcut(key_pressed,0x100+button_index))
|
||||||
{
|
{
|
||||||
shortcut_button=button_index;
|
Select_button(button_index,LEFT_SIDE);
|
||||||
clicked_button =LEFT_SIDE;
|
|
||||||
button_index=NB_BUTTONS;
|
|
||||||
}
|
|
||||||
else if (Is_shortcut(Key,0x200+button_index))
|
|
||||||
{
|
|
||||||
shortcut_button=button_index;
|
|
||||||
clicked_button =RIGHT_SIDE;
|
|
||||||
button_index=NB_BUTTONS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Après avoir scruté les boutons, si la recherche a été fructueuse,
|
|
||||||
// on lance le bouton.
|
|
||||||
if (shortcut_button!=-1)
|
|
||||||
{
|
|
||||||
Select_button(shortcut_button,clicked_button);
|
|
||||||
prev_button_number=-1;
|
prev_button_number=-1;
|
||||||
|
action++;
|
||||||
|
}
|
||||||
|
else if (Is_shortcut(key_pressed,0x200+button_index))
|
||||||
|
{
|
||||||
|
Select_button(button_index,RIGHT_SIDE);
|
||||||
|
prev_button_number=-1;
|
||||||
|
action++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si on a modifié un effet, il faut rafficher le bouton des effets en
|
// Si on a modifié un effet, il faut rafficher le bouton des effets en
|
||||||
// conséquence.
|
// conséquence.
|
||||||
if ((key_index>=SPECIAL_SHADE_MODE)
|
if (effect_modified)
|
||||||
&& (key_index<=SPECIAL_TILING_MENU))
|
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Draw_menu_button_frame(BUTTON_EFFECTS,
|
Draw_menu_button_frame(BUTTON_EFFECTS,
|
||||||
@ -1007,6 +1071,8 @@ void Main_handler(void)
|
|||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (action)
|
||||||
|
Key=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
56
graph.c
56
graph.c
@ -736,7 +736,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
current_limit_bottom =Min(Paintbrush_Y+1,Limit_bottom);
|
current_limit_bottom =Min(Paintbrush_Y+1,Limit_bottom);
|
||||||
*left_reached=Paintbrush_X;
|
*left_reached=Paintbrush_X;
|
||||||
*right_reached=Paintbrush_X+1;
|
*right_reached=Paintbrush_X+1;
|
||||||
Pixel_in_current_screen(Paintbrush_X,Paintbrush_Y,2,0);
|
Pixel_in_current_layer(Paintbrush_X,Paintbrush_Y,2);
|
||||||
|
|
||||||
while (changes_made)
|
while (changes_made)
|
||||||
{
|
{
|
||||||
@ -755,7 +755,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
{
|
{
|
||||||
// On cherche son début
|
// On cherche son début
|
||||||
while((start_x<=Limit_right) &&
|
while((start_x<=Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(start_x,line)!=1))
|
(Read_pixel_from_current_layer(start_x,line)!=1))
|
||||||
start_x++;
|
start_x++;
|
||||||
|
|
||||||
if (start_x<=Limit_right)
|
if (start_x<=Limit_right)
|
||||||
@ -763,7 +763,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
// Un segment de couleur 1 existe et commence à la position start_x.
|
// Un segment de couleur 1 existe et commence à la position start_x.
|
||||||
// On va donc en chercher la fin.
|
// On va donc en chercher la fin.
|
||||||
for (end_x=start_x+1;(end_x<=Limit_right) &&
|
for (end_x=start_x+1;(end_x<=Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(end_x,line)==1);end_x++);
|
(Read_pixel_from_current_layer(end_x,line)==1);end_x++);
|
||||||
|
|
||||||
// On sait qu'il existe un segment de couleur 1 qui commence en
|
// On sait qu'il existe un segment de couleur 1 qui commence en
|
||||||
// start_x et qui se termine en end_x-1.
|
// start_x et qui se termine en end_x-1.
|
||||||
@ -774,16 +774,16 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
can_propagate=(
|
can_propagate=(
|
||||||
// Test de la présence d'un point à gauche du segment
|
// Test de la présence d'un point à gauche du segment
|
||||||
((start_x>Limit_left) &&
|
((start_x>Limit_left) &&
|
||||||
(Read_pixel_from_current_screen(start_x-1,line)==2)) ||
|
(Read_pixel_from_current_layer(start_x-1,line)==2)) ||
|
||||||
// Test de la présence d'un point à droite du segment
|
// Test de la présence d'un point à droite du segment
|
||||||
((end_x-1<Limit_right) &&
|
((end_x-1<Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(end_x ,line)==2))
|
(Read_pixel_from_current_layer(end_x ,line)==2))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Test de la présence d'un point en haut du segment
|
// Test de la présence d'un point en haut du segment
|
||||||
if (!can_propagate && (line>Limit_top))
|
if (!can_propagate && (line>Limit_top))
|
||||||
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
||||||
if (Read_pixel_from_current_screen(x_pos,line-1)==2)
|
if (Read_pixel_from_current_layer(x_pos,line-1)==2)
|
||||||
{
|
{
|
||||||
can_propagate=1;
|
can_propagate=1;
|
||||||
break;
|
break;
|
||||||
@ -797,7 +797,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
*right_reached=end_x;
|
*right_reached=end_x;
|
||||||
// On remplit le segment de start_x à end_x-1.
|
// On remplit le segment de start_x à end_x-1.
|
||||||
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
||||||
Pixel_in_current_screen(x_pos,line,2,0);
|
Pixel_in_current_layer(x_pos,line,2);
|
||||||
// On vient d'effectuer des modifications.
|
// On vient d'effectuer des modifications.
|
||||||
changes_made=1;
|
changes_made=1;
|
||||||
line_is_modified=1;
|
line_is_modified=1;
|
||||||
@ -835,14 +835,14 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
{
|
{
|
||||||
// On cherche son début
|
// On cherche son début
|
||||||
for (;(start_x<=Limit_right) &&
|
for (;(start_x<=Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(start_x,line)!=1);start_x++);
|
(Read_pixel_from_current_layer(start_x,line)!=1);start_x++);
|
||||||
|
|
||||||
if (start_x<=Limit_right)
|
if (start_x<=Limit_right)
|
||||||
{
|
{
|
||||||
// Un segment de couleur 1 existe et commence à la position start_x.
|
// Un segment de couleur 1 existe et commence à la position start_x.
|
||||||
// On va donc en chercher la fin.
|
// On va donc en chercher la fin.
|
||||||
for (end_x=start_x+1;(end_x<=Limit_right) &&
|
for (end_x=start_x+1;(end_x<=Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(end_x,line)==1);end_x++);
|
(Read_pixel_from_current_layer(end_x,line)==1);end_x++);
|
||||||
|
|
||||||
// On sait qu'il existe un segment de couleur 1 qui commence en
|
// On sait qu'il existe un segment de couleur 1 qui commence en
|
||||||
// start_x et qui se termine en end_x-1.
|
// start_x et qui se termine en end_x-1.
|
||||||
@ -853,16 +853,16 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
can_propagate=(
|
can_propagate=(
|
||||||
// Test de la présence d'un point à gauche du segment
|
// Test de la présence d'un point à gauche du segment
|
||||||
((start_x>Limit_left) &&
|
((start_x>Limit_left) &&
|
||||||
(Read_pixel_from_current_screen(start_x-1,line)==2)) ||
|
(Read_pixel_from_current_layer(start_x-1,line)==2)) ||
|
||||||
// Test de la présence d'un point à droite du segment
|
// Test de la présence d'un point à droite du segment
|
||||||
((end_x-1<Limit_right) &&
|
((end_x-1<Limit_right) &&
|
||||||
(Read_pixel_from_current_screen(end_x ,line)==2))
|
(Read_pixel_from_current_layer(end_x ,line)==2))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Test de la présence d'un point en bas du segment
|
// Test de la présence d'un point en bas du segment
|
||||||
if (!can_propagate && (line<Limit_bottom))
|
if (!can_propagate && (line<Limit_bottom))
|
||||||
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
||||||
if (Read_pixel_from_current_screen(x_pos,line+1)==2)
|
if (Read_pixel_from_current_layer(x_pos,line+1)==2)
|
||||||
{
|
{
|
||||||
can_propagate=1;
|
can_propagate=1;
|
||||||
break;
|
break;
|
||||||
@ -876,7 +876,7 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
*right_reached=end_x;
|
*right_reached=end_x;
|
||||||
// On remplit le segment de start_x à end_x-1.
|
// On remplit le segment de start_x à end_x-1.
|
||||||
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
for (x_pos=start_x;x_pos<end_x;x_pos++)
|
||||||
Pixel_in_current_screen(x_pos,line,2,0);
|
Pixel_in_current_layer(x_pos,line,2);
|
||||||
// On vient d'effectuer des modifications.
|
// On vient d'effectuer des modifications.
|
||||||
changes_made=1;
|
changes_made=1;
|
||||||
line_is_modified=1;
|
line_is_modified=1;
|
||||||
@ -899,6 +899,10 @@ void Fill(short * top_reached , short * bottom_reached,
|
|||||||
(*right_reached)--;
|
(*right_reached)--;
|
||||||
} // end de la routine de remplissage "Fill"
|
} // end de la routine de remplissage "Fill"
|
||||||
|
|
||||||
|
byte Read_pixel_from_backup_layer(word x,word y)
|
||||||
|
{
|
||||||
|
return *((y)*Main_image_width+(x)+Main_backups->Pages->Next->Image[Main_current_layer]);
|
||||||
|
}
|
||||||
|
|
||||||
void Fill_general(byte fill_color)
|
void Fill_general(byte fill_color)
|
||||||
//
|
//
|
||||||
@ -940,7 +944,7 @@ void Fill_general(byte fill_color)
|
|||||||
|
|
||||||
// On va maintenant "épurer" la zone visible de l'image:
|
// On va maintenant "épurer" la zone visible de l'image:
|
||||||
memset(replace_table,0,256);
|
memset(replace_table,0,256);
|
||||||
replace_table[Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y)]=1;
|
replace_table[Read_pixel_from_backup_layer(Paintbrush_X,Paintbrush_Y)]=1;
|
||||||
Replace_colors_within_limits(replace_table);
|
Replace_colors_within_limits(replace_table);
|
||||||
|
|
||||||
// On fait maintenant un remplissage classique de la couleur 1 avec la 2
|
// On fait maintenant un remplissage classique de la couleur 1 avec la 2
|
||||||
@ -955,39 +959,39 @@ void Fill_general(byte fill_color)
|
|||||||
// Il va maintenant falloir qu'on "turn" ce gros caca "into" un truc qui
|
// Il va maintenant falloir qu'on "turn" ce gros caca "into" un truc qui
|
||||||
// ressemble un peu plus à ce à quoi l'utilisateur peut s'attendre.
|
// ressemble un peu plus à ce à quoi l'utilisateur peut s'attendre.
|
||||||
if (top_reached>Limit_top)
|
if (top_reached>Limit_top)
|
||||||
Copy_part_of_image_to_another(Screen_backup, // source
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer], // source
|
||||||
Limit_left,Limit_top, // Pos X et Y dans source
|
Limit_left,Limit_top, // Pos X et Y dans source
|
||||||
(Limit_right-Limit_left)+1, // width copie
|
(Limit_right-Limit_left)+1, // width copie
|
||||||
top_reached-Limit_top,// height copie
|
top_reached-Limit_top,// height copie
|
||||||
Main_image_width, // width de la source
|
Main_image_width, // width de la source
|
||||||
Main_screen, // Destination
|
Main_backups->Pages->Image[Main_current_layer], // Destination
|
||||||
Limit_left,Limit_top, // Pos X et Y destination
|
Limit_left,Limit_top, // Pos X et Y destination
|
||||||
Main_image_width); // width destination
|
Main_image_width); // width destination
|
||||||
if (bottom_reached<Limit_bottom)
|
if (bottom_reached<Limit_bottom)
|
||||||
Copy_part_of_image_to_another(Screen_backup,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer],
|
||||||
Limit_left,bottom_reached+1,
|
Limit_left,bottom_reached+1,
|
||||||
(Limit_right-Limit_left)+1,
|
(Limit_right-Limit_left)+1,
|
||||||
Limit_bottom-bottom_reached,
|
Limit_bottom-bottom_reached,
|
||||||
Main_image_width,Main_screen,
|
Main_image_width,Main_backups->Pages->Image[Main_current_layer],
|
||||||
Limit_left,bottom_reached+1,Main_image_width);
|
Limit_left,bottom_reached+1,Main_image_width);
|
||||||
if (left_reached>Limit_left)
|
if (left_reached>Limit_left)
|
||||||
Copy_part_of_image_to_another(Screen_backup,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer],
|
||||||
Limit_left,top_reached,
|
Limit_left,top_reached,
|
||||||
left_reached-Limit_left,
|
left_reached-Limit_left,
|
||||||
(bottom_reached-top_reached)+1,
|
(bottom_reached-top_reached)+1,
|
||||||
Main_image_width,Main_screen,
|
Main_image_width,Main_backups->Pages->Image[Main_current_layer],
|
||||||
Limit_left,top_reached,Main_image_width);
|
Limit_left,top_reached,Main_image_width);
|
||||||
if (right_reached<Limit_right)
|
if (right_reached<Limit_right)
|
||||||
Copy_part_of_image_to_another(Screen_backup,
|
Copy_part_of_image_to_another(Main_backups->Pages->Next->Image[Main_current_layer],
|
||||||
right_reached+1,top_reached,
|
right_reached+1,top_reached,
|
||||||
Limit_right-right_reached,
|
Limit_right-right_reached,
|
||||||
(bottom_reached-top_reached)+1,
|
(bottom_reached-top_reached)+1,
|
||||||
Main_image_width,Main_screen,
|
Main_image_width,Main_backups->Pages->Image[Main_current_layer],
|
||||||
right_reached+1,top_reached,Main_image_width);
|
right_reached+1,top_reached,Main_image_width);
|
||||||
|
|
||||||
for (y_pos=top_reached;y_pos<=bottom_reached;y_pos++)
|
for (y_pos=top_reached;y_pos<=bottom_reached;y_pos++)
|
||||||
for (x_pos=left_reached;x_pos<=right_reached;x_pos++)
|
for (x_pos=left_reached;x_pos<=right_reached;x_pos++)
|
||||||
if (Read_pixel_from_current_screen(x_pos,y_pos)==2)
|
if (Read_pixel_from_current_layer(x_pos,y_pos)==2)
|
||||||
{
|
{
|
||||||
// Si le pixel en cours de traitement a été touché par le Fill()
|
// Si le pixel en cours de traitement a été touché par le Fill()
|
||||||
// on se doit d'afficher le pixel modifié par la couleur de
|
// on se doit d'afficher le pixel modifié par la couleur de
|
||||||
@ -996,14 +1000,14 @@ void Fill_general(byte fill_color)
|
|||||||
// Ceci se fait en commençant par restaurer la couleur qu'il y avait
|
// Ceci se fait en commençant par restaurer la couleur qu'il y avait
|
||||||
// précédemment (c'est important pour que les effets ne s'emmèlent
|
// précédemment (c'est important pour que les effets ne s'emmèlent
|
||||||
// pas le pinceaux)
|
// pas le pinceaux)
|
||||||
Pixel_in_current_screen(x_pos,y_pos,Read_pixel_from_backup_screen(x_pos,y_pos),0);
|
Pixel_in_current_screen(x_pos,y_pos,Read_pixel_from_backup_layer(x_pos,y_pos),0);
|
||||||
|
|
||||||
// Enfin, on peut afficher le pixel, en le soumettant aux effets en
|
// Enfin, on peut afficher le pixel, en le soumettant aux effets en
|
||||||
// cours:
|
// cours:
|
||||||
Display_pixel(x_pos,y_pos,fill_color);
|
Display_pixel(x_pos,y_pos,fill_color);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Pixel_in_current_screen(x_pos,y_pos,Read_pixel_from_backup_screen(x_pos,y_pos),0);
|
Pixel_in_current_screen(x_pos,y_pos,Read_pixel_from_backup_layer(x_pos,y_pos),0);
|
||||||
|
|
||||||
FX_feedback_screen=old_fx_feedback_screen;
|
FX_feedback_screen=old_fx_feedback_screen;
|
||||||
|
|
||||||
@ -2555,7 +2559,7 @@ void Replace(byte New_color)
|
|||||||
if ((Paintbrush_X<Main_image_width)
|
if ((Paintbrush_X<Main_image_width)
|
||||||
&& (Paintbrush_Y<Main_image_height))
|
&& (Paintbrush_Y<Main_image_height))
|
||||||
{
|
{
|
||||||
old_color=Read_pixel_from_current_screen(Paintbrush_X,Paintbrush_Y);
|
old_color=Read_pixel_from_current_layer(Paintbrush_X,Paintbrush_Y);
|
||||||
if ( (old_color!=New_color)
|
if ( (old_color!=New_color)
|
||||||
&& ((!Stencil_mode) || (!Stencil[old_color])) )
|
&& ((!Stencil_mode) || (!Stencil[old_color])) )
|
||||||
{
|
{
|
||||||
|
|||||||
37
misc.c
37
misc.c
@ -247,6 +247,11 @@ void Pixel_in_current_screen (word x,word y,byte color,int with_preview)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pixel_in_current_layer(word x,word y, byte color)
|
||||||
|
{
|
||||||
|
*((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer])=color;
|
||||||
|
}
|
||||||
|
|
||||||
byte Read_pixel_from_current_layer(word x,word y)
|
byte Read_pixel_from_current_layer(word x,word y)
|
||||||
{
|
{
|
||||||
return *((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer]);
|
return *((y)*Main_image_width+(x)+Main_backups->Pages->Image[Main_current_layer]);
|
||||||
@ -254,12 +259,19 @@ byte Read_pixel_from_current_layer(word x,word y)
|
|||||||
|
|
||||||
void Replace_a_color(byte old_color, byte New_color)
|
void Replace_a_color(byte old_color, byte New_color)
|
||||||
{
|
{
|
||||||
byte* edi;
|
byte* pixel_on_layer;
|
||||||
|
byte* pixel_visible;
|
||||||
|
|
||||||
// pour chaque pixel :
|
// pour chaque pixel :
|
||||||
for(edi = Main_screen;edi < Main_screen + Main_image_height * Main_image_width;edi++)
|
pixel_visible=Main_screen;
|
||||||
if (*edi == old_color)
|
for(pixel_on_layer = Main_backups->Pages->Image[Main_current_layer];pixel_on_layer < Main_screen + Main_image_height * Main_image_width;pixel_on_layer++,pixel_visible++)
|
||||||
*edi = New_color;
|
{
|
||||||
|
if (*pixel_on_layer == old_color)
|
||||||
|
{
|
||||||
|
*pixel_on_layer = New_color;
|
||||||
|
*pixel_visible = New_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
Update_rect(0,0,0,0); // On peut TOUT a jour
|
Update_rect(0,0,0,0); // On peut TOUT a jour
|
||||||
// C'est pas un problème car il n'y a pas de preview
|
// C'est pas un problème car il n'y a pas de preview
|
||||||
}
|
}
|
||||||
@ -405,21 +417,18 @@ byte Effect_sieve(word x,word y)
|
|||||||
|
|
||||||
void Replace_colors_within_limits(byte * replace_table)
|
void Replace_colors_within_limits(byte * replace_table)
|
||||||
{
|
{
|
||||||
int line;
|
int y;
|
||||||
int counter;
|
int x;
|
||||||
byte* Adresse;
|
byte* pixel;
|
||||||
|
|
||||||
byte old;
|
|
||||||
|
|
||||||
// Pour chaque ligne :
|
// Pour chaque ligne :
|
||||||
for(line = Limit_top;line <= Limit_bottom; line++)
|
for(y = Limit_top;y <= Limit_bottom; y++)
|
||||||
{
|
{
|
||||||
// Pour chaque pixel sur la ligne :
|
// Pour chaque pixel sur la ligne :
|
||||||
for (counter = Limit_left;counter <= Limit_right;counter ++)
|
for (x = Limit_left;x <= Limit_right;x ++)
|
||||||
{
|
{
|
||||||
Adresse = Main_screen+line*Main_image_width+counter;
|
pixel = Main_backups->Pages->Image[Main_current_layer]+y*Main_image_width+x;
|
||||||
old=*Adresse;
|
*pixel = replace_table[*pixel];
|
||||||
*Adresse = replace_table[old];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
misc.h
1
misc.h
@ -44,6 +44,7 @@ byte Read_pixel_from_backup_screen (word x,word y);
|
|||||||
byte Read_pixel_from_feedback_screen (word x,word y);
|
byte Read_pixel_from_feedback_screen (word x,word y);
|
||||||
byte Read_pixel_from_brush (word x,word y);
|
byte Read_pixel_from_brush (word x,word y);
|
||||||
byte Read_pixel_from_current_layer(word x,word y);
|
byte Read_pixel_from_current_layer(word x,word y);
|
||||||
|
void Pixel_in_current_layer(word x,word y, byte color);
|
||||||
|
|
||||||
void Ellipse_compute_limites(short horizontal_radius,short vertical_radius);
|
void Ellipse_compute_limites(short horizontal_radius,short vertical_radius);
|
||||||
// Calcule les valeurs suivantes en fonction des deux paramètres:
|
// Calcule les valeurs suivantes en fonction des deux paramètres:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user