SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
Data Structures | Enumerations
Image Controls

Data Structures

struct  GPU_BlendMode
 
struct  GPU_Image
 

Enumerations

enum  GPU_BlendFuncEnum {
  GPU_FUNC_ZERO = 0, GPU_FUNC_ONE = 1, GPU_FUNC_SRC_COLOR = 0x0300, GPU_FUNC_DST_COLOR = 0x0306,
  GPU_FUNC_ONE_MINUS_SRC = 0x0301, GPU_FUNC_ONE_MINUS_DST = 0x0307, GPU_FUNC_SRC_ALPHA = 0x0302, GPU_FUNC_DST_ALPHA = 0x0304,
  GPU_FUNC_ONE_MINUS_SRC_ALPHA = 0x0303, GPU_FUNC_ONE_MINUS_DST_ALPHA = 0x0305
}
 
enum  GPU_BlendEqEnum { GPU_EQ_ADD = 0x8006, GPU_EQ_SUBTRACT = 0x800A, GPU_EQ_REVERSE_SUBTRACT = 0x800B }
 
enum  GPU_BlendPresetEnum {
  GPU_BLEND_NORMAL = 0, GPU_BLEND_PREMULTIPLIED_ALPHA = 1, GPU_BLEND_MULTIPLY = 2, GPU_BLEND_ADD = 3,
  GPU_BLEND_SUBTRACT = 4, GPU_BLEND_MOD_ALPHA = 5, GPU_BLEND_SET_ALPHA = 6, GPU_BLEND_SET = 7,
  GPU_BLEND_NORMAL_KEEP_ALPHA = 8, GPU_BLEND_NORMAL_ADD_ALPHA = 9, GPU_BLEND_NORMAL_FACTOR_ALPHA = 10
}
 
enum  GPU_FilterEnum { GPU_FILTER_NEAREST = 0, GPU_FILTER_LINEAR = 1, GPU_FILTER_LINEAR_MIPMAP = 2 }
 
enum  GPU_SnapEnum { GPU_SNAP_NONE = 0, GPU_SNAP_POSITION = 1, GPU_SNAP_DIMENSIONS = 2, GPU_SNAP_POSITION_AND_DIMENSIONS = 3 }
 
enum  GPU_WrapEnum { GPU_WRAP_NONE = 0, GPU_WRAP_REPEAT = 1, GPU_WRAP_MIRRORED = 2 }
 
enum  GPU_FormatEnum {
  GPU_FORMAT_LUMINANCE = 1, GPU_FORMAT_LUMINANCE_ALPHA = 2, GPU_FORMAT_RGB = 3, GPU_FORMAT_RGBA = 4,
  GPU_FORMAT_ALPHA = 5, GPU_FORMAT_RG = 6, GPU_FORMAT_YCbCr422 = 7, GPU_FORMAT_YCbCr420P = 8,
  GPU_FORMAT_BGR = 9, GPU_FORMAT_BGRA = 10, GPU_FORMAT_ABGR = 11
}
 
enum  GPU_FileFormatEnum { GPU_FILE_AUTO = 0, GPU_FILE_PNG, GPU_FILE_BMP, GPU_FILE_TGA }
 
DECLSPEC GPU_Image *SDLCALL GPU_CreateImage (Uint16 w, Uint16 h, GPU_FormatEnum format)
 
DECLSPEC GPU_Image *SDLCALL GPU_CreateImageUsingTexture (Uint32 handle, GPU_bool take_ownership)
 
DECLSPEC GPU_Image *SDLCALL GPU_LoadImage (const char *filename)
 
DECLSPEC GPU_Image *SDLCALL GPU_LoadImage_RW (SDL_RWops *rwops, GPU_bool free_rwops)
 
DECLSPEC GPU_Image *SDLCALL GPU_CreateAliasImage (GPU_Image *image)
 
