LRaspi  2022.1
A Lua Player for Rasberry Pi
Image functions

Typedefs

typedef struct lraspi_Image lraspi_Image
 

Enumerations

enum  lraspi_FilterMode { LRASPI_FILTER_NEAREST = 0 , LRASPI_FILTER_BILINEAR , LRASPI_FILTER_TRILINEAR }
 

Functions

lraspi_Imagelraspi_image_new (const char *image_file)
 Loads an image file onto the memory. More...
 
void lraspi_image_free (lraspi_Image *image)
 Releases an image from memory. More...
 
int lraspi_image_getwidth (lraspi_Image *image)
 Gets the current width (in pixels) of the image. More...
 
int lraspi_image_getinitialwidth (lraspi_Image *image)
 Gets the width (in pixels) of the image. More...
 
int lraspi_image_getheight (lraspi_Image *image)
 Gets the current height (in pixels) of the image. More...
 
int lraspi_image_getinitialheight (lraspi_Image *image)
 Gets the height (in pixels) of the image. More...
 
void lraspi_image_resize (lraspi_Image *image, int height, int width)
 Resizes the image. More...
 
float lraspi_image_getrotation (lraspi_Image *image)
 Gets the rotation angle (in radians) of the image. More...
 
void lraspi_image_rotate (lraspi_Image *image, float angle)
 Rotates the image. More...
 
bool lraspi_image_isvflip (lraspi_Image *image)
 Checks if the image is vertically flipped. More...
 
void lraspi_image_vflip (lraspi_Image *image, bool vflip)
 Flips the image vertically. More...
 
bool lraspi_image_ishflip (lraspi_Image *image)
 Checks if the image is horizontally flipped. More...
 
void lraspi_image_hflip (lraspi_Image *image, bool hflip)
 Flips the image vertically. More...
 
lraspi_FilterMode lraspi_image_getfilter (lraspi_Image *image)
 Gets the image filter. More...
 
void lraspi_image_setfilter (lraspi_Image *image, lraspi_FilterMode filter)
 Sets the image filter. More...
 
lraspi_Colourlraspi_image_getpixel (lraspi_Image *image, int x, int y)
 Gets the colour pixel of the image. More...
 
void lraspi_image_setpixel (lraspi_Image *image, lraspi_Colour *colour, int x, int y)
 Sets the colour pixel of the image. More...
 
const char * lraspi_image_tostring (lraspi_Image *image)
 Gets the string representation of the image.
 

Detailed Description

Image loading and manipulation

Typedef Documentation

◆ lraspi_Image

typedef struct lraspi_Image lraspi_Image

Represents a image object

Enumeration Type Documentation

◆ lraspi_FilterMode

Represents how the image will be scaled

Enumerator
LRASPI_FILTER_BILINEAR 

Scales without filter

LRASPI_FILTER_TRILINEAR 

Scales using a bilinear filtering Scales using a trilinear filtering

Function Documentation

◆ lraspi_image_free()

void lraspi_image_free ( lraspi_Image image)

Releases an image from memory.

Parameters
imageThe image which will be released.

◆ lraspi_image_getfilter()

lraspi_FilterMode lraspi_image_getfilter ( lraspi_Image image)

Gets the image filter.

Parameters
imageAn image object.
Returns
The current filter of the image.

◆ lraspi_image_getheight()

int lraspi_image_getheight ( lraspi_Image image)

Gets the current height (in pixels) of the image.

Parameters
imageAn image object.

◆ lraspi_image_getinitialheight()

int lraspi_image_getinitialheight ( lraspi_Image image)

Gets the height (in pixels) of the image.

Note
If the image was modified, the returned value may change. If you need the real one, you should use lraspi_image_getinitialheight(lraspi_Image*).
Parameters
imageAn image object.

◆ lraspi_image_getinitialwidth()

int lraspi_image_getinitialwidth ( lraspi_Image image)

Gets the width (in pixels) of the image.

Parameters
imageAn image object.

◆ lraspi_image_getpixel()

lraspi_Colour* lraspi_image_getpixel ( lraspi_Image image,
int  x,
int  y 
)

Gets the colour pixel of the image.

Parameters
imageAn image object.
xx-axis image position (in pixels).
yy-axis image position (in pixels).

◆ lraspi_image_getrotation()

float lraspi_image_getrotation ( lraspi_Image image)

Gets the rotation angle (in radians) of the image.

Parameters
imageAn image object.

◆ lraspi_image_getwidth()

int lraspi_image_getwidth ( lraspi_Image image)

Gets the current width (in pixels) of the image.

Note
If the image was modified, the returned value will be the value of the last modification. If you need the real one, you should use lraspi_image_getinitialwidth(lraspi_Image*).
Parameters
imageAn image object.

◆ lraspi_image_hflip()

void lraspi_image_hflip ( lraspi_Image image,
bool  hflip 
)

Flips the image vertically.

Parameters
imageAn image object.
hflipTrue to flip the image horizontally, false otherwise.

◆ lraspi_image_ishflip()

bool lraspi_image_ishflip ( lraspi_Image image)

Checks if the image is horizontally flipped.

Parameters
imageAn image object.
Returns
true if the image is horizontally flipped, false otherwise.

◆ lraspi_image_isvflip()

bool lraspi_image_isvflip ( lraspi_Image image)

Checks if the image is vertically flipped.

Parameters
imageAn image object.
Returns
true if the image is vertically flipped, false otherwise.

◆ lraspi_image_new()

lraspi_Image* lraspi_image_new ( const char *  image_file)

Loads an image file onto the memory.

Parameters
image_filePath of the image file.
Returns
An image object.

◆ lraspi_image_resize()

void lraspi_image_resize ( lraspi_Image image,
int  height,
int  width 
)

Resizes the image.

Parameters
imageAn image object.
widthThe new width (in pixels).
heightThe new height (in pixels).

◆ lraspi_image_rotate()

void lraspi_image_rotate ( lraspi_Image image,
float  angle 
)

Rotates the image.

Parameters
imageAn image object.
angleThe new value (in radians).

◆ lraspi_image_setfilter()

void lraspi_image_setfilter ( lraspi_Image image,
lraspi_FilterMode  filter 
)

Sets the image filter.

Parameters
imageAn image object.
filterThe filter to apply to the image.

◆ lraspi_image_setpixel()

void lraspi_image_setpixel ( lraspi_Image image,
lraspi_Colour colour,
int  x,
int  y 
)

Sets the colour pixel of the image.

Parameters
imageAn image object.
colourAn colour object.
xx-axis image position (in pixels).
yy-axis image position (in pixels).

◆ lraspi_image_vflip()

void lraspi_image_vflip ( lraspi_Image image,
bool  vflip 
)

Flips the image vertically.

Parameters
imageAn image object.
vflipTrue to flip the image vertically, false otherwise.