29#ifdef SDL2_PLAIN_INCLUDE
34#include <SDL2/SDL_image.h>
35#include <SDL2/SDL_syswm.h>
36#include <SDL2/SDL_ttf.h>
336 pf->Bmask,
pf->Amask);
339 log_error(
_(
"Unable to create Sprite (Surface) of size "
340 "%d x %d %d Bits in format %d"),
436 switch (surf->format->BytesPerPixel) {
438 return *(
Uint8 *) ((
Uint8 *) surf->pixels +
y * surf->pitch +
x);
441 return *((
Uint16 *)surf->pixels +
y * surf->pitch /
sizeof(
Uint16) +
x);
447 (
Uint8 *) surf->pixels +
y * surf->pitch +
x * 3;
450 return ptr[0] << 16 | ptr[1] << 8 | ptr[2];
452 return ptr[0] | ptr[1] << 8 | ptr[2] << 16;
456 return *((
Uint32 *)surf->pixels +
y * surf->pitch /
sizeof(
Uint32) +
x);
474 switch (surf->format->BytesPerPixel) {
476 return *((
Uint8 *)surf->pixels);
479 return *((
Uint16 *)surf->pixels);
484 return (((
Uint8 *)surf->pixels)[0] << 16)
485 | (((
Uint8 *)surf->pixels)[1] << 8)
486 | ((
Uint8 *)surf->pixels)[2];
488 return ((
Uint8 *)surf->pixels)[0]
489 | (((
Uint8 *)surf->pixels)[1] << 8)
490 | (((
Uint8 *)surf->pixels)[2] << 16);
494 return *((
Uint32 *)surf->pixels);
564 0x0000FF00, 0x00FF0000,
565 0xFF000000, 0x000000FF);
567 0x0000FF00, 0x00FF0000,
568 0xFF000000, 0x000000FF);
571 0x00FF0000, 0x0000FF00,
572 0x000000FF, 0xFF000000);
574 0x00FF0000, 0x0000FF00,
575 0x000000FF, 0xFF000000);
701#define MASK565 0xf7de
702#define MASK555 0xfbde
705#define BLEND16_50( d, s , mask ) \
706 (((( s & mask ) + ( d & mask )) >> 1) + ( s & d & ( ~mask & 0xffff)))
708#define BLEND2x16_50( d, s , mask ) \
709 (((( s & (mask | mask << 16)) + ( d & ( mask | mask << 16 ))) >> 1) + \
710 ( s & d & ( ~(mask | mask << 16))))
731 end = surf->w * surf->h;
807 pixel = start + (surf->pitch >> 2);
851 pixel = start + (surf->pitch >> 2);
912 if (
ww <= 0 ||
hh <= 0) {
939 Uint16 minX, maxX, minY, maxY;
953 mask = surf->format->Amask;
961 switch (surf->format->BytesPerPixel) {
989 pixel = start + surf->pitch;
1017 pixel = start - surf->pitch;
1049 pixel = start + surf->pitch / 2;
1057 pixel = ((
Uint16 *)surf->pixels + (
y * surf->pitch / 2) +
x);
1077 pixel = start - surf->pitch / 2;
1115 pixel = start + surf->pitch / 3;
1148 pixel = start - surf->pitch / 3;
1180 pixel = start + surf->pitch / 4;
1188 pixel = ((
Uint32 *)surf->pixels + (
y * surf->pitch / 4) +
x);
1208 pixel = start - surf->pitch / 4;
1218 rect->w = maxX - minX + 1;
1219 rect->h = maxY - minY + 1;
1314 src->format->Rmask, src->format->Gmask,
1315 src->format->Bmask, src->format->Amask);
1355 SDL_Rect tmp, dst = { .x = left, .y = top, .w = 0, .h = 0 };
1386 int w = (
xr -
xl) + 1;
1387 int h = (
yb -
yt) + 1;
1409 for (
i = 0;
i <
l;
i++) {
1414 |= (
pcolor->a <<
spr->psurface->format->Ashift);
1417 for (
i = 0;
i <
l;
i++) {
1422 |= (
pcolor->a <<
spr->psurface->format->Ashift);
SDL_Surface * zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth)
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
struct canvas int int struct sprite int int int int height
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
struct canvas int int struct sprite int int int width
bool is_view_supported(enum ts_type type)
void tileset_type_set(enum ts_type type)
void free_sprite(struct sprite *s)
struct sprite * create_sprite(int width, int height, struct color *pcolor)
SDL_Surface * resize_surface(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth)
bool set_video_mode(unsigned width, unsigned height, unsigned flags_in)
Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y)
int main_window_width(void)
void layer_rect_to_screen_rect(struct gui_layer *gui_layer, SDL_Rect *dest_rect)
SDL_Surface * load_surf(const char *fname)
SDL_Surface * create_surf_with_format(SDL_PixelFormat *pf, int width, int height, Uint32 flags)
void update_main_screen(void)
void remove_gui_layer(struct gui_layer *gui_layer)
SDL_Surface * create_filled_surface(Uint16 w, Uint16 h, Uint32 flags, SDL_Color *pcolor)
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
void gui_layer_destroy(struct gui_layer **gui_layer)
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
SDL_Surface * copy_surface(SDL_Surface *src)
SDL_Surface * mask_surface(SDL_Surface *src, SDL_Surface *mask, int mask_offset_x, int mask_offset_y)
struct gui_layer * gui_layer_new(int x, int y, SDL_Surface *surface)
SDL_Surface * crop_visible_part_from_surface(SDL_Surface *psrc)
SDL_Surface * crop_rect_from_surface(SDL_Surface *psource, SDL_Rect *prect)
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
struct gui_layer * get_gui_layer(SDL_Surface *surface)
bool is_in_rect_area(int x, int y, const SDL_Rect *rect)
int screen_blit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Rect *dstrect, unsigned char alpha_mod)
struct sdl2_data main_data
static SDL_Surface * main_surface
int blit_entire_src(SDL_Surface *psrc, SDL_Surface *pdest, Sint16 dest_x, Sint16 dest_y)
Uint32 get_first_pixel(SDL_Surface *surf)
SDL_Surface * convert_surf(SDL_Surface *surf_in)
SDL_Surface * create_surf(int width, int height, Uint32 flags)
void get_smaller_surface_rect(SDL_Surface *surf, SDL_Rect *rect)
struct gui_layer * add_gui_layer(int width, int height)
int clear_surface(SDL_Surface *surf, SDL_Rect *dstrect)
bool correct_rect_region(SDL_Rect *prect)
void screen_rect_to_layer_rect(struct gui_layer *gui_layer, SDL_Rect *dest_rect)
static int __FillRectAlpha8888_32bit(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
static void free_surfaces(void)
bool create_surfaces(int width, int height)
int main_window_height(void)
SDL_Surface * resize_surface_box(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth, bool scale_up, bool absolute_dimensions)
#define unlock_surf(surf)
#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, double_pixel_copy_increment, width)
#define DUFFS_LOOP8(pixel_copy_increment, width)
#define DUFFS_LOOP4(pixel_copy_increment, width)
#define GUI_SDL_OPTION(optname)
#define fc_assert(condition)
#define log_fatal(message,...)
#define log_error(message,...)
#define fc_calloc(n, esz)
#define fc_realloc(ptr, sz)
struct sprite int int int int struct sprite * mask
struct sprite int int int int struct sprite int mask_offset_x
struct sprite int int int int struct sprite int int mask_offset_y
static bool is_bigendian(void)