29#include <SDL3_image/SDL_image.h>
30#include <SDL3_ttf/SDL_ttf.h>
334 log_error(
_(
"Unable to create Sprite (Surface) of size "
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);
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);
733 if (
ww <= 0 ||
hh <= 0) {
760 Uint16 minX, maxX, minY, maxY;
784 switch (
details->bytes_per_pixel) {
812 pixel = start + surf->pitch;
840 pixel = start - surf->pitch;
872 pixel = start + surf->pitch / 2;
880 pixel = ((
Uint16 *)surf->pixels + (
y * surf->pitch / 2) +
x);
900 pixel = start - surf->pitch / 2;
938 pixel = start + surf->pitch / 3;
971 pixel = start - surf->pitch / 3;
1003 pixel = start + surf->pitch / 4;
1011 pixel = ((
Uint32 *)surf->pixels + (
y * surf->pitch / 4) +
x);
1031 pixel = start - surf->pitch / 4;
1041 rect->w = maxX - minX + 1;
1042 rect->h = maxY - minY + 1;
1176 SDL_Rect tmp, dst = { .x = left, .y = top, .w = 0, .h = 0 };
1207 int w = (
xr -
xl) + 1;
1208 int h = (
yb -
yt) + 1;
1232 for (
i = 0;
i <
l;
i++) {
1240 for (
i = 0;
i <
l;
i++) {
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)
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)
Uint32 get_pixel(SDL_Surface *surf, Sint16 x, Sint16 y)
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)
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 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)