GrafX2 2.9.3227
The ultimate 256-color painting program
|
Actions on the brush. More...
#include "struct.h"
Functions | |
void | Capture_brush (short start_x, short start_y, short end_x, short end_y, short clear) |
Gets the brush from the picture. More... | |
void | Rotate_90_deg (void) |
Rotates the brush to the right. More... | |
void | Stretch_brush (short x1, short y1, short x2, short y2) |
Stretch the brush to fit the given rectangle. More... | |
void | Stretch_brush_preview (short x1, short y1, short x2, short y2) |
Stretch the brush to fit the given rectangle. More... | |
void | Rotate_brush (float angle) |
Rotates the brush to the right from the given angle. More... | |
void | Rotate_brush_preview (float angle) |
Stretch the brush to fit the given rectangle. More... | |
void | Distort_brush_preview (short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4) |
Remap the brush palette to the nearest color in the picture one. More... | |
void | Distort_brush (short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4) |
Replace the brush by a distorted version of itself. More... | |
void | Remap_brush (void) |
void | Get_colors_from_brush (void) |
Get color indexes used by the brush. More... | |
void | Outline_brush (void) |
Outline the brush, add 1 foreground-colored pixel on the edges. More... | |
void | Nibble_brush (void) |
Nibble the brush, remove 1 pixel on the edges and make it transparent (ie filled with back color). More... | |
void | Capture_brush_with_lasso (int vertices, short *points, short clear) |
Get brush from picture according to a freehand form. More... | |
byte | Realloc_brush (word new_brush_width, word new_brush_height, byte *new_brush, byte **old_brush) |
Allocates memory for a brush size change. More... | |
void | Brush_set_palette (T_Palette *palette) |
Sets brush's original palette and color mapping. More... | |
void | Begin_brush_rotation (void) |
void | End_brush_rotation (void) |
Actions on the brush.
void Capture_brush | ( | short | start_x, |
short | start_y, | ||
short | end_x, | ||
short | end_y, | ||
short | clear | ||
) |
Gets the brush from the picture.
start_x | left edge coordinate in the picture |
start_y | upper edge coordinate in the picture |
end_x | right edge coordinate in the picture |
end_y | bottom edge coordinate in the picture |
clear | If 1, the area is also cleared from the picture. |
References Back_color, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_width, Copy_image_to_brush(), T_Document::image_height, T_Document::image_width, Main, NULL, T_Document::palette, Pixel_in_current_screen_with_preview, Realloc_brush(), Remap_brush(), Tilemap_draw(), T_Document::tilemap_mode, Tiling_offset_X, Tiling_offset_Y, and Update_part_of_screen().
Referenced by Brush_0_5(), and Init_program().
void Rotate_90_deg | ( | void | ) |
Rotates the brush to the right.
References Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_pixels, Brush_width, Error, NULL, Realloc_brush(), Remap_general_lowlevel(), and Rotate_90_deg_lowlevel().
Referenced by Button_Brush_FX(), and Main_handler().
void Stretch_brush | ( | short | x1, |
short | y1, | ||
short | x2, | ||
short | y2 | ||
) |
Stretch the brush to fit the given rectangle.
References Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_pixels, Brush_width, Error, NULL, Realloc_brush(), Remap_general_lowlevel(), and Rescale().
Referenced by Main_handler(), and Stretch_brush_2_7().
void Stretch_brush_preview | ( | short | x1, |
short | y1, | ||
short | x2, | ||
short | y2 | ||
) |
Stretch the brush to fit the given rectangle.
Uses fast approximation for the preview while drawing the rectangle on screen.
References Back_color, Brush_height, Brush_width, Limit_left, Limit_top, Limit_visible_bottom, Limit_visible_right, Max(), Min(), Pixel_preview, Read_pixel_from_brush(), and Update_part_of_screen().
Referenced by Stretch_brush_0_7(), and Stretch_brush_1_7().
void Rotate_brush | ( | float | angle | ) |
Rotates the brush to the right from the given angle.
References Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_pixels, Brush_rotate_buffer, Brush_rotate_height, Brush_rotate_width, Brush_width, Compute_quad_texture(), Error, Max(), Min(), NULL, Realloc_brush(), Remap_general_lowlevel(), and Transform_point().
Referenced by Rotate_brush_2_5().
void Rotate_brush_preview | ( | float | angle | ) |
Stretch the brush to fit the given rectangle.
Uses fast approximation for the preview while changing the angle.
References Brush_height, Brush_rotate_buffer, Brush_rotate_height, Brush_rotate_width, Brush_rotation_center_X, Brush_rotation_center_Y, Brush_width, Draw_quad_texture_preview(), Max(), Min(), Transform_point(), and Update_part_of_screen().
Referenced by Rotate_brush_0_5(), and Rotate_brush_1_5().
void Distort_brush_preview | ( | short | x1, |
short | y1, | ||
short | x2, | ||
short | y2, | ||
short | x3, | ||
short | y3, | ||
short | x4, | ||
short | y4 | ||
) |
Remap the brush palette to the nearest color in the picture one.
Used when switching to the spare page.
Distort the brush on the screen.
Remap the brush palette to the nearest color in the picture one.
References Brush, Brush_height, Brush_width, Distort_source, Draw_brush_linear_distort(), Pixel_figure_preview(), and Pixel_for_distort.
Referenced by Distort_brush_1_0(), and Distort_brush_1_9().
void Distort_brush | ( | short | x1, |
short | y1, | ||
short | x2, | ||
short | y2, | ||
short | x3, | ||
short | y3, | ||
short | x4, | ||
short | y4 | ||
) |
Replace the brush by a distorted version of itself.
Replace the brush by a distorted version of itself.
References Back_color, Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_pixels, Brush_width, Distort_buffer, Distort_buffer_width, Distort_source, Draw_brush_linear_distort(), Error, Max(), Max4(), Min4(), NULL, Pixel_for_distort, Pixel_in_distort_buffer(), Realloc_brush(), and Remap_general_lowlevel().
Referenced by Distort_brush_2_8().
void Remap_brush | ( | void | ) |
References Back_color, Best_color_perceptual_except(), Brush, Brush_colormap, Brush_height, Brush_original_palette, Brush_original_pixels, Brush_width, Main, T_Document::palette, and Remap_general_lowlevel().
Referenced by Button_Brush_FX(), Button_Sieve_menu(), Button_Text(), Capture_brush(), Get_colors_from_brush(), Load_image(), and Main_handler().
void Get_colors_from_brush | ( | void | ) |
Get color indexes used by the brush.
References Backup_layers(), Brush_height, Brush_original_palette, Brush_original_pixels, Brush_width, Compute_optimal_menu_colors(), Count_used_colors(), Display_all_screen(), Display_cursor(), Display_menu(), End_of_modification(), Hide_cursor, T_Document::image_is_modified, LAYER_NONE, Main, T_Document::palette, Remap_brush(), and Set_palette().
Referenced by Button_Brush_FX(), and Main_handler().
void Outline_brush | ( | void | ) |
Outline the brush, add 1 foreground-colored pixel on the edges.
Edges are detected considering the backcolor as transparent.
References Back_color, Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_original_pixels, Brush_width, Copy_part_of_image_to_another(), Error, Fore_color, Main, NULL, T_Document::palette, Pixel_in_brush(), Realloc_brush(), and SWAP_PBYTES.
Referenced by Button_Brush_FX(), and Main_handler().
void Nibble_brush | ( | void | ) |
Nibble the brush, remove 1 pixel on the edges and make it transparent (ie filled with back color).
Edges are detected considering the backcolor as transparent.
References Back_color, Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_original_pixels, Brush_width, Copy_part_of_image_to_another(), Error, Main, NULL, T_Document::palette, Pixel_in_brush(), Realloc_brush(), and SWAP_PBYTES.
Referenced by Button_Brush_FX(), and Main_handler().
void Capture_brush_with_lasso | ( | int | vertices, |
short * | points, | ||
short | clear | ||
) |
Get brush from picture according to a freehand form.
vertices | number of points in the freehand form |
points | array of points coordinates |
clear | If set to 1, the captured area is also cleared from the picture. |
References Back_color, Brush, Brush_colormap, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_original_palette, Brush_original_pixels, Brush_width, Draw_line_general(), Error, T_Document::image_height, T_Document::image_width, Limit_bottom, Limit_left, Limit_right, Limit_top, Main, NULL, T_Document::palette, Pixel_figure_in_brush(), Pixel_in_brush(), Pixel_in_current_screen_with_preview, Polyfill_general(), Read_pixel_from_brush(), Read_pixel_from_current_layer(), Realloc_brush(), Set_Pixel_figure(), Tilemap_draw(), T_Document::tilemap_mode, Tiling_offset_X, Tiling_offset_Y, Update_part_of_screen(), and xor_lut.
Referenced by Polybrush_12_8().
byte Realloc_brush | ( | word | new_brush_width, |
word | new_brush_height, | ||
byte * | new_brush, | ||
byte ** | old_brush | ||
) |
Allocates memory for a brush size change.
This function can return the old brush pixels which can then be used by the caller to fill the new brush. Data is not automatically copied or converted from the old brush to the new one here.
new_brush_width | new width of the brush |
new_brush_height | new height of the brush |
new_brush | Optionally, you can provide an already allocated new brush - otherwise, this function performs the allocation. |
old_brush | If the caller passes NULL, this function will free the old pixel data. If the caller provides the address of a (free) byte pointer, the function will make it point to the original pixel data, in this case it will be the caller's responsibility to free() it (after transferring pixels to Brush, usually). |
References Back_color, Brush, Brush_height, Brush_original_back_color, Brush_original_pixels, Brush_width, Error, MAX_PAINTBRUSH_SIZE, NULL, Smear_brush, Smear_brush_height, and Smear_brush_width.
Referenced by Button_Sieve_menu(), Button_Text(), Capture_brush(), Capture_brush_with_lasso(), Distort_brush(), Load_image(), Nibble_brush(), Outline_brush(), Restore_brush(), Rotate_90_deg(), Rotate_brush(), and Stretch_brush().
void Brush_set_palette | ( | T_Palette * | palette | ) |
Sets brush's original palette and color mapping.
void Begin_brush_rotation | ( | void | ) |
References Brush_height, Brush_original_pixels, Brush_rotate_buffer, Brush_rotate_height, Brush_rotate_width, Brush_width, and Scale2x().
Referenced by Start_operation_stack().
void End_brush_rotation | ( | void | ) |
References Brush_original_pixels, Brush_rotate_buffer, and NULL.
Referenced by Start_operation_stack().