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

Graphic functions that target the screen and/or image. More...

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

Macros

#define Pixel_in_current_screen(x, y, c)   Pixel_in_current_screen_with_opt_preview(x,y,c,0)
 Paint a single pixel in image only. More...
 
#define Pixel_in_current_screen_with_preview(x, y, c)   Pixel_in_current_screen_with_opt_preview(x,y,c,1)
 Paint a single pixel in image AND on screen. More...
 

Functions

void Shade_list_to_lookup_tables (word *list, short step, byte mode, byte *table_inc, byte *table_dec)
 
void Transform_point (short x, short y, float cos_a, float sin_a, short *rx, short *ry)
 
int Init_mode_video (int width, int height, int fullscreen, int pixel_ratio)
 
byte No_effect (word x, word y, byte color)
 
byte Effect_shade (word x, word y, byte color)
 
byte Effect_quick_shade (word x, word y, byte color)
 
byte Effect_tiling (word x, word y, byte color)
 
byte Effect_smooth (word x, word y, byte color)
 
byte Effect_layer_copy (word x, word y, byte color)
 
void Display_foreback (void)
 
void Display_pixel (word x, word y, byte color)
 
void Display_paintbrush (short x, short y, byte color)
 Display the paintbrush (preview : on screen only) More...
 
void Draw_paintbrush (short x, short y, byte color)
 Draw the paintbrush in the image buffer. More...
 
void Hide_paintbrush (short x, short y)
 
void Resize_image (word chosen_width, word chosen_height)
 
void Fill_general (byte fill_color)
 
void Replace (byte New_color)
 
void Pixel_figure_preview (word x_pos, word y_pos, byte color)
 
void Pixel_figure_preview_auto (word x_pos, word y_pos)
 
void Pixel_figure_preview_xor (word x_pos, word y_pos, byte color)
 
void Pixel_figure_preview_xorback (word x_pos, word y_pos, byte color)
 
void Pixel_figure_in_brush (word x_pos, word y_pos, byte color)
 
void Draw_empty_circle_general (short center_x, short center_y, long sqradius, byte color)
 
void Draw_empty_circle_permanent (short center_x, short center_y, long sqradius, byte color)
 
void Draw_empty_circle_preview (short center_x, short center_y, long sqradius, byte color)
 
void Hide_empty_circle_preview (short center_x, short center_y, long sqradius)
 
void Draw_filled_circle (short center_x, short center_y, long sqradius, byte color)
 
int Circle_squared_diameter (int diameter)
 
void Draw_empty_ellipse_permanent (short center_x, short center_y, short horizontal_radius, short vertical_radius, byte color)
 
void Draw_empty_ellipse_preview (short center_x, short center_y, short horizontal_radius, short vertical_radius, byte color)
 
void Hide_empty_ellipse_preview (short center_x, short center_y, short horizontal_radius, short vertical_radius)
 
void Draw_filled_ellipse (short center_x, short center_y, short horizontal_radius, short vertical_radius, byte color)
 
void Draw_empty_inscribed_ellipse_permanent (short x1, short y1, short x2, short y2, byte color)
 
void Draw_empty_inscribed_ellipse_preview (short x1, short y1, short x2, short y2, byte color)
 
void Hide_empty_inscribed_ellipse_preview (short x1, short y1, short x2, short y2)
 
void Draw_filled_inscribed_ellipse (short x1, short y1, short x2, short y2, byte color)
 
void Clamp_coordinates_regular_angle (short ax, short ay, short *bx, short *by)
 Alters bx and by so the (AX,AY)-(BX,BY) segment becomes either horizontal, vertical, 45degrees, or isometrical for pixelart (ie 2:1 ratio) More...
 
