GrafX2 2.9.3227
The ultimate 256-color painting program
palette.h File Reference

Palette screen, and some palette-related high-level functions. More...

+ This graph shows which files directly or indirectly include this file:

Functions

void Button_Palette (int)
 Open the palette menu and handles everything inside it. More...
 
void Button_Secondary_palette (int)
 Open the secondary palette menu and handles it. More...
 
void Set_palette_RGB_scale (int)
 Choose the number of graduations for RGB components, from 2 to 256. More...
 
int Get_palette_RGB_scale (void)
 
void Set_palette_Gamma (int)
 Configure Gamma correction. More...
 
byte Round_palette_component (byte comp)
 Scale a component (R, G or B) according to the current RGB graduations. More...
 
int Encode_component (int comp)
 Turns a RGB component from 0-255 to 0-(RGB_scale-1) with Gamma correction. More...
 
void Set_nice_menu_colors (dword *color_usage, int not_picture)
 Adds 4 menu colors in the current palette. More...
 
void Set_clipboard_colors (int nb_colors, T_Components *colors)
 Put some colors in the clipboard. More...
 
int Get_clipboard_colors (T_Palette palette, byte start_color)
 Get some RGB colors from clipboard. More...
 
const T_ComponentsFavorite_GUI_color (byte color_index)
 Get the favorite color to use for GUI's black,dark,light or white. More...
 

Detailed Description

Palette screen, and some palette-related high-level functions.

Function Documentation

◆ Button_Palette()

void Button_Palette ( int  btn)

Open the palette menu and handles everything inside it.

References Add_encoded(), T_Components::B, Back_color, Backup_layers(), backup_palette, T_Dropdown_button::Bottom_up, BUTTON_COLORPICKER, BUTTON_HELP, BUTTON_PALETTE, BUTTON_UNDO, Close_window(), Color_count, Color_max, Component_unit(), Compute_optimal_menu_colors(), Config, CONTEXT_PALETTE, Decode_component(), Display_cursor(), Display_grad_block_in_window(), Display_menu(), Display_sliders(), Draw_all_palette_sliders(), Draw_thingumajig(), Dropdown_activate(), T_Dropdown_button::Dropdown_width, End_of_modification(), T_Dropdown_button::First_item, Fore_color, Format_component(), T_Components::G, Get_clipboard_colors(), Get_color_behind_window(), T_Dropdown_button::Height, Hide_cursor, HSL_to_RGB(), Input_sticky_control, INPUT_TYPE_HEXA, Is_shortcut(), Key, KEY_b, KEY_BACKSPACE, KEY_c, KEY_d, KEY_DELETE, KEY_e, KEY_ESC, KEY_f, KEY_g, KEY_h, KEY_i, KEY_KP_MINUS, KEY_KP_PLUS, KEY_l, KEY_m, KEY_n, KEY_NONE, KEY_RETURN, KEY_s, KEY_t, KEY_u, KEY_w, KEY_x, L1, L2, L3, L4, LAYER_ALL, LAYER_NONE, LEFT_SIDE, Load_picture(), Main, MC_Black, MC_Dark, MC_Light, MC_White, Menu_factor_Y, Menu_Y_before_window, Mouse_K, Mouse_X, Mouse_Y, NULL, Num2str, T_Dropdown_choice::Number, NUMERIC_B_X, NUMERIC_BOX_H, NUMERIC_BOX_W, NUMERIC_BOX_X, NUMERIC_BOX_Y, NUMERIC_G_X, NUMERIC_R_X, NUMERIC_Y, Open_window(), T_Document::palette, Palette_edit_alter_channel(), Palette_edit_select_range(), Palette_edit_step(), Palette_edit_undo_redo(), Palette_view_is_RGB, Perceptual_lightness(), T_Dropdown_button::Pos_X, T_Dropdown_button::Pos_Y, T_Scroller_button::Position, Print_counter(), Print_in_window(), Print_RGB_or_HSL(), Quit_is_required, T_Components::R, Read_pixel, Readline(), Reduce_palette(), Remap_image_highlevel(), Remap_screen_after_menu_colors_change(), Reposition_palette(), Requester_window(), RGB_scale, RGB_to_HSL(), RIGHT_SIDE, T_Config::Safety_colors, Save_picture(), Screen_width, Select_button(), Set_blue(), Set_clipboard_colors(), Set_green(), Set_HSL(), Set_nice_menu_colors(), Set_palette(), Set_red(), SHORTCUT_COPY, SHORTCUT_PASTE, SPECIAL_NEXT_BACKCOLOR, SPECIAL_NEXT_FORECOLOR, SPECIAL_PREVIOUS_BACKCOLOR, SPECIAL_PREVIOUS_FORECOLOR, Spread_colors(), Swap(), SWAP_BYTES, SWAP_DWORDS, Tag_color_range(), Tag_used_colors(), temp_palette, Unselect_button(), Update_color_count(), Update_rect(), Update_window_area, Wait_click_in_palette(), Wait_end_of_click(), Window_attribute2, Window_clicked_button(), Window_display_frame_mono(), Window_draw_normal_bouton(), Window_draw_palette_bouton(), Window_draw_slider(), Window_dropdown_add_item(), Window_dropdown_clear_items(), Window_height, Window_help(), Window_Histogram(), Window_palette_button_list, Window_pos_Y, Window_rectangle(), Window_set_dropdown_button(), Window_set_normal_button(), Window_set_palette_button(), Window_set_repeatable_button(), Window_set_scroller_button(), and working_palette.

