OCRudoku  v1.0
Resolve word grid with ease
Loading...
Searching...
No Matches
EZ_image.h File Reference
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "../EZ_utils.h"
#include "../../Rendering/RenderingUtils.h"
Include dependency graph for EZ_image.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  EZ_image
 

Functions

EZ_imageEZ_create_image_file (char *file, SDL_Renderer *renderer, anchore_point dst_anchore, int auto_aspect)
 Creates an EZ_image from a file.
 
EZ_imageEZ_create_image (SDL_Surface *surface, SDL_Renderer *renderer, anchore_point dst_anchore, int auto_aspect)
 Creates an EZ_image from an SDL_Surface.
 
void EZ_edit_image (EZ_image *image, SDL_Surface *surface, SDL_Renderer *renderer, int auto_aspect)
 Edits an existing EZ_image with a new SDL_Surface.
 

Function Documentation

◆ EZ_create_image()

EZ_image * EZ_create_image ( SDL_Surface * surface,
SDL_Renderer * renderer,
anchore_point dst_anchore,
int auto_aspect )

Creates an EZ_image from an SDL_Surface.

This function creates an EZ_image structure from the given SDL_Surface and renderer. The created EZ_image can be used for rendering with SDL.

Parameters
surfaceThe SDL_Surface to create the image from.
rendererThe SDL_Renderer to use for creating the texture.
dst_anchoreThe anchore point for the destination.
auto_aspectIf non-zero, the aspect ratio of the image will be maintained.
Returns
A pointer to the created EZ_image structure.
Return values
NULLif the texture could not be created from the surface.

◆ EZ_create_image_file()

EZ_image * EZ_create_image_file ( char * file,
SDL_Renderer * renderer,
anchore_point dst_anchore,
int auto_aspect )

Creates an EZ_image from a file.

This function loads an image from the specified file and creates an EZ_image structure that can be used for rendering with SDL.

Parameters
fileThe path to the image file to load.
rendererThe SDL_Renderer to use for creating the texture.
dst_anchoreThe anchore point for the destination.
auto_aspectIf non-zero, the aspect ratio of the image will be maintained.
Returns
A pointer to the created EZ_image structure.
Return values
NULLif the image or texture could not be loaded.

◆ EZ_edit_image()

void EZ_edit_image ( EZ_image * image,
SDL_Surface * surface,
SDL_Renderer * renderer,
int auto_aspect )

Edits an existing EZ_image with a new SDL_Surface.

This function updates an existing EZ_image structure with a new SDL_Surface, recreating the texture and optionally maintaining the aspect ratio.

Parameters
imageThe EZ_image structure to edit.
surfaceThe new SDL_Surface to use for the image.
rendererThe SDL_Renderer to use for creating the new texture.
auto_aspectIf non-zero, the aspect ratio of the image will be maintained.