#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "../EZ_utils.h"
#include "../../Rendering/RenderingUtils.h"
Go to the source code of this file.
◆ 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
-
surface | The SDL_Surface to create the image from. |
renderer | The SDL_Renderer to use for creating the texture. |
dst_anchore | The anchore point for the destination. |
auto_aspect | If non-zero, the aspect ratio of the image will be maintained. |
- Returns
- A pointer to the created EZ_image structure.
- Return values
-
NULL | if 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
-
file | The path to the image file to load. |
renderer | The SDL_Renderer to use for creating the texture. |
dst_anchore | The anchore point for the destination. |
auto_aspect | If non-zero, the aspect ratio of the image will be maintained. |
- Returns
- A pointer to the created EZ_image structure.
- Return values
-
NULL | if 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
-
image | The EZ_image structure to edit. |
surface | The new SDL_Surface to use for the image. |
renderer | The SDL_Renderer to use for creating the new texture. |
auto_aspect | If non-zero, the aspect ratio of the image will be maintained. |