All Classes Functions Variables Typedefs Enumerations Groups
Classes | Typedefs | Enumerations
Image Controls

Classes

struct  GPU_BlendMode
 
struct  GPU_Image
 

Typedefs

typedef struct GPU_BlendMode GPU_BlendMode
 
typedef struct GPU_Image 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
}
 
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

Typedef Documentation

typedef struct GPU_BlendMode GPU_BlendMode

Blend mode storage struct

typedef struct GPU_Image GPU_Image

Image object for containing pixel/texture data. A GPU_Image can be created with GPU_CreateImage(), GPU_LoadImage(), GPU_CopyImage(), or GPU_CopyImageFromSurface(). Free the memory with GPU_FreeImage() when you're done.

See Also
GPU_CreateImage()
GPU_LoadImage()
GPU_CopyImage()
GPU_CopyImageFromSurface()
GPU_Target

Enumeration Type Documentation

Blend component equations

See Also
GPU_SetBlendEquation() Values chosen for direct OpenGL compatibility.

Blend component functions

See Also
GPU_SetBlendFunction() Values chosen for direct OpenGL compatibility.

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

See Also
GPU_SetImageFilter()

Image format enum

See Also
GPU_CreateImage()

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

See Also
GPU_SetSnapMode()
GPU_GetSnapMode()

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

See Also
GPU_SetWrapMode()

Function Documentation

DECLSPEC GPU_Image* SDLCALL GPU_CopyImage ( GPU_Image image)

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

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.

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.
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.

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!

DECLSPEC void SDLCALL GPU_GenerateMipmaps ( GPU_Image image)

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

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).

DECLSPEC GPU_bool SDLCALL GPU_GetBlending ( GPU_Image image)

Gets the current alpha blending setting.

DECLSPEC GPU_SnapEnum SDLCALL GPU_GetSnapMode ( GPU_Image image)

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

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.

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.

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.

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.

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.

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).

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

Sets the blending component equations.

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.

DECLSPEC void SDLCALL GPU_SetBlending ( GPU_Image image,
GPU_bool  enable 
)

Enables/disables alpha blending for the given image.

DECLSPEC void SDLCALL GPU_SetBlendMode ( GPU_Image image,
GPU_BlendPresetEnum  mode 
)

Sets the blending mode, if supported by the renderer.

DECLSPEC void SDLCALL GPU_SetColor ( GPU_Image image,
SDL_Color  color 
)

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

DECLSPEC void SDLCALL GPU_SetImageFilter ( GPU_Image image,
GPU_FilterEnum  filter 
)

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

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.

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.

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.

DECLSPEC void SDLCALL GPU_SetSnapMode ( GPU_Image image,
GPU_SnapEnum  mode 
)

Sets the pixel grid snapping mode for the given image.

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.

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).

DECLSPEC void SDLCALL GPU_UnsetImageVirtualResolution ( GPU_Image image)

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

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.

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.