OldSchool Library
Drawing images

Macros

#define oslDrawImageXY(img, px, py)
 Draws an image at the specified position.
 
#define oslDrawImageSimpleXY(img, px, py)
 Draws an image at the specified position (backward compatibility).
 

Functions

void oslDrawImage (OSL_IMAGE *img)
 Draws an image at its current position.
 
void oslDrawImageSimple (OSL_IMAGE *img)
 Draws an image at its current position (deprecated).
 
void oslDrawImageBig (OSL_IMAGE *img)
 Draws a very large image.
 

Detailed Description

Image support in OSLib.

Macro Definition Documentation

◆ oslDrawImageXY

#define oslDrawImageXY ( img,
px,
py )
Value:
({ (img)->x=(px), (img)->y=(py); oslDrawImage(img); })
void oslDrawImage(OSL_IMAGE *img)
Draws an image at its current position.

Draws an image at the specified position.

This macro sets the position of the image img to the coordinates (px, py) and then draws it using the oslDrawImage function.

Parameters
imgPointer to the image to be drawn.
pxThe x-coordinate where the image should be drawn.
pyThe y-coordinate where the image should be drawn.
Note
This macro is specifically for PSP and uses oslDrawImage to render the image.

◆ oslDrawImageSimpleXY

#define oslDrawImageSimpleXY ( img,
px,
py )
Value:
({ (img)->x=(px), (img)->y=(py); oslDrawImageSimple(img); })
void oslDrawImageSimple(OSL_IMAGE *img)
Draws an image at its current position (deprecated).

Draws an image at the specified position (backward compatibility).

This macro is similar to oslDrawImageXY, but uses the oslDrawImageSimple function for drawing. It is kept for backward compatibility and is not recommended for new code.

Parameters
imgPointer to the image to be drawn.
pxThe x-coordinate where the image should be drawn.
pyThe y-coordinate where the image should be drawn.
Note
This macro is specifically for PSP and uses oslDrawImageSimple, which is kept for compatibility but should be avoided in new code.

Function Documentation

◆ oslDrawImage()

void oslDrawImage ( OSL_IMAGE * img)
extern

Draws an image at its current position.

This function renders the image specified by the img parameter at the position stored in the image's x and y attributes. The image must be properly initialized and loaded before calling this function.

Parameters
imgPointer to the OSL_IMAGE structure representing the image to be drawn.
Note
Ensure that the image is correctly loaded and initialized before calling this function. The image's position is determined by its x and y attributes, which should be set before drawing.

◆ oslDrawImageSimple()

void oslDrawImageSimple ( OSL_IMAGE * img)
extern

Draws an image at its current position (deprecated).

This function renders the image specified by the img parameter at the position stored in the image's x and y attributes. It is provided for backward compatibility with older code but should not be used in new code.

Parameters
imgPointer to the OSL_IMAGE structure representing the image to be drawn.
Note
This function is maintained for compatibility with older code. For new code, use oslDrawImage instead. Ensure the image is properly initialized and its position is correctly set before calling this function.

◆ oslDrawImageBig()

void oslDrawImageBig ( OSL_IMAGE * img)
extern

Draws a very large image.

This function is designed to draw images larger than the standard 512x512 pixel limit. It provides a way to render images up to 1024 pixels in width, but comes with additional complexity and potentially significant performance drawbacks.

Note
The PSP hardware is not optimized for handling images larger than 512x512 pixels. While this function allows you to draw larger images, it can be extremely slow and is not recommended for typical use. The GPU must process all the pixels of the image, even if you scale it down, which can be very inefficient.

Texture wrapping (oslSetTextureWrap) is not supported. Make sure that offset coordinates are within the bounds of the image to avoid unpredictable results.

Warning
Using this function may severely impact performance. Always try to rescale your images to an acceptable size (less than 512x512) during loading. This function is available if you need it, but it's essential to understand its limitations and performance implications.
Parameters
imgPointer to the OSL_IMAGE structure representing the image to be drawn.
Deprecated
This function is deprecated and may change or be removed in future releases of OSLib. It is recommended to use oslDrawImage for standard image drawing needs.