GrafX2 2.9.3227
The ultimate 256-color painting program
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
#include "screen.h"
#include "gfx2surface.h"
#include "loadsave.h"
#include "io.h"
#include "gfx2log.h"
Functions | |
void | GFX2_Set_mode (int *width, int *height, int fullscreen) |
Sets the new screen/window dimensions. More... | |
byte | Get_Screen_pixel (int x, int y) |
void | Set_Screen_pixel (int x, int y, byte value) |
byte * | Get_Screen_pixel_ptr (int x, int y) |
void | Screen_FillRect (int x, int y, int w, int h, byte color) |
int | GFX2_SetPalette (const T_Components *colors, int firstcolor, int ncolors) |
void | Update_rect (short x, short y, unsigned short width, unsigned short height) |
void | Flush_update (void) |
void | Update_status_line (short char_pos, short width) |
void | Clear_border (byte color) |
Clears the parts of screen that are outside of the editing area. More... | |
void | Allow_drag_and_drop (int flag) |
Activates or desactivates file drag-dropping in program window. More... | |
void | Define_icon (void) |
Set application icon(s) More... | |
void | Set_mouse_position (void) |
set (system) mouse cursor position More... | |
int | GFX2_MessageBox (const char *text, const char *caption, unsigned int type) |
Display a modal message. More... | |
Variables | |
Display * | X11_display = NULL |
Window | X11_window = 0 |
static XImage * | X11_image = NULL |
static XTextProperty | windowName |
static GC | X11_gc = 0 |
static T_GFX2_Surface * | screen = NULL |
static T_GFX2_Surface * | icon = NULL |
volatile int | Allow_colorcycling = 0 |
void GFX2_Set_mode | ( | int * | width, |
int * | height, | ||
int | fullscreen | ||
) |
Sets the new screen/window dimensions.
width * 4
width * 4
References Config, GFX2_DEBUG, GFX2_ERROR, GFX2_Log(), GFX2_WARNING, T_GFX2_Surface::h, icon, New_GFX2_Surface(), NULL, T_GFX2_Surface::palette, Pixel_height, Pixel_width, T_GFX2_Surface::pixels, render_dstrect, render_scale_x, render_scale_y, screen, Screen_height, Screen_SDL, Screen_width, T_GFX2_Surface::w, T_Config::Window_pos_x, T_Config::Window_pos_y, windowName, X11_display, X11_gc, X11_image, and X11_window.
Referenced by Init_mode_video().
byte Get_Screen_pixel | ( | int | x, |
int | y | ||
) |
References GFX2_Log(), GFX2_WARNING, NULL, T_GFX2_Surface::pixels, screen, Screen_SDL, and T_GFX2_Surface::w.
Referenced by Count_used_colors_screen_area(), Horizontal_grid_line(), Horizontal_XOR_line_double(), Horizontal_XOR_line_quad(), Horizontal_XOR_line_tall2(), Horizontal_XOR_line_tall3(), Horizontal_XOR_line_triple(), Horizontal_XOR_line_wide2(), Read_pixel_double(), Read_pixel_quad(), Read_pixel_simple(), Read_pixel_tall(), Read_pixel_tall2(), Read_pixel_tall3(), Read_pixel_triple(), Read_pixel_wide(), Read_pixel_wide2(), Update_rect(), Vertical_grid_line(), Vertical_XOR_line_double(), Vertical_XOR_line_quad(), Vertical_XOR_line_simple(), Vertical_XOR_line_tall(), Vertical_XOR_line_tall2(), Vertical_XOR_line_tall3(), Vertical_XOR_line_triple(), Vertical_XOR_line_wide(), and Vertical_XOR_line_wide2().
void Set_Screen_pixel | ( | int | x, |
int | y, | ||
byte | value | ||
) |
References GFX2_Log(), GFX2_WARNING, NULL, T_GFX2_Surface::pixels, screen, Screen_SDL, and T_GFX2_Surface::w.
Referenced by Display_line_on_screen_double(), Horizontal_XOR_line_double(), Horizontal_XOR_line_quad(), Horizontal_XOR_line_tall2(), Horizontal_XOR_line_tall3(), Horizontal_XOR_line_triple(), Horizontal_XOR_line_wide2(), Pixel_double(), Pixel_quad(), Pixel_simple(), Pixel_tall(), Pixel_tall2(), Pixel_tall3(), Pixel_triple(), Pixel_wide(), Pixel_wide2(), Vertical_XOR_line_double(), Vertical_XOR_line_quad(), Vertical_XOR_line_simple(), Vertical_XOR_line_tall(), Vertical_XOR_line_tall2(), Vertical_XOR_line_tall3(), Vertical_XOR_line_triple(), Vertical_XOR_line_wide(), and Vertical_XOR_line_wide2().
byte * Get_Screen_pixel_ptr | ( | int | x, |
int | y | ||
) |
References GFX2_Log(), GFX2_WARNING, NULL, T_GFX2_Surface::pixels, screen, Screen_SDL, and T_GFX2_Surface::w.
Referenced by Clear_brush_double(), Clear_brush_quad(), Clear_brush_simple(), Clear_brush_tall(), Clear_brush_tall2(), Clear_brush_tall3(), Clear_brush_triple(), Clear_brush_wide(), Clear_brush_wide2(), Display_brush_color_double(), Display_brush_color_quad(), Display_brush_color_simple(), Display_brush_color_tall(), Display_brush_color_tall2(), Display_brush_color_tall3(), Display_brush_color_triple(), Display_brush_color_wide(), Display_brush_color_wide2(), Display_brush_color_zoom_double(), Display_brush_color_zoom_quad(), Display_brush_color_zoom_tall(), Display_brush_color_zoom_tall2(), Display_brush_color_zoom_tall3(), Display_brush_color_zoom_triple(), Display_brush_color_zoom_wide2(), Display_brush_double(), Display_brush_mono_double(), Display_brush_mono_quad(), Display_brush_mono_simple(), Display_brush_mono_tall(), Display_brush_mono_tall2(), Display_brush_mono_tall3(), Display_brush_mono_triple(), Display_brush_mono_wide(), Display_brush_mono_wide2(), Display_brush_quad(), Display_brush_simple(), Display_brush_tall(), Display_brush_tall2(), Display_brush_tall3(), Display_brush_triple(), Display_brush_wide(), Display_brush_wide2(), Display_line_on_screen_fast_double(), Display_line_on_screen_fast_quad(), Display_line_on_screen_fast_tall2(), Display_line_on_screen_fast_tall3(), Display_line_on_screen_fast_triple(), Display_line_on_screen_fast_wide(), Display_line_on_screen_fast_wide2(), Display_line_on_screen_quad(), Display_line_on_screen_simple(), Display_line_on_screen_tall(), Display_line_on_screen_tall2(), Display_line_on_screen_tall3(), Display_line_on_screen_triple(), Display_line_on_screen_wide(), Display_line_on_screen_wide2(), Display_part_of_screen_double(), Display_part_of_screen_quad(), Display_part_of_screen_simple(), Display_part_of_screen_tall(), Display_part_of_screen_tall2(), Display_part_of_screen_tall3(), Display_part_of_screen_triple(), Display_part_of_screen_wide(), Display_part_of_screen_wide2(), Display_transparent_line_on_screen_simple(), Display_transparent_line_on_screen_wide(), Display_transparent_mono_line_on_screen_double(), Display_transparent_mono_line_on_screen_quad(), Display_transparent_mono_line_on_screen_simple(), Display_transparent_mono_line_on_screen_tall2(), Display_transparent_mono_line_on_screen_tall3(), Display_transparent_mono_line_on_screen_triple(), Display_transparent_mono_line_on_screen_wide(), Display_transparent_mono_line_on_screen_wide2(), Horizontal_XOR_line_simple(), Horizontal_XOR_line_tall(), Horizontal_XOR_line_wide(), Read_line_screen_double(), Read_line_screen_quad(), Read_line_screen_simple(), Read_line_screen_tall(), Read_line_screen_tall2(), Read_line_screen_tall3(), Read_line_screen_triple(), Read_line_screen_wide(), Read_line_screen_wide2(), Remap_screen_double(), Remap_screen_quad(), Remap_screen_simple(), Remap_screen_tall(), Remap_screen_tall2(), Remap_screen_tall3(), Remap_screen_triple(), Remap_screen_wide(), Remap_screen_wide2(), Screen_FillRect(), and Update_rect().
void Screen_FillRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
byte | color | ||
) |
References Get_Screen_pixel_ptr(), T_GFX2_Surface::h, screen, Screen_SDL, and T_GFX2_Surface::w.
Referenced by Block_double(), Block_quad(), Block_simple(), Block_tall(), Block_tall2(), Block_tall3(), Block_triple(), Block_wide(), Block_wide2(), and Readline_ex_unicode().
int GFX2_SetPalette | ( | const T_Components * | colors, |
int | firstcolor, | ||
int | ncolors | ||
) |
References T_Components::B, T_Components::G, T_GFX2_Surface::h, NULL, T_GFX2_Surface::palette, T_Components::R, screen, Screen_SDL, Update_rect(), and T_GFX2_Surface::w.
Referenced by Color_cycling(), Set_color(), and Set_palette().
void Update_rect | ( | short | x, |
short | y, | ||
unsigned short | width, | ||
unsigned short | height | ||
) |
References Get_Screen_pixel(), Get_Screen_pixel_ptr(), T_GFX2_Surface::h, NULL, T_GFX2_Surface::palette, Pixel_height, Pixel_width, screen, T_GFX2_Surface::w, and X11_image.
Referenced by GFX2_SetPalette(), and Update_status_line().
void Flush_update | ( | void | ) |
References Max_X, Max_Y, Menu_factor_X, Menu_factor_Y, Menu_status_Y, Min(), Min_X, Min_Y, NULL, Pixel_height, Pixel_width, Screen_height, Screen_SDL, Screen_width, Status_line_dirty_begin, Status_line_dirty_end, and X11_display.
Referenced by Get_input(), Load_image(), Pixel_figure_permanent(), and Readline_ex_unicode().
void Update_status_line | ( | short | char_pos, |
short | width | ||
) |
References Menu_factor_X, Menu_factor_Y, Menu_status_Y, Pixel_height, Pixel_width, Screen_SDL, Status_line_dirty_begin, Status_line_dirty_end, and Update_rect().
Referenced by Print_coordinates(), and Print_in_menu().
void Clear_border | ( | byte | color | ) |
Clears the parts of screen that are outside of the editing area.
There is such area only if the screen mode is not a multiple of the pixel size, eg: 3x3 pixels in 1024x768 leaves 1 column on the right, 0 rows on bottom.
References Pixel_height, Pixel_width, Screen_height, Screen_SDL, and Screen_width.
Referenced by Init_mode_video(), Remap_menu_sprites(), and Remap_screen_after_menu_colors_change().
void Allow_drag_and_drop | ( | int | flag | ) |
Activates or desactivates file drag-dropping in program window.
References FALSE, GFX2_Get_Window_Handle(), GFX2_Log(), GFX2_WARNING, NULL, TRUE, X11_display, and X11_window.
Referenced by Close_window(), Init_program(), and Open_window().
void Define_icon | ( | void | ) |
Set application icon(s)
References Data_directory, Filepath_append_to_dir(), Get_SDL_pixel_hicolor(), GFX2_Get_Window_Handle(), GFX2_Log(), GFX2_WARNING, T_GFX2_Surface::h, icon, Load_surface(), NULL, TRUE, and T_GFX2_Surface::w.
Referenced by Init_program().
void Set_mouse_position | ( | void | ) |
set (system) mouse cursor position
References Mouse_X, Mouse_Y, NULL, Pixel_height, Pixel_width, render_scale_x, render_scale_y, X11_display, and X11_window.
Referenced by Init_mode_video(), and Move_cursor_with_constraints().
int GFX2_MessageBox | ( | const char * | text, |
const char * | caption, | ||
unsigned int | type | ||
) |
Display a modal message.
text | body of the modal message |
caption | title of the message |
type | one of GFX2_MB_INFO, GFX2_MB_ERROR, GFX2_MB_WARNING |
References GFX2_DEBUG, GFX2_ERROR, GFX2_Get_Window_Handle(), GFX2_Log(), NULL, X11_display, and X11_window.
Referenced by Display_syntax(), and Error_function().
Display* X11_display = NULL |
Window X11_window = 0 |
|
static |
Referenced by GFX2_Set_mode(), and Update_rect().
|
static |
Referenced by GFX2_Set_mode().
|
static |
Referenced by GFX2_Set_mode().
|
static |
Referenced by Get_Screen_pixel(), Get_Screen_pixel_ptr(), GFX2_Set_mode(), GFX2_SetPalette(), Load_GPX(), Screen_FillRect(), Set_Screen_pixel(), and Update_rect().
|
static |
volatile int Allow_colorcycling = 0 |
Referenced by Button_Gradients(), Close_window(), Color_cycling(), and Open_window().