GrafX2 2.9.3227
The ultimate 256-color painting program
|
Handles all the effects buttons and setup windows in the effects menu. More...
#include <stdlib.h>
#include <string.h>
#include "gfx2log.h"
#include "brush.h"
#include "buttons.h"
#include "engine.h"
#include "global.h"
#include "graph.h"
#include "help.h"
#include "input.h"
#include "misc.h"
#include "pages.h"
#include "readline.h"
#include "screen.h"
#include "struct.h"
#include "windows.h"
#include "tiles.h"
#include "oldies.h"
#include "palette.h"
#include "layers.h"
Macros | |
#define | MIN(a, b) ((a)<(b)?(a):(b)) |
Functions | |
void | Menu_tag_colors (char *window_title, byte *table, byte *mode, byte can_cancel, const char *help_section, word close_shortcut) |
Generic color tagging menu, for various effects. More... | |
static int | Check_block_constraints (enum IMAGE_MODES mode) |
Block Constraint check. More... | |
static void | Convert_to_hgr (void) |
convert a picture to the HGR mode More... | |
static void | Convert_to_dhgr (void) |
convert a picture to the DHGR mode More... | |
void | Button_Constraint_mode (void) |
Constaint enforcer/checker. More... | |
void | Button_Constraint_menu (void) |
void | Button_Tilemap_mode (void) |
void | Button_Tilemap_menu (void) |
void | Button_Stencil_mode (void) |
Callback for the Stencil button (in the FX window) left click. More... | |
void | Stencil_tag_color (byte color, byte tag_color) |
void | Stencil_update_color (byte color) |
void | Button_Stencil_menu (void) |
Callback for the Stencil button (in the FX window) right click. More... | |
void | Button_Mask_mode (void) |
Callback for the Mask button (in the FX window) left click. More... | |
void | Button_Mask_menu (void) |
Callback for the Mask button (in the FX window) right click. More... | |
void | Button_Snap_mode (void) |
Callback for the Grid button (in the FX window) left click. More... | |
void | Button_Grid_menu (void) |
Callback for the Grid button (in the FX window) right click. More... | |
void | Button_Show_grid (void) |
Callback to toggle the grid visible in the magnified view. More... | |
void | Button_Smooth_mode (void) |
Callback for the smooth button (in the FX window) left click. More... | |
void | Button_Smooth_menu (void) |
Display the menu for the smooth effect. More... | |
void | Button_Smear_mode (void) |
Toogles the smear mode. More... | |
void | Compute_colorize_table (void) |
Computes the tables used by the transparency/colorize mode. More... | |
void | Button_Colorize_mode (void) |
Callback for the Tranparency button (in the FX window) left click. More... | |
void | Button_Colorize_display_selection (int mode) |
void | Button_Colorize_menu (void) |
Callback for the Transparency button (in the FX window) right click. More... | |
void | Button_Tiling_mode (void) |
Callback for the Tiling button (in the FX window) left click. More... | |
void | Button_Tiling_menu (void) |
Callback for the Tiling button (in the FX window) right click. More... | |
void | Effects_off (void) |
Callback for the command that turns off all drawaing effects. More... | |
void | Button_Sieve_mode (void) |
Callback for the Sieve button (in the FX window) left click. More... | |
void | Draw_sieve_scaled (short origin_x, short origin_y) |
void | Draw_preset_sieve_patterns (void) |
void | Copy_preset_sieve (byte index) |
In the sieve window, copy one of the presets patterns to the current one. More... | |
void | Invert_trame (void) |
In the sieve window, swaps black and white in the current pattern. More... | |
void | Update_sieve_area (short x, short y) |
void | Button_Sieve_menu (void) |
Callback for the Sieve button (in the FX window) right click. More... | |
Variables | |
static const byte | Smooth_default_matrices [4][3][3] |
Handles all the effects buttons and setup windows in the effects menu.
#define MIN | ( | a, | |
b | |||
) | ((a)<(b)?(a):(b)) |
void Menu_tag_colors | ( | char * | window_title, |
byte * | table, | ||
byte * | mode, | ||
byte | can_cancel, | ||
const char * | help_section, | ||
word | close_shortcut | ||
) |
Generic color tagging menu, for various effects.
References BUTTON_EFFECTS, BUTTON_HELP, Close_window(), Display_cursor(), Get_color_behind_window(), Hide_cursor, Is_shortcut(), Key, KEY_BACKQUOTE, KEY_c, KEY_COMMA, KEY_ESC, KEY_i, KEY_RETURN, LEFT_SIDE, MC_Black, MC_Light, mode, Mouse_K, Mouse_X, Mouse_Y, Open_window(), Read_pixel, Stencil_tag_color(), Stencil_update_color(), Update_window_area, Wait_end_of_click(), Window_attribute2, Window_clicked_button(), Window_height, Window_help(), Window_set_normal_button(), Window_set_palette_button(), and Window_width.
Referenced by Button_Mask_menu(), Button_Secondary_palette(), Button_Stencil_menu(), Copy_some_colors(), and Main_handler().
|
static |
Block Constraint check.
This function count the number of colors in a block and reports errors by marking the pixel in color 17 in layer 2.
mode |
References Add_layer(), T_Document::backups, T_Document::current_layer, GFX2_INFO, GFX2_Log(), T_Document::image_height, IMAGE_MODE_C64HIRES, IMAGE_MODE_C64MULTI, IMAGE_MODE_GBC, IMAGE_MODE_MEGADRIVE, IMAGE_MODE_THOMSON, IMAGE_MODE_TMS9918G2, IMAGE_MODE_ZX, T_Document::image_width, Main, mode, T_Page::Nb_layers, T_List_of_pages::Pages, Pixel_in_layer(), and Read_pixel_from_layer().
Referenced by Button_Constraint_mode().
|
static |
convert a picture to the HGR mode
Recognize monochrome pictures. Color pictures should use the 8 first colors.
References Count_used_colors(), GFX2_DEBUG, GFX2_Log(), T_Document::image_height, T_Document::image_width, Main, Pixel_in_layer(), Read_pixel_from_layer(), and Update_color_hgr_pixel().
Referenced by Button_Constraint_mode().
|
static |
convert a picture to the DHGR mode
Recognize monochrome pictures.
References Count_used_colors(), GFX2_DEBUG, GFX2_Log(), T_Document::image_height, T_Document::image_width, Main, Pixel_in_layer(), Read_pixel_from_layer(), and Update_color_dhgr_pixel().
Referenced by Button_Constraint_mode().
void Button_Constraint_mode | ( | void | ) |
Constaint enforcer/checker.
A call toggles between constraint mode and Layered mode.
Setting the palette is done in Button_Constraint_menu (8-bit constraint window)
References Add_layer(), T_Document::backups, C64_pixels_to_FLI(), Check_block_constraints(), Convert_to_dhgr(), Convert_to_hgr(), GFX2_INFO, GFX2_Log(), T_Page::Image, T_Document::image_height, T_Page::Image_mode, IMAGE_MODE_ANIMATION, IMAGE_MODE_C64FLI, IMAGE_MODE_DHGR, IMAGE_MODE_EGX, IMAGE_MODE_HGR, IMAGE_MODE_LAYERED, IMAGE_MODE_MODE5, IMAGE_MODE_RASTER, IMAGE_MODE_TMS9918G2, T_Document::image_width, Main, T_Page::Nb_layers, T_List_of_pages::Pages, Pixel_in_layer(), T_Image::Pixels, Read_pixel_from_layer(), Selected_Constraint_Mode, Switch_layer_mode(), T_Page::Transparent_color, and Verbose_message().
Referenced by Button_Constraint_menu(), and Button_Effects().
void Button_Constraint_menu | ( | void | ) |
References Back_color, T_Document::backups, Button_Constraint_mode(), BUTTON_EFFECTS, BUTTON_HELP, C64_set_palette(), Check_menu_mode(), Close_window(), Compute_optimal_menu_colors(), Config, CPC_set_default_BASIC_palette(), CPC_set_HW_palette(), DHGR_set_palette(), Dialog_multiple_choice(), Display_all_screen(), Display_cursor(), Display_menu(), End_of_modification(), Favorite_GUI_color(), First_color_in_palette, Fore_color, HGR_set_palette(), Hide_cursor, T_Page::Image_mode, IMAGE_MODE_ANIMATION, IMAGE_MODE_C64FLI, IMAGE_MODE_C64HIRES, IMAGE_MODE_C64MULTI, IMAGE_MODE_DHGR, IMAGE_MODE_EGX, IMAGE_MODE_EGX2, IMAGE_MODE_GBC, IMAGE_MODE_HGR, IMAGE_MODE_MEGADRIVE, IMAGE_MODE_MODE5, IMAGE_MODE_RASTER, IMAGE_MODE_THOMSON, IMAGE_MODE_TMS9918G2, IMAGE_MODE_ZX, Is_shortcut(), Key, KEY_ESC, KEY_g, KEY_p, KEY_RETURN, KEY_s, label, LEFT_SIDE, MACHINE_MO5, MACHINE_MO6, MACHINE_TO7, MACHINE_TO8, Main, MC_Black, MC_Dark, MC_Light, mode, T_Config::MOTO_gamma, MOTO_set_MO5_palette(), MOTO_set_TO7_palette(), MSX_set_palette(), NULL, Open_window(), T_List_of_pages::Pages, T_Document::palette, Print_in_window(), Print_in_window_underscore(), Redraw_layered_image(), Remap_screen_after_menu_colors_change(), Resize_image(), RIGHT_SIDE, Selected_Constraint_Mode, Set_palette(), Set_palette_Gamma(), Set_palette_RGB_scale(), Show_grid, Snap_height, Snap_mode, Snap_offset_X, Snap_offset_Y, Snap_width, Update_window_area, Window_attribute2, Window_clicked_button(), Window_dropdown_add_item(), Window_height, Window_help(), Window_set_dropdown_button(), Window_set_normal_button(), Window_width, and ZX_Spectrum_set_palette().
Referenced by Button_Effects().
void Button_Tilemap_mode | ( | void | ) |
References Main, T_Document::tilemap_mode, and Tilemap_update().
Referenced by Button_Effects(), and Main_handler().
void Button_Tilemap_menu | ( | void | ) |
References BUTTON_EFFECTS, BUTTON_HELP, Close_window(), Config, Display_cursor(), Hide_cursor, Is_shortcut(), Key, KEY_ESC, KEY_RETURN, Main, MC_Black, MC_Dark, MC_Light, Open_window(), Print_in_window(), T_Config::Tilemap_allow_flipped_x, T_Config::Tilemap_allow_flipped_y, T_Document::tilemap_mode, T_Config::Tilemap_show_count, Tilemap_update(), Update_window_area, Window_clicked_button(), Window_display_frame(), Window_height, Window_help(), Window_set_normal_button(), and Window_width.
Referenced by Button_Effects(), and Main_handler().
void Button_Stencil_mode | ( | void | ) |
Callback for the Stencil button (in the FX window) left click.
Toogle stencil mode.
References Stencil_mode.
Referenced by Button_Effects(), and Main_handler().
References Window_palette_button_list, and Window_rectangle().
Referenced by Button_Airbrush_menu(), and Menu_tag_colors().
void Stencil_update_color | ( | byte | color | ) |
References Update_window_area, and Window_palette_button_list.
Referenced by Button_Airbrush_menu(), and Menu_tag_colors().
void Button_Stencil_menu | ( | void | ) |
Callback for the Stencil button (in the FX window) right click.
Displays the stencil setup menu.
References Menu_tag_colors(), SPECIAL_STENCIL_MENU, Stencil, and Stencil_mode.
Referenced by Button_Effects(), and Main_handler().
void Button_Mask_mode | ( | void | ) |
Callback for the Mask button (in the FX window) left click.
Toogles the mask mode/
References Mask_mode.
Referenced by Button_Effects(), and Main_handler().
void Button_Mask_menu | ( | void | ) |
Callback for the Mask button (in the FX window) right click.
Displays the mask setup menu.
References Mask_mode, Mask_table, Menu_tag_colors(), and SPECIAL_MASK_MENU.
Referenced by Button_Effects(), and Main_handler().
void Button_Snap_mode | ( | void | ) |
Callback for the Grid button (in the FX window) left click.
Toogle the grid.
References Compute_paintbrush_coordinates(), Display_cursor(), Hide_cursor, and Snap_mode.
Referenced by Button_Effects(), and Main_handler().
void Button_Grid_menu | ( | void | ) |
Callback for the Grid button (in the FX window) right click.
Displays the grid setup menu.
References BUTTON_EFFECTS, BUTTON_HELP, Close_window(), Disable_tilemap(), Display_cursor(), Hide_cursor, INPUT_TYPE_INTEGER, Is_shortcut(), Key, KEY_ESC, KEY_RETURN, MC_Black, MC_Dark, MC_Light, MIN, Num2str, Open_window(), Print_in_window(), Readline(), Snap_height, Snap_mode, Snap_offset_X, Snap_offset_Y, Snap_width, Spare, Tilemap_update(), Update_window_area, Window_clicked_button(), Window_height, Window_help(), Window_input_content(), Window_set_input_button(), Window_set_normal_button(), and Window_width.
Referenced by Button_Effects(), and Main_handler().
void Button_Show_grid | ( | void | ) |
Callback to toggle the grid visible in the magnified view.
References Display_all_screen(), Display_cursor(), Hide_cursor, and Show_grid.
Referenced by Main_handler().
void Button_Smooth_mode | ( | void | ) |
Callback for the smooth button (in the FX window) left click.
Callback for the Smooth button (in the FX window) right click.
Toogles smooth mode.
Displays the smooth setup menu.
References Colorize_mode, Effect_function, Effect_smooth(), No_effect(), Quick_shade_mode, Shade_mode, Smear_mode, Smooth_mode, and Tiling_mode.
Referenced by Button_Effects(), Button_Smooth_menu(), and Main_handler().
void Button_Smooth_menu | ( | void | ) |
Display the menu for the smooth effect.
References BUTTON_EFFECTS, BUTTON_HELP, Button_Smooth_mode(), Close_window(), Display_cursor(), Hide_cursor, INPUT_TYPE_INTEGER, Is_shortcut(), Key, KEY_ESC, KEY_NONE, KEY_RETURN, MC_Black, MC_Light, Num2str, Open_window(), Print_char_in_window(), Readline(), Smooth_default_matrices, Smooth_matrix, Smooth_mode, SPECIAL_SMOOTH_MENU, Update_window_area, Window_clicked_button(), Window_display_frame(), Window_height, Window_help(), Window_input_content(), Window_set_input_button(), Window_set_normal_button(), and Window_width.
Referenced by Button_Effects(), and Main_handler().
void Button_Smear_mode | ( | void | ) |
Toogles the smear mode.
References Colorize_mode, Effect_function, No_effect(), Quick_shade_mode, Shade_mode, Smear_mode, Smooth_mode, and Tiling_mode.
Referenced by Button_Effects(), and Main_handler().
void Compute_colorize_table | ( | void | ) |
Computes the tables used by the transparency/colorize mode.
These tables are used to match the drawing color*picture color to the color that is painted on screen.
References Colorize_opacity, Factors_inv_table, and Factors_table.
Referenced by Button_Colorize_menu(), Init_program(), and Transparency_set().
void Button_Colorize_mode | ( | void | ) |
Callback for the Tranparency button (in the FX window) left click.
Toogles transparent drawing mode.
References Colorize_current_mode, Colorize_mode, Effect_additive_colorize(), Effect_alpha_colorize(), Effect_function, Effect_interpolated_colorize(), Effect_substractive_colorize(), No_effect(), Quick_shade_mode, Shade_mode, Smooth_mode, and Tiling_mode.
Referenced by Button_Colorize_menu(), Button_Effects(), and Main_handler().
void Button_Colorize_display_selection | ( | int | mode | ) |
References MC_Black, MC_Light, mode, and Print_in_window().
Referenced by Button_Colorize_menu().
void Button_Colorize_menu | ( | void | ) |
Callback for the Transparency button (in the FX window) right click.
Displays the tranparency setup menu.
References Button_Colorize_display_selection(), Button_Colorize_mode(), BUTTON_EFFECTS, BUTTON_HELP, Close_window(), Colorize_current_mode, Colorize_mode, Colorize_opacity, Compute_colorize_table(), Display_cursor(), Hide_cursor, INPUT_TYPE_INTEGER, Is_shortcut(), Key, KEY_a, KEY_d, KEY_ESC, KEY_i, KEY_RETURN, KEY_s, MC_Dark, MC_Light, Num2str, Open_window(), Print_in_window(), Readline(), SPECIAL_COLORIZE_MENU, Update_window_area, Window_clicked_button(), Window_display_frame(), Window_height, Window_help(), Window_input_content(), Window_set_input_button(), Window_set_normal_button(), Window_special_button_list, and Window_width.
Referenced by Button_Effects(), and Main_handler().
void Button_Tiling_mode | ( | void | ) |
Callback for the Tiling button (in the FX window) left click.
Toogles tiling mode.
References Colorize_mode, Effect_function, Effect_tiling(), No_effect(), Quick_shade_mode, Shade_mode, Smear_mode, Smooth_mode, and Tiling_mode.
Referenced by Button_Effects(), Button_Tiling_menu(), and Main_handler().
void Button_Tiling_menu | ( | void | ) |
Callback for the Tiling button (in the FX window) right click.
Displays the tiling setup menu.
References Brush_height, Brush_width, BUTTON_EFFECTS, BUTTON_HELP, Button_Tiling_mode(), Close_window(), Display_cursor(), INPUT_TYPE_INTEGER, Is_shortcut(), Key, KEY_ESC, KEY_RETURN, MC_Dark, MC_Light, Num2str, Open_window(), Print_in_window(), Readline(), Tiling_mode, Tiling_offset_X, Tiling_offset_Y, Update_window_area, Window_clicked_button(), Window_height, Window_help(), Window_input_content(), Window_set_input_button(), Window_set_normal_button(), and Window_width.
Referenced by Button_Effects(), and Main_handler().
void Effects_off | ( | void | ) |
Callback for the command that turns off all drawaing effects.
References Colorize_mode, Effect_function, Main, Mask_mode, No_effect(), Quick_shade_mode, Shade_mode, Sieve_mode, Smear_mode, Smooth_mode, Snap_mode, Stencil_mode, T_Document::tilemap_mode, and Tiling_mode.
Referenced by Button_Effects(), and Main_handler().
void Button_Sieve_mode | ( | void | ) |
Callback for the Sieve button (in the FX window) left click.
Toogle sieve mode.
References Sieve_mode.
Referenced by Button_Effects(), Button_Sieve_menu(), and Main_handler().
void Draw_sieve_scaled | ( | short | origin_x, |
short | origin_y | ||
) |
References Block, MC_Black, MC_Dark, MC_Light, MC_White, Menu_factor_X, Menu_factor_Y, Pixel, Sieve, Sieve_height, Sieve_width, Update_rect(), Window_pos_X, Window_pos_Y, and Window_special_button_list.
Referenced by Button_Sieve_menu().
void Draw_preset_sieve_patterns | ( | void | ) |
References Block, Gfx, MC_Black, MC_White, Menu_factor_X, Menu_factor_Y, Min(), T_Gui_skin::Sieve_pattern, ToWinH, ToWinL, ToWinX, ToWinY, Update_rect(), Window_pos_X, Window_pos_Y, and Zoom().
Referenced by Button_Sieve_menu().
void Copy_preset_sieve | ( | byte | index | ) |
In the sieve window, copy one of the presets patterns to the current one.
index | Index of the pattern to copy |
References Gfx, Sieve, Sieve_height, T_Gui_skin::Sieve_pattern, and Sieve_width.
Referenced by Button_Sieve_menu(), and Init_program().
void Invert_trame | ( | void | ) |
In the sieve window, swaps black and white in the current pattern.
References Sieve, Sieve_height, and Sieve_width.
Referenced by Button_Sieve_menu(), and Main_handler().
void Update_sieve_area | ( | short | x, |
short | y | ||
) |
References Menu_factor_X, Menu_factor_Y, and Update_rect().
Referenced by Button_Sieve_menu().
void Button_Sieve_menu | ( | void | ) |
Callback for the Sieve button (in the FX window) right click.
Displays the sieve setup menu.
References Back_color, Block, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_original_pixels, Brush_width, BUTTON_EFFECTS, BUTTON_HELP, Button_Sieve_mode(), Change_paintbrush_shape(), Close_window(), Copy_preset_sieve(), Display_cursor(), Draw_preset_sieve_patterns(), Draw_sieve_scaled(), Fore_color, GFX2_MOD_SHIFT, Hide_cursor, Invert_trame(), Is_shortcut(), Key, KEY_c, KEY_DOWN, KEY_ESC, KEY_F1, KEY_g, KEY_i, KEY_INSERT, KEY_LEFT, KEY_RETURN, KEY_RIGHT, KEY_t, KEY_UP, LEFT_SIDE, Main, MC_Black, MC_Dark, MC_Light, MC_White, Menu_factor_X, Menu_factor_Y, Mouse_K, Mouse_X, Mouse_Y, NULL, Num2str, Open_window(), PAINTBRUSH_SHAPE_COLOR_BRUSH, T_Document::palette, T_Normal_button::Pos_X, T_Normal_button::Pos_Y, Print_in_window(), Read_pixel_from_brush(), Realloc_brush(), Remap_brush(), Sieve, Sieve_height, Sieve_mode, Sieve_width, Update_rect(), Update_sieve_area(), Update_window_area, Window_clicked_button(), Window_display_frame(), Window_display_frame_in(), Window_height, Window_help(), Window_pos_X, Window_pos_Y, Window_rectangle(), Window_set_normal_button(), Window_set_repeatable_button(), Window_set_special_button(), Window_special_button_list, and Window_width.
Referenced by Button_Effects(), and Main_handler().
|
static |
Referenced by Button_Smooth_menu().