29#ifdef SDL2_PLAIN_INCLUDE
33#include <SDL2/SDL_image.h>
34#include <SDL2/SDL_ttf.h>
334 pf->Bmask,
pf->Amask);
337 log_error(
_(
"Unable to create Sprite (Surface) of size "
338 "%d x %d %d Bits in format %d"),
434 switch (surf->format->BytesPerPixel) {
436 return *(
Uint8 *) ((
Uint8 *) surf->pixels +
y * surf->pitch +
x);
439 return *((
Uint16 *)surf->pixels +
y * surf->pitch /
sizeof(
Uint16) +
x);
445 (
Uint8 *) surf->pixels +
y * surf->pitch +
x * 3;
448 return ptr[0] << 16 | ptr[1] << 8 | ptr[2];
450 return ptr[0] | ptr[1] << 8 | ptr[2] << 16;
454 return *((
Uint32 *)surf->pixels +
y * surf->pitch /
sizeof(
Uint32) +
x);
472 switch (surf->format->BytesPerPixel) {
474 return *((
Uint8 *)surf->pixels);
477 return *((
Uint16 *)surf->pixels);
482 return (((
Uint8 *)surf->pixels)[0] << 16)
483 | (((
Uint8 *)surf->pixels)[1] << 8)
484 | ((
Uint8 *)surf->pixels)[2];
486 return ((
Uint8 *)surf->pixels)[0]
487 | (((
Uint8 *)surf->pixels)[1] << 8)
488 | (((
Uint8 *)surf->pixels)[2] << 16);
492 return *((
Uint32 *)surf->pixels);
562 0x0000FF00, 0x00FF0000,
563 0xFF000000, 0x000000FF);
565 0x0000FF00, 0x00FF0000,
566 0xFF000000, 0x000000FF);
569 0x00FF0000, 0x0000FF00,
570 0x000000FF, 0xFF000000);
572 0x00FF0000, 0x0000FF00,
573 0x000000FF, 0xFF000000);
699#define MASK565 0xf7de
700#define MASK555 0xfbde
703#define BLEND16_50( d, s , mask ) \
704 (((( s & mask ) + ( d & mask )) >> 1) + ( s & d & ( ~mask & 0xffff)))
706#define BLEND2x16_50( d, s , mask ) \
707 (((( s & (mask | mask << 16)) + ( d & ( mask | mask << 16 ))) >> 1) + \
708 ( s & d & ( ~(mask | mask << 16))))
729 end = surf->w * surf->h;
805 pixel = start + (surf->pitch >> 2);
849 pixel = start + (surf->pitch >> 2);
910 if (
ww <= 0 ||
hh <= 0) {
937 Uint16 minX, maxX, minY, maxY;
951 mask = surf->format->Amask;
959 switch (surf->format->BytesPerPixel) {
987 pixel = start + surf->pitch;
1015 pixel = start - surf->pitch;
1047 pixel = start + surf->pitch / 2;
1055 pixel = ((
Uint16 *)surf->pixels + (
y * surf->pitch / 2) +
x);
1075 pixel = start - surf->pitch / 2;
1113 pixel = start + surf->pitch / 3;
1146 pixel = start - surf->pitch / 3;
1178 pixel = start + surf->pitch / 4;
1186 pixel = ((
Uint32 *)surf->pixels + (
y * surf->pitch / 4) +
x);
1206 pixel = start - surf->pitch / 4;
1216 rect->w = maxX - minX + 1;
1217 rect->h = maxY - minY + 1;
1312 src->format->Rmask, src->format->Gmask,
1313 src->format->Bmask, src->format->Amask);
1339 SDL_Rect tmp, dst = { .x = left, .y = top, .w = 0, .h = 0 };
1370 int w = (
xr -
xl) + 1;
1371 int h = (
yb -
yt) + 1;
1393 for (
i = 0;
i <
l;
i++) {
1398 |= (
pcolor->a <<
spr->psurface->format->Ashift);
1401 for (
i = 0;
i <
l;
i++) {
1406 |= (
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
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 get_pixel(SDL_Surface *surf, int x, int 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)