Referenced by Button_Select_forecolor().

◆ Button_Secondary_palette()

◆ Set_palette_RGB_scale()

void Set_palette_RGB_scale ( int  scale)

Choose the number of graduations for RGB components, from 2 to 256.

References Component_unit(), and RGB_scale.

Referenced by Analyze_command_line(), Button_Constraint_menu(), and Button_Secondary_palette().

◆ Get_palette_RGB_scale()

int Get_palette_RGB_scale ( void  )

◆ Set_palette_Gamma()

void Set_palette_Gamma ( int  gamma)

Configure Gamma correction.

References Gamma.

Referenced by Analyze_command_line(), and Button_Constraint_menu().

◆ Round_palette_component()

byte Round_palette_component ( byte  comp)

Scale a component (R, G or B) according to the current RGB graduations.

Returns the resulting value, in the [0-255] range.

Scale a component (R, G or B) according to the current RGB graduations.

The result is also in the 0-255 range.

References Gamma, and RGB_scale.

Referenced by Compute_optimal_menu_colors(), Set_blue(), Set_green(), Set_nice_menu_colors(), Set_palette(), and Set_red().

◆ Encode_component()

int Encode_component ( int  comp)

Turns a RGB component from 0-255 to 0-(RGB_scale-1) with Gamma correction.

Turns a RGB component from 0-255 to 0-(RGB_scale-1) with Gamma correction.

References Color_max, and Gamma.

Referenced by Add_encoded(), Display_sliders(), Draw_all_palette_sliders(), Spread_colors(), and Status_print_palette_color().

◆ Set_nice_menu_colors()

void Set_nice_menu_colors ( dword color_usage,
int  not_picture 
)

Adds 4 menu colors in the current palette.

Parameters
color_usageAn up-to-date color usage table (byte[256]) (read only)
not_picture0 if the caller is the palette screen, 1 if it's a preview in the file selector.

References T_Components::B, Best_color_nonexcluded(), Display_cursor(), Favorite_GUI_color(), T_Components::G, Hide_cursor, Main, T_Document::palette, T_Components::R, Remap_image_highlevel(), Remap_zone_highlevel(), Round_palette_component(), Screen_height, and Screen_width.

Referenced by Button_Palette().

◆ Set_clipboard_colors()

void Set_clipboard_colors ( int  nb_colors,
T_Components colors 
)

Put some colors in the clipboard.

Parameters
nb_colorsNumber of colors to push
colorsFirst color of the input array

References Palette_clipboard, and Palette_clipboard_count.

Referenced by Button_Palette().

◆ Get_clipboard_colors()

int Get_clipboard_colors ( T_Palette  palette,
byte  start_color 
)

Get some RGB colors from clipboard.

Parameters
paletteTarget palette
start_colorIndex of first color to replace
Returns
Number of colors retrieved (0-256)

References Palette_clipboard, and Palette_clipboard_count.

Referenced by Button_Palette().

◆ Favorite_GUI_color()

const T_Components * Favorite_GUI_color ( byte  color_index)

Get the favorite color to use for GUI's black,dark,light or white.

References T_Components::B, T_Gui_skin::Color, T_Gui_skin::Default_palette, T_Components::G, Gfx, T_Components::R, and RGB_scale.

Referenced by Button_Constraint_menu(), Load_image(), and Set_nice_menu_colors().