void Draw_line_general (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_line_permanent (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_line_preview (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_line_preview_xor (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_line_preview_xorback (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Hide_line_preview (short start_x, short start_y, short end_x, short end_y)
 
void Draw_empty_rectangle (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_filled_rectangle (short start_x, short start_y, short end_x, short end_y, byte color)
 
void Draw_curve_permanent (short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4, byte color)
 
void Draw_curve_preview (short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4, byte color)
 
void Hide_curve_preview (short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4, byte color)
 
void Airbrush (short clicked_button)
 
void Gradient_basic (long index, short x_pos, short y_pos)
 
void Gradient_dithered (long index, short x_pos, short y_pos)
 
void Gradient_extra_dithered (long index, short x_pos, short y_pos)
 
void Degrade_aleatoire (long index, short x_pos, short y_pos)
 
void Draw_grad_circle (short center_x, short center_y, long sqradius, short spot_x, short spot_y)
 
void Draw_grad_ellipse (short center_x, short center_y, short horizontal_radius, short vertical_radius, short spot_x, short spot_y)
 
void Draw_grad_inscribed_ellipse (short x1, short y1, short x2, short y2, short spot_x, short spot_y)
 
void Draw_grad_rectangle (short rax, short ray, short rbx, short rby, short vax, short vay, short vbx, short vby)
 
void Polyfill_general (int vertices, short *points, int color)
 
void Polyfill (int vertices, short *points, int color)
 
void Remap_spare (void)
 Remap the spare page according to the main page's palette. More...
 
void Set_Pixel_figure (Func_pixel func)
 All the figure-drawing functions work by calling this function for each pixel to draw. More...
 
void Update_part_of_screen (short x, short y, short width, short height)
 Update the picture on screen, for the area passed in parameters. More...
 
void Redraw_grid (short x, short y, unsigned short w, unsigned short h)
 
void Pixel_in_spare (word x, word y, byte color)
 
void Pixel_in_current_layer (word x, word y, byte color)
 
void Pixel_in_layer (int layer, word x, word y, byte color)
 put a pixel in a specific layer of Main Page More...
 
byte Read_pixel_from_current_screen (word x, word y)
 
byte Read_pixel_from_current_layer (word x, word y)
 
byte Read_pixel_from_layer (int layer, word x, word y)
 Read a pixel from a specific layer of Main Page. More...
 
void Update_pixel_renderer (void)
 Update the pixel functions according to the current Image_mode. More...
 
void Update_color_hgr_pixel (word x, word y, int preview)
 generate color pixels in layer 2 from the monochrome layer 1 More...
 
void Update_color_dhgr_pixel (word x, word y, int preview)
 Update the color layer of DHGR according to the monochrome layer. More...
 

Variables

Func_pixel_opt_preview Pixel_in_current_screen_with_opt_preview
 Paint a single pixel in image AND optionnaly on screen. More...
 

Detailed Description

Graphic functions that target the screen and/or image.

Macro Definition Documentation

◆ Pixel_in_current_screen

#define Pixel_in_current_screen (   x,
  y,
 
)    Pixel_in_current_screen_with_opt_preview(x,y,c,0)

Paint a single pixel in image only.

◆ Pixel_in_current_screen_with_preview

#define Pixel_in_current_screen_with_preview (   x,
  y,
 
)    Pixel_in_current_screen_with_opt_preview(x,y,c,1)

Paint a single pixel in image AND on screen.

Function Documentation

◆ Shade_list_to_lookup_tables()

void Shade_list_to_lookup_tables ( word list,
short  step,
byte  mode,
byte table_inc,
byte table_dec 
)

◆ Transform_point()

void Transform_point ( short  x,
short  y,
float  cos_a,
float  sin_a,
short *  rx,
short *  ry 
)

◆ Init_mode_video()

◆ No_effect()

◆ Effect_shade()

byte Effect_shade ( word  x,
word  y,
byte  color 
)

◆ Effect_quick_shade()

◆ Effect_tiling()

byte Effect_tiling ( word  x,
word  y,
byte  color 
)

◆ Effect_smooth()

◆ Effect_layer_copy()

byte Effect_layer_copy ( word  x,
word  y,
byte  color 
)

◆ Display_foreback()

◆ Display_pixel()

◆ Display_paintbrush()

◆ Draw_paintbrush()

void Draw_paintbrush ( short  x,
short  y,
byte  color 
)

Draw the paintbrush in the image buffer.

References Back_color, T_Document::backups, Brush_height, Brush_offset_X, Brush_offset_Y, Brush_width, Clear_brush, Clear_brush_scaled, Compute_clipped_dimensions(), Compute_clipped_dimensions_zoom(), Copy_part_of_image_to_another(), T_Document::current_layer, Display_pixel(), Effect_function, Horizontal_line_buffer, T_Document::image_height, T_Page::Image_mode, IMAGE_MODE_C64FLI, IMAGE_MODE_MODE5, IMAGE_MODE_RASTER, T_Document::image_width, T_Document::magnifier_factor, T_Document::magnifier_mode, T_Document::magnifier_offset_X, T_Document::magnifier_offset_Y, Main, Main_screen, Mask_mode, Mask_table, MAX_PAINTBRUSH_SIZE, Menu_Y, T_Document::offset_X, T_Document::offset_Y, T_List_of_pages::Pages, Paintbrush_height, Paintbrush_offset_X, Paintbrush_offset_Y, Paintbrush_shape, PAINTBRUSH_SHAPE_COLOR_BRUSH, PAINTBRUSH_SHAPE_MONO_BRUSH, PAINTBRUSH_SHAPE_NONE, PAINTBRUSH_SHAPE_POINT, Paintbrush_sprite, Paintbrush_width, Pixel_in_current_screen, Read_pixel_from_brush(), Read_pixel_from_current_layer(), Read_pixel_from_current_screen(), Read_pixel_from_spare_screen(), Shade_table, Shade_table_left, Smear_brush, Smear_brush_width, Smear_max_X, Smear_max_Y, Smear_min_X, Smear_min_Y, Smear_mode, Smear_start, Stencil, Stencil_mode, Update_part_of_screen(), and T_Document::X_zoom.

Referenced by Airbrush(), Centered_lines_12_7(), Freehand_mode1_1_0(), Freehand_mode1_2_0(), Freehand_mode2_1_0(), Freehand_mode2_1_2(), Freehand_mode2_2_0(), Freehand_mode2_2_2(), Freehand_mode3_1_0(), Freehand_Mode3_2_0(), K_line_0_6(), Line_0_5(), Pixel_figure_permanent(), and Polyform_12_0().

◆ Hide_paintbrush()

◆ Resize_image()

◆ Fill_general()

◆ Replace()

◆ Pixel_figure_preview()

◆ Pixel_figure_preview_auto()

◆ Pixel_figure_preview_xor()

◆ Pixel_figure_preview_xorback()

void Pixel_figure_preview_xorback ( word  x_pos,
word  y_pos,
byte  color 
)

◆ Pixel_figure_in_brush()

void Pixel_figure_in_brush ( word  x_pos,
word  y_pos,
byte  color 
)

◆ Draw_empty_circle_general()

void Draw_empty_circle_general ( short  center_x,
short  center_y,
long  sqradius,
byte  color 
)

◆ Draw_empty_circle_permanent()

void Draw_empty_circle_permanent ( short  center_x,
short  center_y,
long  sqradius,
byte  color 
)

◆ Draw_empty_circle_preview()

void Draw_empty_circle_preview ( short  center_x,
short  center_y,
long  sqradius,
byte  color 
)

◆ Hide_empty_circle_preview()

void Hide_empty_circle_preview ( short  center_x,
short  center_y,
long  sqradius 
)

◆ Draw_filled_circle()

void Draw_filled_circle ( short  center_x,
short  center_y,
long  sqradius,
byte  color 
)

◆ Circle_squared_diameter()

int Circle_squared_diameter ( int  diameter)

Referenced by Set_paintbrush_size().

◆ Draw_empty_ellipse_permanent()

void Draw_empty_ellipse_permanent ( short  center_x,
short  center_y,
short  horizontal_radius,
short  vertical_radius,
byte  color 
)

◆ Draw_empty_ellipse_preview()

void Draw_empty_ellipse_preview ( short  center_x,
short  center_y,
short  horizontal_radius,
short  vertical_radius,
byte  color 
)

◆ Hide_empty_ellipse_preview()

void Hide_empty_ellipse_preview ( short  center_x,
short  center_y,
short  horizontal_radius,
short  vertical_radius 
)

◆ Draw_filled_ellipse()

void Draw_filled_ellipse ( short  center_x,
short  center_y,
short  horizontal_radius,
short  vertical_radius,
byte  color 
)

◆ Draw_empty_inscribed_ellipse_permanent()

void Draw_empty_inscribed_ellipse_permanent ( short  x1,
short  y1,
short  x2,
short  y2,
byte  color 
)

◆ Draw_empty_inscribed_ellipse_preview()

void Draw_empty_inscribed_ellipse_preview ( short  x1,
short  y1,
short  x2,
short  y2,
byte  color 
)

◆ Hide_empty_inscribed_ellipse_preview()

void Hide_empty_inscribed_ellipse_preview ( short  x1,
short  y1,
short  x2,
short  y2 
)

◆ Draw_filled_inscribed_ellipse()

void Draw_filled_inscribed_ellipse ( short  x1,
short  y1,
short  x2,
short  y2,
byte  color 
)

◆ Clamp_coordinates_regular_angle()

void Clamp_coordinates_regular_angle ( short  ax,
short  ay,
short *  bx,
short *  by 
)

Alters bx and by so the (AX,AY)-(BX,BY) segment becomes either horizontal, vertical, 45degrees, or isometrical for pixelart (ie 2:1 ratio)

References M_PI.

Referenced by Grad_rectangle_12_9(), Line_12_5(), Rotate_brush_0_5(), and Rotate_brush_1_5().

◆ Draw_line_general()

void Draw_line_general ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Draw_line_permanent()

void Draw_line_permanent ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Draw_line_preview()

void Draw_line_preview ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Draw_line_preview_xor()

◆ Draw_line_preview_xorback()

void Draw_line_preview_xorback ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Hide_line_preview()

◆ Draw_empty_rectangle()

void Draw_empty_rectangle ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Draw_filled_rectangle()

void Draw_filled_rectangle ( short  start_x,
short  start_y,
short  end_x,
short  end_y,
byte  color 
)

◆ Draw_curve_permanent()

void Draw_curve_permanent ( short  x1,
short  y1,
short  x2,
short  y2,
short  x3,
short  y3,
short  x4,
short  y4,
byte  color 
)

◆ Draw_curve_preview()

void Draw_curve_preview ( short  x1,
short  y1,
short  x2,
short  y2,
short  x3,
short  y3,
short  x4,
short  y4,
byte  color 
)

◆ Hide_curve_preview()

void Hide_curve_preview ( short  x1,
short  y1,
short  x2,
short  y2,
short  x3,
short  y3,
short  x4,
short  y4,
byte  color 
)

◆ Airbrush()

◆ Gradient_basic()

void Gradient_basic ( long  index,
short  x_pos,
short  y_pos 
)

◆ Gradient_dithered()

void Gradient_dithered ( long  index,
short  x_pos,
short  y_pos 
)

◆ Gradient_extra_dithered()

void Gradient_extra_dithered ( long  index,
short  x_pos,
short  y_pos 
)

◆ Degrade_aleatoire()

void Degrade_aleatoire ( long  index,
short  x_pos,
short  y_pos 
)

◆ Draw_grad_circle()

void Draw_grad_circle ( short  center_x,
short  center_y,
long  sqradius,
short  spot_x,
short  spot_y 
)

◆ Draw_grad_ellipse()

void Draw_grad_ellipse ( short  center_x,
short  center_y,
short  horizontal_radius,
short  vertical_radius,
short  spot_x,
short  spot_y 
)

◆ Draw_grad_inscribed_ellipse()

void Draw_grad_inscribed_ellipse ( short  x1,
short  y1,
short  x2,
short  y2,
short  spot_x,
short  spot_y 
)

◆ Draw_grad_rectangle()

void Draw_grad_rectangle ( short  rax,
short  ray,
short  rbx,
short  rby,
short  vax,
short  vay,
short  vbx,
short  vby 
)

◆ Polyfill_general()

◆ Polyfill()

◆ Remap_spare()

◆ Set_Pixel_figure()

void Set_Pixel_figure ( Func_pixel  func)

All the figure-drawing functions work by calling this function for each pixel to draw.

Before calling these functions, you should assign Pixel_figure depending on what you where you want to draw:

References Pixel_figure.

Referenced by Capture_brush_with_lasso().

◆ Update_part_of_screen()

void Update_part_of_screen ( short  x,
short  y,
short  width,
short  height 
)

Update the picture on screen, for the area passed in parameters.

Takes into account the X/Y scrolling and zoom, and performs all safety checks so no updates will go outside the display area.

References T_Document::image_height, T_Document::image_width, T_Document::magnifier_factor, T_Document::magnifier_mode, T_Document::magnifier_offset_X, T_Document::magnifier_offset_Y, Main, Menu_factor_X, Menu_Y, Min(), T_Document::offset_X, T_Document::offset_Y, Redraw_grid(), Screen_width, T_Document::separator_position, SEPARATOR_WIDTH, Show_grid, Snap_height, Snap_width, T_Document::tilemap_mode, Update_rect(), and T_Document::X_zoom.

Referenced by Capture_brush(), Capture_brush_with_lasso(), Curve_34_points_1_0(), Curve_34_points_2_0(), Display_paintbrush(), Distort_brush_1_0(), Draw_curve_cross(), Draw_curve_general(), Draw_empty_circle_permanent(), Draw_empty_circle_preview(), Draw_empty_ellipse_general(), Draw_empty_rectangle(), Draw_filled_circle(), Draw_filled_ellipse(), Draw_filled_rectangle(), Draw_grad_circle(), Draw_grad_ellipse(), Draw_grad_inscribed_ellipse(), Draw_grad_rectangle(), Draw_inscribed_ellipse_general(), Draw_line_permanent(), Draw_line_preview(), Draw_line_preview_xor(), Draw_line_preview_xorback(), Draw_paintbrush(), Draw_stretch_spot(), Filled_polyform_12_0(), Grad_circle_12_0(), Grad_ellipse_12_0(), Hide_empty_circle_preview(), Hide_line_preview(), Hide_paintbrush(), Line_12_0(), Polyfill(), Polyfill_12_0(), Polyfill_general(), Polygon_12_0(), Rotate_brush_preview(), and Stretch_brush_preview().

◆ Redraw_grid()

◆ Pixel_in_spare()

void Pixel_in_spare ( word  x,
word  y,
byte  color 
)

◆ Pixel_in_current_layer()

◆ Pixel_in_layer()

◆ Read_pixel_from_current_screen()

◆ Read_pixel_from_current_layer()

◆ Read_pixel_from_layer()

◆ Update_pixel_renderer()

Variable Documentation

◆ Pixel_in_current_screen_with_opt_preview

Func_pixel_opt_preview Pixel_in_current_screen_with_opt_preview
extern

Paint a single pixel in image AND optionnaly on screen.

Referenced by Update_pixel_renderer().