|
GrafX2 2.9.3227
The ultimate 256-color painting program
|
#include <string.h>#include <stdlib.h>#include <SDL.h>#include <SDL_endian.h>#include <SDL_image.h>#include <SDL_syswm.h>#include "global.h"#include "sdlscreen.h"#include "errors.h"#include "misc.h"#include "gfx2log.h"#include "io.h"
Include dependency graph for sdlscreen.c:Macros | |
| #define | UPDATE_METHOD_MULTI_RECTANGLE 1 |
| #define | UPDATE_METHOD_CUMULATED 2 |
| #define | UPDATE_METHOD_FULL_PAGE 3 |
| #define | UPDATE_METHOD UPDATE_METHOD_CUMULATED |
Functions | |
| 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) |
| void | GFX2_Set_mode (int *width, int *height, int fullscreen) |
| Sets the new screen/window dimensions. More... | |
| void | Flush_update (void) |
| void | Update_rect (short x, short y, unsigned short width, unsigned short height) |
| void | Update_status_line (short char_pos, short width) |
| byte * | Surface_to_bytefield (SDL_Surface *source, byte *dest) |
| Converts a SDL_Surface (indexed colors or RGB) into an array of bytes (indexed colors). More... | |
| SDL_Color | Color_to_SDL_color (byte index) |
| Gets the RGB 24-bit color currently associated with a palette index. More... | |
| byte | Get_SDL_pixel_8 (const SDL_Surface *bmp, int x, int y) |
| Reads a pixel in a 8-bit SDL surface. More... | |
| void | Set_SDL_pixel_8 (SDL_Surface *bmp, int x, int y, byte color) |
| Writes a pixel in a 8-bit SDL surface. More... | |
| dword | Get_SDL_pixel_hicolor (const SDL_Surface *bmp, int x, int y) |
| Reads a pixel in a multi-byte SDL surface. More... | |
| void | Get_SDL_Palette (const SDL_Palette *sdl_palette, T_Palette palette) |
| Convert a SDL Palette to a grafx2 palette. More... | |
| int | GFX2_SetPalette (const T_Components *colors, int firstcolor, int ncolors) |
| 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 | |
| static SDL_Surface * | Screen_SDL = NULL |
| volatile int | Allow_colorcycling =1 |
| static SDL_Rect | render_dstrect |
| short | Min_X =0 |
| short | Min_Y =0 |
| short | Max_X =10000 |
| short | Max_Y =10000 |
| short | Status_line_dirty_begin =0 |
| short | Status_line_dirty_end =0 |
| #define UPDATE_METHOD_MULTI_RECTANGLE 1 |
| #define UPDATE_METHOD_CUMULATED 2 |
| #define UPDATE_METHOD_FULL_PAGE 3 |
| #define UPDATE_METHOD UPDATE_METHOD_CUMULATED |
| 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 | ||
| ) |
| void GFX2_Set_mode | ( | int * | width, |
| int * | height, | ||
| int | fullscreen | ||
| ) |
Sets the new screen/window dimensions.
| void Flush_update | ( | void | ) |
| void Update_rect | ( | short | x, |
| short | y, | ||
| unsigned short | width, | ||
| unsigned short | height | ||
| ) |
Referenced by GFX2_SetPalette().
| void Update_status_line | ( | short | char_pos, |
| short | width | ||
| ) |
Converts a SDL_Surface (indexed colors or RGB) into an array of bytes (indexed colors).
If dest is NULL, it's allocated by malloc(). Otherwise, be sure to pass a buffer of the right dimensions.
References NULL.
Referenced by Render_text_TTF().
| SDL_Color Color_to_SDL_color | ( | byte | index | ) |
Gets the RGB 24-bit color currently associated with a palette index.
References Main, and T_Document::palette.
| byte Get_SDL_pixel_8 | ( | const SDL_Surface * | bmp, |
| int | x, | ||
| int | y | ||
| ) |
Reads a pixel in a 8-bit SDL surface.
| void Set_SDL_pixel_8 | ( | SDL_Surface * | bmp, |
| int | x, | ||
| int | y, | ||
| byte | color | ||
| ) |
Writes a pixel in a 8-bit SDL surface.
| dword Get_SDL_pixel_hicolor | ( | const SDL_Surface * | bmp, |
| int | x, | ||
| int | y | ||
| ) |
Reads a pixel in a multi-byte SDL surface.
Referenced by Define_icon().
| void Get_SDL_Palette | ( | const SDL_Palette * | sdl_palette, |
| T_Palette | palette | ||
| ) |
Convert a SDL Palette to a grafx2 palette.
Referenced by Render_text_TTF().
| int GFX2_SetPalette | ( | const T_Components * | colors, |
| int | firstcolor, | ||
| int | ncolors | ||
| ) |
| 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.
| void Allow_drag_and_drop | ( | int | flag | ) |
Activates or desactivates file drag-dropping in program window.
| void Define_icon | ( | void | ) |
Set application icon(s)
| void Set_mouse_position | ( | void | ) |
set (system) mouse cursor position
| 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 |
|
static |
| volatile int Allow_colorcycling =1 |
|
static |
Referenced by GFX2_Set_mode().
| short Min_X =0 |
Referenced by Flush_update(), and Update_rect().
| short Min_Y =0 |
Referenced by Flush_update(), Remap_window_backgrounds(), and Update_rect().
| short Max_X =10000 |
Referenced by Flush_update(), and Update_rect().
| short Max_Y =10000 |
Referenced by Flush_update(), Remap_window_backgrounds(), and Update_rect().
| short Status_line_dirty_begin =0 |
Referenced by Flush_update(), and Update_status_line().
| short Status_line_dirty_end =0 |
Referenced by Flush_update(), and Update_status_line().