GrafX2 2.9.3227
The ultimate 256-color painting program
|
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <math.h>
#include "struct.h"
#include "global.h"
#include "errors.h"
#include "buttons.h"
#include "engine.h"
#include "misc.h"
#include "osdep.h"
#include "keyboard.h"
#include "screen.h"
#include "windows.h"
#include "palette.h"
#include "input.h"
#include "graph.h"
#include "pages.h"
Functions | |
word | Count_used_colors (dword *usage) |
Count used palette indexes in the whole picture Return the total number of different colors Fill in "usage" with the count for each color. More... | |
word | Count_used_colors_screen_area (dword *usage, word start_x, word start_y, word width, word height) |
Same as Count_used_colors, but use a block screen memory instead of picture data. More... | |
word | Count_used_colors_area (dword *usage, word start_x, word start_y, word width, word height) |
Same as Count_used_colors, but for a given rectangle in the picture only. More... | |
const T_Components * | Get_current_palette (void) |
void | Set_palette (T_Palette palette) |
void | Set_color (byte color, byte red, byte green, byte blue) |
void | Wait_end_of_click (void) |
void | Clear_current_image_with_stencil (byte color, byte *stencil) |
void | Clear_current_image (byte color) |
void | Init_chrono (dword delay) |
void | Pixel_in_brush (word x, word y, byte color) |
byte | Read_pixel_from_brush (word x, word y) |
void | Copy_part_of_image_to_another (byte *source, word source_x, word source_y, word width, word height, word source_width, byte *dest, word dest_x, word dest_y, word destination_width) |
byte | Read_pixel_from_spare_screen (word x, word y) |
void | Rotate_90_deg_lowlevel (byte *source, byte *dest, short width, short height) |
Rotate a pixel buffer by 90 degrees, clockwise. More... | |
void | Rotate_270_deg_lowlevel (byte *source, byte *dest, short width, short height) |
Rotate a pixel buffer by 90 degrees, counter-clockwise. More... | |
void | Remap_general_lowlevel (byte *conversion_table, byte *in_buffer, byte *out_buffer, short width, short height, short buffer_width) |
void | Copy_image_to_brush (short start_x, short start_y, short Brush_width, short Brush_height, word image_width) |
byte | Read_pixel_from_feedback_screen (word x, word y) |
dword | Round_div (dword numerator, dword divisor) |
byte | Effect_sieve (word x, word y) |
void | Replace_colors_within_limits (byte *replace_table) |
byte | Read_pixel_from_backup_screen (word x, word y) |
byte | Effect_interpolated_colorize (word x, word y, byte color) |
byte | Effect_additive_colorize (word x, word y, byte color) |
byte | Effect_substractive_colorize (word x, word y, byte color) |
byte | Effect_alpha_colorize (word x, word y, byte color) |
void | Check_timer (void) |
void | Flip_Y_lowlevel (byte *src, short width, short height) |
Inverts a pixel buffer, according to a horizontal axis. More... | |
void | Flip_X_lowlevel (byte *src, short width, short height) |
Inverts a pixel buffer, according to a vertical axis. More... | |
void | Rotate_180_deg_lowlevel (byte *src, short width, short height) |
Rotate a pixel buffer by 180 degrees. More... | |
void | Rescale (byte *src_buffer, short src_width, short src_height, byte *dst_buffer, short dst_width, short dst_height, short x_flipped, short y_flipped) |
Copies an image to another, rescaling it and optionally flipping it. More... | |
void | Scroll_picture (byte *main_src, byte *main_dest, short x_offset, short y_offset) |
void | Zoom_a_line (byte *original_line, byte *zoomed_line, word factor, word width) |
short | Round (float value) |
short | Round_div_max (short numerator, short divisor) |
int | Min (int a, int b) |
int | Max (int a, int b) |
double | Fround (double n, unsigned d) |
const char * | Mode_label (int mode) |
int | Convert_videomode_arg (const char *argument) |
Variables | |
static T_Palette | Current_palette |
Count used palette indexes in the whole picture Return the total number of different colors Fill in "usage" with the count for each color.
References T_Document::backups, T_Page::Image, T_Document::image_height, T_Document::image_width, Main, T_Page::Nb_layers, T_List_of_pages::Pages, and T_Image::Pixels.
Referenced by Button_Stats(), Convert_to_dhgr(), Convert_to_hgr(), Find_recog(), Get_colors_from_brush(), Load_image(), Save_CEL(), Save_KCF(), and Update_color_count().
word Count_used_colors_screen_area | ( | dword * | usage, |
word | start_x, | ||
word | start_y, | ||
word | width, | ||
word | height | ||
) |
Same as Count_used_colors, but use a block screen memory instead of picture data.
Used to count colors in the loading screen.
References Get_Screen_pixel().
Same as Count_used_colors, but for a given rectangle in the picture only.
Used bu the C64 block constraint checker.
References T_Document::image_width, Main, and Main_screen.
const T_Components * Get_current_palette | ( | void | ) |
References Current_palette.
Referenced by Error_function().
void Set_palette | ( | T_Palette | palette | ) |
References Current_palette, GFX2_SetPalette(), and Round_palette_component().
Referenced by Button_Constraint_menu(), Button_Gradients(), Button_Kill(), Button_Load_or_Save(), Button_Page(), Button_Palette(), Button_Redo(), Button_Secondary_palette(), Button_Skins(), Button_Undo(), Error_function(), Get_colors_from_brush(), Init_mode_video(), Load_image(), Load_picture(), Main_handler(), Open_window(), Save_picture(), and Spread_colors().
References Current_palette, and GFX2_SetPalette().
Referenced by Button_Skins().
void Wait_end_of_click | ( | void | ) |
References Get_input(), and Mouse_K.
Referenced by Button_Airbrush_menu(), Button_Gradients(), Button_Layer_menu(), Button_Load_or_Save(), Button_Message_initial(), Button_Palette(), Button_Resolution(), Centered_lines_12_7(), Curve_4_points_2_9(), Curve_finalize(), Distort_brush_1_0(), Fill_1_0(), Fill_2_0(), Filled_polyform_12_8(), Grad_circle_12_8(), Grad_ellipse_12_8(), Grad_rectangle_0_9(), K_line_12_7(), Magnifier_12_0(), Menu_shade(), Menu_tag_colors(), Polyfill_12_9(), Polyform_12_8(), Polygon_12_9(), Readline_ex_unicode(), Replace_1_0(), Replace_2_0(), Return_to_draw_mode(), Rotate_brush_12_0(), Select_button(), Stretch_brush_12_0(), and Window_help().
References T_Document::backups, T_Document::current_layer, T_Page::Image, T_Document::image_height, T_Document::image_width, Main, T_List_of_pages::Pages, and T_Image::Pixels.
Referenced by Button_Clear(), and Button_Clear_with_backcolor().
void Clear_current_image | ( | byte | color | ) |
References T_Document::backups, T_Document::current_layer, T_Page::Image, T_Document::image_height, T_Document::image_width, Main, T_List_of_pages::Pages, and T_Image::Pixels.
Referenced by Button_Clear(), and Button_Clear_with_backcolor().
void Init_chrono | ( | dword | delay | ) |
References GFX2_GetTicks(), Timer_delay, and Timer_start.
Referenced by Button_Load_or_Save().
References Brush, and Brush_width.
Referenced by Capture_brush_with_lasso(), Nibble_brush(), Outline_brush(), and Pixel_figure_in_brush().
References Brush, and Brush_width.
Referenced by Button_Sieve_menu(), Capture_brush_with_lasso(), Draw_paintbrush(), Effect_tiling(), and Stretch_brush_preview().
void Copy_part_of_image_to_another | ( | byte * | source, |
word | source_x, | ||
word | source_y, | ||
word | width, | ||
word | height, | ||
word | source_width, | ||
byte * | dest, | ||
word | dest_x, | ||
word | dest_y, | ||
word | destination_width | ||
) |
Referenced by Copy_image_only(), Draw_paintbrush(), Fill_general(), Nibble_brush(), Outline_brush(), Resize_image(), and Store_brush().
References T_Document::backups, T_Document::current_layer, T_Page::Image, T_Bitmap::Image, T_Document::image_height, T_Page::Image_mode, IMAGE_MODE_ANIMATION, T_Document::image_width, T_List_of_pages::Pages, T_Image::Pixels, Spare, T_Page::Transparent_color, and T_Document::visible_image.
Referenced by Display_pixel(), and Draw_paintbrush().
Rotate a pixel buffer by 90 degrees, clockwise.
source | Source pixel buffer. |
dest | Destination pixel buffer. |
width | Width of the original buffer (height of the destination one). |
height | Height of the original buffer (width of the destination one). |
Referenced by Button_Transform_menu(), and Rotate_90_deg().
Rotate a pixel buffer by 90 degrees, counter-clockwise.
source | Source pixel buffer. |
dest | Destination pixel buffer. |
width | Width of the original buffer (height of the destination one). |
height | Height of the original buffer (width of the destination one). |
Referenced by Button_Transform_menu().
void Copy_image_to_brush | ( | short | start_x, |
short | start_y, | ||
short | Brush_width, | ||
short | Brush_height, | ||
word | image_width | ||
) |
References T_Document::backups, Brush_height, Brush_original_pixels, Brush_width, T_Document::current_layer, T_Page::Image, Main, T_List_of_pages::Pages, and T_Image::Pixels.
Referenced by Capture_brush().
Referenced by Curve_4_points_0_5(), Effect_smooth(), and Reduce_palette().
References Sieve, Sieve_height, and Sieve_width.
Referenced by Display_pixel().
void Replace_colors_within_limits | ( | byte * | replace_table | ) |
References T_Document::backups, T_Document::current_layer, T_Page::Image, T_Document::image_width, Limit_bottom, Limit_left, Limit_right, Limit_top, Main, T_List_of_pages::Pages, and T_Image::Pixels.
Referenced by Fill_general().
References T_Document::image_width, Main, and Screen_backup.
References Best_color(), Factors_inv_table, Factors_table, Main, T_Document::palette, and Read_pixel_from_feedback_screen().
Referenced by Button_Colorize_mode(), and Transparency_set().
References Best_color(), Main, T_Document::palette, and Read_pixel_from_feedback_screen().
Referenced by Button_Colorize_mode(), and Transparency_set().
References Best_color(), Main, T_Document::palette, and Read_pixel_from_feedback_screen().
Referenced by Button_Colorize_mode(), and Transparency_set().
References Best_color(), Fore_color, Main, T_Document::palette, and Read_pixel_from_feedback_screen().
Referenced by Button_Colorize_mode(), Button_Text(), and Transparency_set().
void Check_timer | ( | void | ) |
References GFX2_GetTicks(), Timer_delay, Timer_start, and Timer_state.
Referenced by Button_Load_or_Save().
void Flip_Y_lowlevel | ( | byte * | src, |
short | width, | ||
short | height | ||
) |
Inverts a pixel buffer, according to a horizontal axis.
src | Pointer to the pixel buffer to process. |
width | Width of the buffer. |
height | Height of the buffer. |
Referenced by Button_Brush_FX(), Button_Transform_menu(), Main_handler(), and Rotate_180_deg_lowlevel().
void Flip_X_lowlevel | ( | byte * | src, |
short | width, | ||
short | height | ||
) |
Inverts a pixel buffer, according to a vertical axis.
src | Pointer to the pixel buffer to process. |
width | Width of the buffer. |
height | Height of the buffer. |
Referenced by Button_Brush_FX(), Button_Transform_menu(), Main_handler(), and Rotate_180_deg_lowlevel().
void Rotate_180_deg_lowlevel | ( | byte * | src, |
short | width, | ||
short | height | ||
) |
Rotate a pixel buffer by 180 degrees.
src | The pixel buffer (source and destination). |
width | Width of the buffer. |
height | Height of the buffer. |
References Flip_X_lowlevel(), and Flip_Y_lowlevel().
Referenced by Button_Brush_FX(), Button_Transform_menu(), and Main_handler().
void Rescale | ( | byte * | src_buffer, |
short | src_width, | ||
short | src_height, | ||
byte * | dst_buffer, | ||
short | dst_width, | ||
short | dst_height, | ||
short | x_flipped, | ||
short | y_flipped | ||
) |
Copies an image to another, rescaling it and optionally flipping it.
src_buffer | Original image (address of first byte) |
src_width | Original image's width in pixels |
src_height | Original image's height in pixels |
dst_buffer | Destination image (address of first byte) |
dst_width | Destination image's width in pixels |
dst_height | Destination image's height in pixels |
x_flipped | Boolean, true to flip the image horizontally |
y_flipped | Boolean, true to flip the image vertically |
Referenced by Button_Transform_menu(), Store_brush(), and Stretch_brush().
References T_Document::image_height, T_Document::image_width, Main, and Update_rect().
Referenced by Scroll_0_5(), and Scroll_12_5().
Referenced by Clear_brush_scaled_double(), Clear_brush_scaled_quad(), Clear_brush_scaled_simple(), Clear_brush_scaled_tall(), Clear_brush_scaled_tall2(), Clear_brush_scaled_tall3(), Clear_brush_scaled_triple(), Clear_brush_scaled_wide(), Clear_brush_scaled_wide2(), Display_brush_color_zoom_double(), Display_brush_color_zoom_quad(), Display_brush_color_zoom_simple(), Display_brush_color_zoom_tall(), Display_brush_color_zoom_tall2(), Display_brush_color_zoom_tall3(), Display_brush_color_zoom_triple(), Display_brush_color_zoom_wide(), Display_brush_color_zoom_wide2(), Display_brush_mono_zoom_double(), Display_brush_mono_zoom_quad(), Display_brush_mono_zoom_simple(), Display_brush_mono_zoom_tall(), Display_brush_mono_zoom_tall2(), Display_brush_mono_zoom_tall3(), Display_brush_mono_zoom_triple(), Display_brush_mono_zoom_wide(), Display_brush_mono_zoom_wide2(), Display_part_of_screen_scaled_double(), Display_part_of_screen_scaled_quad(), Display_part_of_screen_scaled_simple(), Display_part_of_screen_scaled_tall(), Display_part_of_screen_scaled_tall2(), Display_part_of_screen_scaled_tall3(), Display_part_of_screen_scaled_triple(), Display_part_of_screen_scaled_wide(), and Display_part_of_screen_scaled_wide2().
short Round | ( | float | value | ) |
short Round_div_max | ( | short | numerator, |
short | divisor | ||
) |
Referenced by Pre_load().
int Min | ( | int | a, |
int | b | ||
) |
Referenced by Button_Text(), Compute_quad_texture(), Copy_image_only(), Display_paintbrush_in_window(), Draw_curve_general(), Draw_preset_sieve_patterns(), Draw_quad_texture_preview(), Draw_xor_rect(), Fill(), Fill_general(), Flush_update(), Init_mode_video(), Layer_preview_on(), Resize_image(), Rotate_brush(), Rotate_brush_preview(), Store_paintbrush(), Stretch_brush_preview(), Update_part_of_screen(), and Window_redraw_list().
int Max | ( | int | a, |
int | b | ||
) |
double Fround | ( | double | n, |
unsigned | d | ||
) |
Referenced by Readline_ex_unicode().
const char * Mode_label | ( | int | mode | ) |
References mode, and Video_mode.
Referenced by Convert_videomode_arg(), Display_syntax(), and Save_INI().
int Convert_videomode_arg | ( | const char * | argument | ) |
References Mode_label(), Nb_video_modes, and Video_mode.
Referenced by Init_program(), and Load_INI().
|
static |
Referenced by Get_current_palette(), Set_color(), and Set_palette().