DECLSPEC GPU_Image *SDLCALL GPU_CopyImage (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_FreeImage (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_SetImageVirtualResolution (GPU_Image *image, Uint16 w, Uint16 h)
 
DECLSPEC void SDLCALL GPU_UnsetImageVirtualResolution (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_UpdateImage (GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect)
 
DECLSPEC void SDLCALL GPU_UpdateImageBytes (GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row)
 
DECLSPEC GPU_bool SDLCALL GPU_ReplaceImage (GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect)
 
DECLSPEC GPU_bool SDLCALL GPU_SaveImage (GPU_Image *image, const char *filename, GPU_FileFormatEnum format)
 
DECLSPEC GPU_bool SDLCALL GPU_SaveImage_RW (GPU_Image *image, SDL_RWops *rwops, GPU_bool free_rwops, GPU_FileFormatEnum format)
 
DECLSPEC void SDLCALL GPU_GenerateMipmaps (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_SetColor (GPU_Image *image, SDL_Color color)
 
DECLSPEC void SDLCALL GPU_SetRGB (GPU_Image *image, Uint8 r, Uint8 g, Uint8 b)
 
DECLSPEC void SDLCALL GPU_SetRGBA (GPU_Image *image, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
DECLSPEC void SDLCALL GPU_UnsetColor (GPU_Image *image)
 
DECLSPEC GPU_bool SDLCALL GPU_GetBlending (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_SetBlending (GPU_Image *image, GPU_bool enable)
 
DECLSPEC void SDLCALL GPU_SetBlendFunction (GPU_Image *image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha)
 
DECLSPEC void SDLCALL GPU_SetBlendEquation (GPU_Image *image, GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation)
 
DECLSPEC void SDLCALL GPU_SetBlendMode (GPU_Image *image, GPU_BlendPresetEnum mode)
 
DECLSPEC void SDLCALL GPU_SetImageFilter (GPU_Image *image, GPU_FilterEnum filter)
 
DECLSPEC void SDLCALL GPU_SetAnchor (GPU_Image *image, float anchor_x, float anchor_y)
 
DECLSPEC void SDLCALL GPU_GetAnchor (GPU_Image *image, float *anchor_x, float *anchor_y)
 
DECLSPEC GPU_SnapEnum SDLCALL GPU_GetSnapMode (GPU_Image *image)
 
DECLSPEC void SDLCALL GPU_SetSnapMode (GPU_Image *image, GPU_SnapEnum mode)
 
DECLSPEC void SDLCALL GPU_SetWrapMode (GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
 

Detailed Description

Enumeration Type Documentation

◆ GPU_BlendEqEnum

Blend component equations

See also
GPU_SetBlendEquation() Values chosen for direct OpenGL compatibility.
Enumerator
GPU_EQ_ADD 
GPU_EQ_SUBTRACT 
GPU_EQ_REVERSE_SUBTRACT 

Definition at line 151 of file SDL_gpu.h.

◆ GPU_BlendFuncEnum

Blend component functions

See also
GPU_SetBlendFunction() Values chosen for direct OpenGL compatibility.
Enumerator
GPU_FUNC_ZERO 
GPU_FUNC_ONE 
GPU_FUNC_SRC_COLOR 
GPU_FUNC_DST_COLOR 
GPU_FUNC_ONE_MINUS_SRC 
GPU_FUNC_ONE_MINUS_DST 
GPU_FUNC_SRC_ALPHA 
GPU_FUNC_DST_ALPHA 
GPU_FUNC_ONE_MINUS_SRC_ALPHA 
GPU_FUNC_ONE_MINUS_DST_ALPHA 

Definition at line 133 of file SDL_gpu.h.

◆ GPU_BlendPresetEnum

Blend mode presets

See also
GPU_SetBlendMode()
GPU_GetBlendModeFromPreset()
Enumerator
GPU_BLEND_NORMAL 
GPU_BLEND_PREMULTIPLIED_ALPHA 
GPU_BLEND_MULTIPLY 
GPU_BLEND_ADD 
GPU_BLEND_SUBTRACT 
GPU_BLEND_MOD_ALPHA 
GPU_BLEND_SET_ALPHA 
GPU_BLEND_SET 
GPU_BLEND_NORMAL_KEEP_ALPHA 
GPU_BLEND_NORMAL_ADD_ALPHA 
GPU_BLEND_NORMAL_FACTOR_ALPHA 

Definition at line 175 of file SDL_gpu.h.

◆ GPU_FileFormatEnum

File format enum

See also
GPU_SaveSurface()
GPU_SaveImage()
GPU_SaveSurface_RW()
GPU_SaveImage_RW()
Enumerator
GPU_FILE_AUTO 
GPU_FILE_PNG 
GPU_FILE_BMP 
GPU_FILE_TGA 

Definition at line 247 of file SDL_gpu.h.

◆ GPU_FilterEnum

Image filtering options. These affect the quality/interpolation of colors when images are scaled.

See also
GPU_SetImageFilter()
Enumerator
GPU_FILTER_NEAREST 
GPU_FILTER_LINEAR 
GPU_FILTER_LINEAR_MIPMAP 

Definition at line 193 of file SDL_gpu.h.

◆ GPU_FormatEnum

Image format enum

See also
GPU_CreateImage()
Enumerator
GPU_FORMAT_LUMINANCE 
GPU_FORMAT_LUMINANCE_ALPHA 
GPU_FORMAT_RGB 
GPU_FORMAT_RGBA 
GPU_FORMAT_ALPHA 
GPU_FORMAT_RG 
GPU_FORMAT_YCbCr422 
GPU_FORMAT_YCbCr420P 
GPU_FORMAT_BGR 
GPU_FORMAT_BGRA 
GPU_FORMAT_ABGR 

Definition at line 226 of file SDL_gpu.h.

◆ GPU_SnapEnum

Snap modes. Blitting with these modes will align the sprite with the target's pixel grid.

See also
GPU_SetSnapMode()
GPU_GetSnapMode()
Enumerator
GPU_SNAP_NONE 
GPU_SNAP_POSITION 
GPU_SNAP_DIMENSIONS 
GPU_SNAP_POSITION_AND_DIMENSIONS 

Definition at line 204 of file SDL_gpu.h.

◆ GPU_WrapEnum

Image wrapping options. These affect how images handle src_rect coordinates beyond their dimensions when blitted.

See also
GPU_SetWrapMode()
Enumerator
GPU_WRAP_NONE 
GPU_WRAP_REPEAT 
GPU_WRAP_MIRRORED 

Definition at line 216 of file SDL_gpu.h.

Function Documentation

◆ GPU_CopyImage()

DECLSPEC GPU_Image* SDLCALL GPU_CopyImage ( GPU_Image image)

Copy an image to a new image. Don't forget to GPU_FreeImage() both.

Definition at line 975 of file SDL_gpu.c.

◆ GPU_CreateAliasImage()

DECLSPEC GPU_Image* SDLCALL GPU_CreateAliasImage ( GPU_Image image)

Creates an image that aliases the given image. Aliases can be used to store image settings (e.g. modulation color) for easy switching. GPU_FreeImage() frees the alias's memory, but does not affect the original.

Definition at line 947 of file SDL_gpu.c.

◆ GPU_CreateImage()

DECLSPEC GPU_Image* SDLCALL GPU_CreateImage ( Uint16  w,
Uint16  h,
GPU_FormatEnum  format 
)

Create a new, blank image with the given format. Don't forget to GPU_FreeImage() it.

Parameters
wImage width in pixels
hImage height in pixels
formatFormat of color channels.

Definition at line 906 of file SDL_gpu.c.

◆ GPU_CreateImageUsingTexture()

DECLSPEC GPU_Image* SDLCALL GPU_CreateImageUsingTexture ( Uint32  handle,
GPU_bool  take_ownership 
)

Create a new image that uses the given native texture handle as the image texture.

Definition at line 914 of file SDL_gpu.c.

◆ GPU_FreeImage()

DECLSPEC void SDLCALL GPU_FreeImage ( GPU_Image image)

Deletes an image in the proper way for this renderer. Also deletes the corresponding GPU_Target if applicable. Be careful not to use that target afterward!

Definition at line 1284 of file SDL_gpu.c.

◆ GPU_GenerateMipmaps()

DECLSPEC void SDLCALL GPU_GenerateMipmaps ( GPU_Image image)

Loads mipmaps for the given image, if supported by the renderer.

Definition at line 1517 of file SDL_gpu.c.

◆ GPU_GetAnchor()

DECLSPEC void SDLCALL GPU_GetAnchor ( GPU_Image image,
float *  anchor_x,
float *  anchor_y 
)

Returns the image anchor via the passed parameters. The anchor is in normalized coordinates (0.0-1.0).

Definition at line 1936 of file SDL_gpu.c.

◆ GPU_GetBlending()

DECLSPEC GPU_bool SDLCALL GPU_GetBlending ( GPU_Image image)

Gets the current alpha blending setting.

Definition at line 1717 of file SDL_gpu.c.

◆ GPU_GetSnapMode()

DECLSPEC GPU_SnapEnum SDLCALL GPU_GetSnapMode ( GPU_Image image)

Gets the current pixel snap setting. The default value is GPU_SNAP_POSITION_AND_DIMENSIONS.

Definition at line 1948 of file SDL_gpu.c.

◆ GPU_LoadImage()

DECLSPEC GPU_Image* SDLCALL GPU_LoadImage ( const char *  filename)

Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it.

Definition at line 922 of file SDL_gpu.c.

◆ GPU_LoadImage_RW()

DECLSPEC GPU_Image* SDLCALL GPU_LoadImage_RW ( SDL_RWops *  rwops,
GPU_bool  free_rwops 
)

Load image from an image file in memory. Don't forget to GPU_FreeImage() it.

Definition at line 927 of file SDL_gpu.c.

◆ GPU_ReplaceImage()

DECLSPEC GPU_bool SDLCALL GPU_ReplaceImage ( GPU_Image image,
SDL_Surface *  surface,
const GPU_Rect surface_rect 
)

Update an image from surface data, replacing its underlying texture to allow for size changes. Ignores virtual resolution on the image so the number of pixels needed from the surface is known.

Definition at line 999 of file SDL_gpu.c.

◆ GPU_SaveImage()

DECLSPEC GPU_bool SDLCALL GPU_SaveImage ( GPU_Image image,
const char *  filename,
GPU_FileFormatEnum  format 
)

Save image to a file. With a format of GPU_FILE_AUTO, the file type is deduced from the extension. Supported formats are: png, bmp, tga. Returns 0 on failure.

Definition at line 955 of file SDL_gpu.c.

◆ GPU_SaveImage_RW()

DECLSPEC GPU_bool SDLCALL GPU_SaveImage_RW ( GPU_Image image,
SDL_RWops *  rwops,
GPU_bool  free_rwops,
GPU_FileFormatEnum  format 
)

Save image to a RWops stream. Does not support format of GPU_FILE_AUTO, because the file type cannot be deduced. Supported formats are: png, bmp, tga. Returns 0 on failure.

Definition at line 963 of file SDL_gpu.c.

◆ GPU_SetAnchor()

DECLSPEC void SDLCALL GPU_SetAnchor ( GPU_Image image,
float  anchor_x,
float  anchor_y 
)

Sets the image anchor, which is the point about which the image is blitted. The default is to blit the image on-center (0.5, 0.5). The anchor is in normalized coordinates (0.0-1.0).

Definition at line 1927 of file SDL_gpu.c.

◆ GPU_SetBlendEquation()

DECLSPEC void SDLCALL GPU_SetBlendEquation ( GPU_Image image,
GPU_BlendEqEnum  color_equation,
GPU_BlendEqEnum  alpha_equation 
)

Sets the blending component equations.

Definition at line 1838 of file SDL_gpu.c.

◆ GPU_SetBlendFunction()

DECLSPEC void SDLCALL GPU_SetBlendFunction ( GPU_Image image,
GPU_BlendFuncEnum  source_color,
GPU_BlendFuncEnum  dest_color,
GPU_BlendFuncEnum  source_alpha,
GPU_BlendFuncEnum  dest_alpha 
)

Sets the blending component functions.

Definition at line 1827 of file SDL_gpu.c.

◆ GPU_SetBlending()

DECLSPEC void SDLCALL GPU_SetBlending ( GPU_Image image,
GPU_bool  enable 
)

Enables/disables alpha blending for the given image.

Definition at line 1726 of file SDL_gpu.c.

◆ GPU_SetBlendMode()

DECLSPEC void SDLCALL GPU_SetBlendMode ( GPU_Image image,
GPU_BlendPresetEnum  mode 
)

Sets the blending mode, if supported by the renderer.

Definition at line 1847 of file SDL_gpu.c.

◆ GPU_SetColor()

DECLSPEC void SDLCALL GPU_SetColor ( GPU_Image image,
SDL_Color  color 
)

Sets the modulation color for subsequent drawing of the given image.

Definition at line 1623 of file SDL_gpu.c.

◆ GPU_SetImageFilter()

DECLSPEC void SDLCALL GPU_SetImageFilter ( GPU_Image image,
GPU_FilterEnum  filter 
)

Sets the image filtering mode, if supported by the renderer.

Definition at line 1895 of file SDL_gpu.c.

◆ GPU_SetImageVirtualResolution()

DECLSPEC void SDLCALL GPU_SetImageVirtualResolution ( GPU_Image image,
Uint16  w,
Uint16  h 
)

Change the logical size of the given image. Rendering this image will scaled it as if the dimensions were actually the ones given.

Definition at line 576 of file SDL_gpu.c.

◆ GPU_SetRGB()

DECLSPEC void SDLCALL GPU_SetRGB ( GPU_Image image,
Uint8  r,
Uint8  g,
Uint8  b 
)

Sets the modulation color for subsequent drawing of the given image.

Definition at line 1631 of file SDL_gpu.c.

◆ GPU_SetRGBA()

DECLSPEC void SDLCALL GPU_SetRGBA ( GPU_Image image,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Sets the modulation color for subsequent drawing of the given image.

Definition at line 1645 of file SDL_gpu.c.

◆ GPU_SetSnapMode()

DECLSPEC void SDLCALL GPU_SetSnapMode ( GPU_Image image,
GPU_SnapEnum  mode 
)

Sets the pixel grid snapping mode for the given image.

Definition at line 1956 of file SDL_gpu.c.

◆ GPU_SetWrapMode()

DECLSPEC void SDLCALL GPU_SetWrapMode ( GPU_Image image,
GPU_WrapEnum  wrap_mode_x,
GPU_WrapEnum  wrap_mode_y 
)

Sets the image wrapping mode, if supported by the renderer.

Definition at line 1964 of file SDL_gpu.c.

◆ GPU_UnsetColor()

DECLSPEC void SDLCALL GPU_UnsetColor ( GPU_Image image)

Unsets the modulation color for subsequent drawing of the given image. This is equivalent to coloring with pure opaque white (255, 255, 255, 255).

Definition at line 1659 of file SDL_gpu.c.

◆ GPU_UnsetImageVirtualResolution()

DECLSPEC void SDLCALL GPU_UnsetImageVirtualResolution ( GPU_Image image)

Reset the logical size of the given image to its original value.

Definition at line 589 of file SDL_gpu.c.

◆ GPU_UpdateImage()

DECLSPEC void SDLCALL GPU_UpdateImage ( GPU_Image image,
const GPU_Rect image_rect,
SDL_Surface *  surface,
const GPU_Rect surface_rect 
)

Update an image from surface data. Ignores virtual resolution on the image so the number of pixels needed from the surface is known.

Definition at line 983 of file SDL_gpu.c.

◆ GPU_UpdateImageBytes()

DECLSPEC void SDLCALL GPU_UpdateImageBytes ( GPU_Image image,
const GPU_Rect image_rect,
const unsigned char *  bytes,
int  bytes_per_row 
)

Update an image from an array of pixel data. Ignores virtual resolution on the image so the number of pixels needed from the surface is known.

Definition at line 991 of file SDL_gpu.c.