2#include <SDL2/SDL_image.h>
3#include <SDL2/SDL_render.h>
9#include <SDL_surface.h>
12#define M_PI acos(-1.0)
18void render_image_file(
const char* file, SDL_Renderer* renderer,
const SDL_Rect* srcrect,
const SDL_Rect* dstrect);
22void render_surface(SDL_Surface* surface, SDL_Renderer* renderer,
const SDL_Rect* srcrect,
const SDL_Rect* dstrect);
24void*
get_pixel_pt(SDL_Surface* surface,
size_t x,
size_t y);
28void set_pixel_val(
void* pixel, SDL_PixelFormat* format, Uint32 val);
40SDL_Surface*
rotate_pixels(SDL_Surface* surface,
double angle);
44SDL_Surface*
resize_image(SDL_Surface* source,
int new_width,
int new_height);
void render_full_image_file(const char *file, SDL_Renderer *renderer, const SDL_Rect *dstrect)
Renders an entire image file onto a given SDL renderer.
Definition ImageUtils.c:33
void * get_pixel_pt(SDL_Surface *surface, size_t x, size_t y)
Retrieves a pointer to the pixel at the specified coordinates in an SDL surface.
Definition ImageUtils.c:82
SDL_Surface * create_sub_surface(SDL_Surface *surface, SDL_Rect rect)
Creates a sub-surface from a given SDL surface and rectangle.
Definition ImageUtils.c:287
double * image_to_bool_array(const char *file, size_t *image_len)
Definition ImageUtils.c:409
void render_surface(SDL_Surface *surface, SDL_Renderer *renderer, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
Renders a given SDL surface onto a given SDL renderer.
Definition ImageUtils.c:59
void pixel_to_black_white(void *pixel, SDL_PixelFormat *format, Uint8 threshold)
Converts a pixel to black or white based on a threshold.
Definition ImageUtils.c:219
void render_image_file(const char *file, SDL_Renderer *renderer, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
Renders an image file onto a given SDL renderer.
Definition ImageUtils.c:7
void set_pixel_val(void *pixel, SDL_PixelFormat *format, Uint32 val)
Sets the pixel value at a given memory location based on the SDL pixel format.
Definition ImageUtils.c:145
SDL_Surface * resize_image(SDL_Surface *source, int new_width, int new_height)
Definition ImageUtils.c:438
void image_to_black_white(SDL_Surface *surface)
Converts an entire SDL surface to black and white.
Definition ImageUtils.c:258
SDL_Surface * rotate_pixels(SDL_Surface *surface, double angle)
Definition ImageUtils.c:331
Uint32 get_pixel_val(void *pixel, SDL_PixelFormat *format)
Retrieves the pixel value from a given pixel pointer and SDL pixel format.
Definition ImageUtils.c:101
void pixel_to_grayscale(void *pixel, SDL_PixelFormat *format)
Converts a pixel to grayscale.
Definition ImageUtils.c:192