Constraint mode is now switchable on/off in the effect screen.
I did some changes to the effect screen to make some space : instead of displaying an "on/off" label, we now keep the button pressed for active effects. There is no "constraint menu" yet, we should allow to select different constraints there (C64, MO5, spectrum, ...) to activate their respective enforcer and plug the right thing to the associated checker. This should eventually allow drawers to : * Load any single-layer picture * Select the mode they want to use (without enabling it) * Run the checker and get the result as a multilayer (with an error layer) * Then, once they feel enough issues are solved, switch to "enforcer" mode for further manual tweaking. Now we need a checker for CPC Mode5... :) git-svn-id: svn://pulkomandy.tk/GrafX2/branches/cpcmode5@1721 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
bdf8b6d694
commit
72e9892b53
@ -130,7 +130,7 @@ void Display_paintbrush(short x,short y,byte color,byte is_preview)
|
||||
if (is_preview && Mouse_K) // pas de curseur si on est en preview et
|
||||
return; // en train de cliquer
|
||||
|
||||
if (Main_current_layer < 4)
|
||||
if (Constraint_mode && Main_current_layer < 4)
|
||||
{
|
||||
if (is_preview)
|
||||
goto single_pixel;
|
||||
@ -2046,4 +2046,4 @@ void Brush_set_palette(T_Palette *palette)
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
@ -4465,23 +4465,27 @@ void Display_effect_state(short x, short y, char * label, byte state)
|
||||
|
||||
Print_in_window(x,y,label,(state)?MC_White:MC_Black,MC_Light);
|
||||
if (state)
|
||||
Print_in_window(x+56,y,":ON ",MC_White,MC_Light);
|
||||
Window_select_normal_button(x-23, y-5, 16, 16);
|
||||
else
|
||||
Print_in_window(x+56,y,":OFF",MC_Black,MC_Light);
|
||||
Window_unselect_normal_button(x-23, y-5, 16, 16);
|
||||
}
|
||||
|
||||
#define C2 92
|
||||
|
||||
void Display_effect_states(void)
|
||||
{
|
||||
Display_effect_state( 30, 24,"Shade" ,Shade_mode);
|
||||
Display_effect_state( 30, 43,"Q-shade",Quick_shade_mode);
|
||||
Display_effect_state( 30, 62,"Transp.",Colorize_mode);
|
||||
Display_effect_state( 30, 81,"Smooth" ,Smooth_mode);
|
||||
Display_effect_state( 30,100,"Smear" ,Smear_mode);
|
||||
Display_effect_state(176, 24,"Stencil",Stencil_mode);
|
||||
Display_effect_state(176, 43,"Mask" ,Mask_mode);
|
||||
Display_effect_state(176, 62,"Sieve" ,Sieve_mode);
|
||||
Display_effect_state(176, 81,"Grid" ,Snap_mode);
|
||||
Display_effect_state(176,100,"Tiling" ,Tiling_mode);
|
||||
Display_effect_state( 30, 24, "Shade" ,Shade_mode);
|
||||
Display_effect_state( 30, 43, "Q-shade",Quick_shade_mode);
|
||||
Display_effect_state( 30, 62, "Transp.",Colorize_mode);
|
||||
Display_effect_state( 30, 81, "Smooth" ,Smooth_mode);
|
||||
Display_effect_state( 30,100, "Smear" ,Smear_mode);
|
||||
Display_effect_state(C2+23, 24, "Stencil",Stencil_mode);
|
||||
Display_effect_state(C2+23, 43, "Mask" ,Mask_mode);
|
||||
Display_effect_state(C2+23, 62, "Sieve" ,Sieve_mode);
|
||||
Display_effect_state(C2+23, 81, "Grid" ,Snap_mode);
|
||||
Display_effect_state(C2+23,100, "Tiling" ,Tiling_mode);
|
||||
|
||||
Display_effect_state(177+23,24, "8 bit" ,Constraint_mode);
|
||||
}
|
||||
|
||||
|
||||
@ -4503,25 +4507,29 @@ void Button_Effects(void)
|
||||
Window_set_normal_button( 7, 57, 16,16,"",0,1,Config_Key[SPECIAL_COLORIZE_MODE][0]); // 3
|
||||
Window_set_normal_button( 7, 76, 16,16,"",0,1,Config_Key[SPECIAL_SMOOTH_MODE][0]); // 4
|
||||
Window_set_normal_button( 7, 95, 16,16,"",0,1,Config_Key[SPECIAL_SMEAR_MODE][0]); // 5
|
||||
Window_set_normal_button(153, 19, 16,16,"",0,1,Config_Key[SPECIAL_STENCIL_MODE][0]); // 6
|
||||
Window_set_normal_button(153, 38, 16,16,"",0,1,Config_Key[SPECIAL_MASK_MODE][0]); // 7
|
||||
Window_set_normal_button(153, 57, 16,16,"",0,1,Config_Key[SPECIAL_SIEVE_MODE][0]); // 8
|
||||
Window_set_normal_button(153, 76, 16,16,"",0,1,Config_Key[SPECIAL_GRID_MODE][0]); // 9
|
||||
Window_set_normal_button(153, 95, 16,16,"",0,1,Config_Key[SPECIAL_TILING_MODE][0]); // 10
|
||||
Window_set_normal_button(C2, 19, 16,16,"",0,1,Config_Key[SPECIAL_STENCIL_MODE][0]); // 6
|
||||
Window_set_normal_button(C2, 38, 16,16,"",0,1,Config_Key[SPECIAL_MASK_MODE][0]); // 7
|
||||
Window_set_normal_button(C2, 57, 16,16,"",0,1,Config_Key[SPECIAL_SIEVE_MODE][0]); // 8
|
||||
Window_set_normal_button(C2, 76, 16,16,"",0,1,Config_Key[SPECIAL_GRID_MODE][0]); // 9
|
||||
Window_set_normal_button(C2, 95, 16,16,"",0,1,Config_Key[SPECIAL_TILING_MODE][0]); // 10
|
||||
|
||||
Window_set_normal_button(195,131, 68,14,"Close",0,1,SDLK_RETURN); // 11
|
||||
Window_set_normal_button( 7,131, 68,14,"All off",0,1,SDLK_DELETE); // 12
|
||||
Window_set_normal_button( 83,131,104,14,"Feedback: ",1,1,SDLK_f); // 13
|
||||
|
||||
Window_set_normal_button(177, 19, 16,16,"",0,1,Config_Key[SPECIAL_FORMAT_CHECKER_MENU][0]); // 14
|
||||
|
||||
Display_feedback_state();
|
||||
Display_effect_sprite(0, 8,20);
|
||||
Display_effect_sprite(0, 8,39);
|
||||
Display_effect_sprite(1, 8,58);
|
||||
Display_effect_sprite(2, 8,77);
|
||||
Display_effect_sprite(8, 8,96);
|
||||
Display_effect_sprite(4,154,20);
|
||||
Display_effect_sprite(7,154,39);
|
||||
Display_effect_sprite(5,154,58);
|
||||
Display_effect_sprite(6,154,77);
|
||||
Display_effect_sprite(3,154,96);
|
||||
Display_effect_sprite(4,C2+1,20);
|
||||
Display_effect_sprite(7,C2+1,39);
|
||||
Display_effect_sprite(5,C2+1,58);
|
||||
Display_effect_sprite(6,C2+1,77);
|
||||
Display_effect_sprite(3,C2+1,96);
|
||||
Display_effect_states();
|
||||
|
||||
Print_in_window(12,117,"click: Left:Switch / Right:Edit",MC_Dark,MC_Light);
|
||||
@ -4658,7 +4666,7 @@ void Button_Effects(void)
|
||||
{
|
||||
Button_Stencil_mode();
|
||||
Hide_cursor();
|
||||
Display_effect_state(176,24,"Stencil",Stencil_mode);
|
||||
Display_effect_state(C2+23,24,"Stencil",Stencil_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
@ -4674,7 +4682,7 @@ void Button_Effects(void)
|
||||
{
|
||||
Button_Mask_mode();
|
||||
Hide_cursor();
|
||||
Display_effect_state(176,43,"Mask",Mask_mode);
|
||||
Display_effect_state(C2+23,43,"Mask",Mask_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
@ -4690,7 +4698,7 @@ void Button_Effects(void)
|
||||
{
|
||||
Button_Sieve_mode();
|
||||
Hide_cursor();
|
||||
Display_effect_state(176,62,"Sieve",Sieve_mode);
|
||||
Display_effect_state(C2+23,62,"Sieve",Sieve_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
@ -4706,7 +4714,7 @@ void Button_Effects(void)
|
||||
{
|
||||
Button_Snap_mode();
|
||||
Hide_cursor();
|
||||
Display_effect_state(176,81,"Grid",Snap_mode);
|
||||
Display_effect_state(C2+23,81,"Grid",Snap_mode);
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
@ -4749,6 +4757,22 @@ void Button_Effects(void)
|
||||
Display_feedback_state();
|
||||
Display_cursor();
|
||||
break;
|
||||
|
||||
|
||||
case 14: // Constraint checker/enforcer
|
||||
if (Window_attribute1==LEFT_SIDE)
|
||||
{
|
||||
Button_Constraint_mode();
|
||||
Hide_cursor();
|
||||
Display_effect_state(177+23,24, "8 bit" ,Constraint_mode);
|
||||
Display_cursor();
|
||||
} else {
|
||||
Close_window();
|
||||
Display_cursor();
|
||||
// Contraint checker/enforcer menu
|
||||
clicked_button = 11;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (clicked_button!=11);
|
||||
@ -4758,12 +4782,14 @@ void Button_Effects(void)
|
||||
else
|
||||
Hide_cursor();
|
||||
|
||||
if (!(Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode))
|
||||
if (!(Shade_mode||Quick_shade_mode||Colorize_mode||Smooth_mode||Tiling_mode||Smear_mode||Stencil_mode||Mask_mode||Sieve_mode||Snap_mode||Constraint_mode))
|
||||
Unselect_button(BUTTON_EFFECTS);
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
#undef C2
|
||||
|
||||
// Callback to display a font name in the list
|
||||
void Draw_one_font_name(word x, word y, word index, byte highlighted)
|
||||
{
|
||||
|
||||
@ -438,6 +438,9 @@ void Button_Tiling_mode(void);
|
||||
*/
|
||||
void Button_Tiling_menu(void);
|
||||
|
||||
void Button_Constraint_mode(void);
|
||||
void Button_Constraint_menu(void);
|
||||
|
||||
/*!
|
||||
Callback for the command that turns off all drawaing effects.
|
||||
*/
|
||||
|
||||
@ -162,6 +162,19 @@ void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_ca
|
||||
}
|
||||
|
||||
|
||||
// Constaint enforcer/checker ------------------------------------------------
|
||||
void Button_Constraint_mode(void)
|
||||
{
|
||||
Constraint_mode=!Constraint_mode;
|
||||
}
|
||||
|
||||
|
||||
void Button_Constraint_menu(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------- Stencil ----------------------------------
|
||||
void Button_Stencil_mode(void)
|
||||
{
|
||||
@ -547,7 +560,7 @@ void Button_Colorize_mode(void)
|
||||
switch(Colorize_current_mode)
|
||||
{
|
||||
case 0 :
|
||||
Effect_function=Effect_layer_copy;
|
||||
Effect_function=Effect_interpolated_colorize;
|
||||
break;
|
||||
case 1 :
|
||||
Effect_function=Effect_additive_colorize;
|
||||
|
||||
@ -726,6 +726,9 @@ GFX2_GLOBAL byte Mask_mode;
|
||||
/// Array of booleans. True if the indexed color is protected by the mask.
|
||||
GFX2_GLOBAL byte Mask_table[256];
|
||||
|
||||
// -- Constraint enforcer
|
||||
GFX2_GLOBAL byte Constraint_mode;
|
||||
|
||||
// -- Magnifier data
|
||||
|
||||
#ifdef GLOBAL_VARIABLES
|
||||
|
||||
19
src/graph.c
19
src/graph.c
@ -2977,7 +2977,24 @@ byte Read_pixel_from_current_screen (word x,word y)
|
||||
void Pixel_in_current_screen (word x,word y,byte color,int with_preview)
|
||||
{
|
||||
#ifndef NOLAYERS
|
||||
if ( Main_current_layer == 4)
|
||||
if (!Constraint_mode)
|
||||
{
|
||||
byte depth = *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width);
|
||||
*(Main_backups->Pages->Image[Main_current_layer] + x+y*Main_image_width)=color;
|
||||
if ( depth <= Main_current_layer)
|
||||
{
|
||||
if (color == Main_backups->Pages->Transparent_color) // transparent color
|
||||
// fetch pixel color from the topmost visible layer
|
||||
color=*(Main_backups->Pages->Image[depth] + x+y*Main_image_width);
|
||||
|
||||
*(x+y*Main_image_width+Main_screen)=color;
|
||||
|
||||
if (with_preview)
|
||||
Pixel_preview(x,y,color);
|
||||
}
|
||||
|
||||
}
|
||||
else if ( Main_current_layer == 4)
|
||||
{
|
||||
if (color<4)
|
||||
{
|
||||
|
||||
@ -199,7 +199,7 @@ void Redraw_layered_image(void)
|
||||
// Re-construct the image with the visible layers
|
||||
byte layer=0;
|
||||
// First layer
|
||||
if (Main_layers_visible & (1<<4))
|
||||
if (Constraint_mode && Main_layers_visible & (1<<4))
|
||||
{
|
||||
// The raster result layer is visible: start there
|
||||
// Copy it in Main_visible_image
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user