Open Game Engine 2D API
 All Functions Variables
Functions
Image

Functions

int OGE_GetImage (string sName)
 Get image resource by its name.
int OGE_LoadImage (string sName, int iWidth, int iHeight, int iColorKeyRGB, string sFileName)
 Create an image resource (may load from an image file) dynamically.
string OGE_GetImageName (int iImageId)
 Get the name of the image resource.
int OGE_GetColorKey (int iImageId)
 Get the color key of the image resource.
void OGE_SetColorKey (int iImageId, int iColor)
 Set the color key of the image resource.
int OGE_GetPenColor (int iImageId)
 Get the pen color of the image resource.
void OGE_SetPenColor (int iImageId, int iColor)
 Set the pen color of the image resource.
int OGE_GetImageFont (int iImageId)
 Get the font of the image.
void OGE_SetImageFont (int iImageId, int iFontId)
 Set the font of the image.
int OGE_GetImageWidth (int iImageId)
 Get the width of the image.
int OGE_GetImageHeight (int iImageId)
 Get the height of the image.
int OGE_GetImageRect (int iImageId)
 Get the rectangle of the image.
int OGE_GetRect (int x, int y, int w, int h)
 Get the rectangle.
void OGE_Draw (int iDstImageId, int x, int y, int iSrcImageId, int iRectId)
 Draw an image onto another one.
void OGE_DrawWithEffect (int iDstImageId, int x, int y, int iSrcImageId, int iRectId, int iEffectType, double fEffectValue)
 Draw an image onto anther one with some effect.
void OGE_FillColor (int iImageId, int iColor)
 Fill the image with some color.
void OGE_FillRect (int iImageId, int iRGBColor, int iRectId)
 Fill the rect of the image with some color.
void OGE_FillRectAlpha (int iImageId, int iRGBColor, int iRectId, int iAlpha)
 Alpha blend some color onto a rect of an image.
void OGE_DrawText (int iImageId, string sText, int x, int y)
 Draw text onto the image.
int OGE_GetTextWidth (int iImageId, string sText)
 Get the width of the text (when it was drawn onto the image)
bool OGE_GetTextSize (int iImageId, string sText, int &w, int &h)
 Get the size of the text (when it was drawn onto the image)
void OGE_DrawBufferText (int iImageId, int iBufferId, int iBufferSize, int x, int y, string sCharsetName)
 Draw the text in buffer onto an image.
int OGE_GetBufferTextWidth (int iImageId, int iBufferId, int iBufferSize, string sCharsetName)
 Get the width of the text in the buffer.
bool OGE_GetBufferTextSize (int iImageId, int iBufferId, int iBufferSize, string sCharsetName, int &w, int &h)
 Get the size of the text in the buffer.
void OGE_DrawLine (int iImageId, int iStartX, int iStartY, int iEndX, int iEndY)
 Draw a line on the image.
void OGE_DrawCircle (int iImageId, int iCenterX, int iCenterY, int iRadius)
 Draw a circle on the image.
int OGE_GetClipboardB ()
 Get the image ID of Clipboard B (for drawing)
int OGE_GetClipboardC ()
 Get the image ID of Clipboard C (for drawing)
void OGE_ImageRGB (int iImageId, int iRectId, int iRed, int iGreen, int iBlue)
 Change the RGB values of the image.
void OGE_ImageLightness (int iImageId, int iRectId, int iAmount)
 Change the lightness of the image.
void OGE_ImageGrayscale (int iImageId, int iRectId, int iAmount)
 Apply grayscale effect on the image.
void OGE_ImageBlur (int iImageId, int iRectId, int iAmount)
 Apply blur effect on the image.
void OGE_StretchBltToScreen (int iSrcImageId, int iRectId)
 Stretch the image to the screen size and draw it to the screen.
void OGE_SaveImageAsBMP (int iImageId, string sBmpFileName)
 Save image into a BMP file.
void OGE_RemoveImage (string sName)
 Remove an image by name.

Function Documentation

void OGE_Draw ( int  iDstImageId,
int  x,
int  y,
int  iSrcImageId,
int  iRectId 
)

Draw an image onto another one.

Parameters:
[in]iDstImageIdThe ID of the destine image
[in]xThe x coordinate of the drawing position
[in]yThe y coordinate of the drawing position
[in]iSrcImageIdThe ID of the source image
[in]iRectIdThe ID of the rect of the source image
void OGE_DrawBufferText ( int  iImageId,
int  iBufferId,
int  iBufferSize,
int  x,
int  y,
string  sCharsetName 
)

Draw the text in buffer onto an image.

Parameters:
[in]iImageIdThe ID of the image
[in]iBufferIdThe ID of the buffer
[in]iBufferSizeThe size of the buffer
[in]xThe x coordinate of the drawing position
[in]yThe y coordinate of the drawing position
[in]sCharsetNameThe charset which is used by the text
void OGE_DrawCircle ( int  iImageId,
int  iCenterX,
int  iCenterY,
int  iRadius 
)

Draw a circle on the image.

Parameters:
[in]iImageIdThe ID of the image
[in]iCenterXThe x coordinate of the center point of the circle
[in]iCenterYThe y coordinate of the center point of the circle
[in]iRadiusThe radius of the circle
void OGE_DrawLine ( int  iImageId,
int  iStartX,
int  iStartY,
int  iEndX,
int  iEndY 
)

Draw a line on the image.

Parameters:
[in]iImageIdThe ID of the image
[in]iStartXThe x coordinate of start point
[in]iStartYThe y coordinate of start point
[in]iEndXThe x coordinate of end point
[in]iEndYThe y coordinate of end point
void OGE_DrawText ( int  iImageId,
string  sText,
int  x,
int  y 
)

Draw text onto the image.

Parameters:
[in]iImageIdThe ID of the image
[in]sTextThe text
[in]xThe x coordinate of the drawing position
[in]yThe y coordinate of the drawing position
void OGE_DrawWithEffect ( int  iDstImageId,
int  x,
int  y,
int  iSrcImageId,
int  iRectId,
int  iEffectType,
double  fEffectValue 
)

Draw an image onto anther one with some effect.

Parameters:
[in]iDstImageIdThe ID of the destine image
[in]xThe x coordinate of the drawing position
[in]yThe y coordinate of the drawing position
[in]iSrcImageIdThe ID of the source image
[in]iRectIdThe ID of the rect of the source image
[in]iEffectTypeThe effect type
[in]fEffectValueThe effect value
void OGE_FillColor ( int  iImageId,
int  iColor 
)

Fill the image with some color.

Parameters:
[in]iImageIdThe ID of the image
[in]iColorThe color
void OGE_FillRect ( int  iImageId,
int  iRGBColor,
int  iRectId 
)

Fill the rect of the image with some color.

Parameters:
[in]iImageIdThe ID of image
[in]iRGBColorThe color
[in]iRectIdThe ID of the rect of the image
void OGE_FillRectAlpha ( int  iImageId,
int  iRGBColor,
int  iRectId,
int  iAlpha 
)

Alpha blend some color onto a rect of an image.

Parameters:
[in]iImageIdThe ID of the image
[in]iRGBColorThe color (RGB format)
[in]iRectIdThe ID of the rect of the image
[in]iAlphaThe alpha value
bool OGE_GetBufferTextSize ( int  iImageId,
int  iBufferId,
int  iBufferSize,
string  sCharsetName,
int &  w,
int &  h 
)

Get the size of the text in the buffer.

Parameters:
[in]iImageIdThe ID of the image
[in]iBufferIdThe ID of the buffer
[in]iBufferSizeThe size of the buffer
[in]sCharsetNameThe charset of the text
[out]wThe width of the text
[out]hThe height of the text
Returns:
Returns true if succeed
int OGE_GetBufferTextWidth ( int  iImageId,
int  iBufferId,
int  iBufferSize,
string  sCharsetName 
)

Get the width of the text in the buffer.

Parameters:
[in]iImageIdThe ID of the image
[in]iBufferIdThe ID of the buffer
[in]iBufferSizeThe size of the buffer
[in]sCharsetNameThe charset which is used by the text
Returns:
The width of the text

Get the image ID of Clipboard B (for drawing)

Returns:
The ID of Clipboard B (image ID)

Get the image ID of Clipboard C (for drawing)

Returns:
The ID of Clipboard C (image ID)
int OGE_GetColorKey ( int  iImageId)

Get the color key of the image resource.

Parameters:
[in]iImageIdThe ID of the image resource
Returns:
The color key
int OGE_GetImage ( string  sName)

Get image resource by its name.

Parameters:
[in]sNameThe image name
Returns:
Returns the ID of the image resource
int OGE_GetImageFont ( int  iImageId)

Get the font of the image.

Parameters:
[in]iImageIdThe ID of the image
Returns:
The ID of the font
int OGE_GetImageHeight ( int  iImageId)

Get the height of the image.

Parameters:
[in]iImageIdThe ID of the image
Returns:
The height of the image
string OGE_GetImageName ( int  iImageId)

Get the name of the image resource.

Parameters:
[in]iImageIdThe ID of the image resource
Returns:
Returns the name of the image resource
int OGE_GetImageRect ( int  iImageId)

Get the rectangle of the image.

Parameters:
[in]iImageIdThe ID of the image
Returns:
The ID of the rectangle
int OGE_GetImageWidth ( int  iImageId)

Get the width of the image.

Parameters:
[in]iImageIdThe ID of the image
Returns:
The width of the image
int OGE_GetPenColor ( int  iImageId)

Get the pen color of the image resource.

Parameters:
[in]iImageIdThe ID of the image resource
Returns:
The color of current pen
int OGE_GetRect ( int  x,
int  y,
int  w,
int  h 
)

Get the rectangle.

Parameters:
[in]xThe position x of the top-left point of the rect
[in]yThe position y of the top-left point of the rect
[in]wThe width of the rect
[in]hThe height of the rect
Returns:
The ID of the rect
bool OGE_GetTextSize ( int  iImageId,
string  sText,
int &  w,
int &  h 
)

Get the size of the text (when it was drawn onto the image)

Parameters:
[in]iImageIdThe ID of the image
[in]sTextThe text
[out]wThe width of the text
[out]hThe height of the text
Returns:
Returns true if it succeeded
int OGE_GetTextWidth ( int  iImageId,
string  sText 
)

Get the width of the text (when it was drawn onto the image)

Parameters:
[in]iImageIdThe ID of the image
[in]sTextThe text
Returns:
The width of the text
void OGE_ImageBlur ( int  iImageId,
int  iRectId,
int  iAmount 
)

Apply blur effect on the image.

Parameters:
[in]iImageIdThe image ID
[in]iRectIdThe ID of the rect of the image
[in]iAmountThe blur value
void OGE_ImageGrayscale ( int  iImageId,
int  iRectId,
int  iAmount 
)

Apply grayscale effect on the image.

Parameters:
[in]iImageIdThe image ID
[in]iRectIdThe ID of the rect of the image
[in]iAmountThe grayscale value
void OGE_ImageLightness ( int  iImageId,
int  iRectId,
int  iAmount 
)

Change the lightness of the image.

Parameters:
[in]iImageIdThe image ID
[in]iRectIdThe rect ID
[in]iAmountThe value of the lightness
void OGE_ImageRGB ( int  iImageId,
int  iRectId,
int  iRed,
int  iGreen,
int  iBlue 
)

Change the RGB values of the image.

Parameters:
[in]iImageIdThe ID of the image
[in]iRectIdThe ID of the rect of the image
[in]iRedThe value of the red variable
[in]iGreenThe value of the green variable
[in]iBlueThe value of the blue variable
int OGE_LoadImage ( string  sName,
int  iWidth,
int  iHeight,
int  iColorKeyRGB,
string  sFileName 
)

Create an image resource (may load from an image file) dynamically.

Parameters:
[in]sNameThe name of the image resource
[in]iWidthThe width of the image resource
[in]iHeightThe height of the image resource
[in]iColorKeyRGBThe color key of the image resource
[in]sFileNameThe file path of the image, if image is not loaded from a file, let it be an empty string
Returns:
The ID of the image resource
void OGE_RemoveImage ( string  sName)

Remove an image by name.

Parameters:
[in]sNameThe name of the image
void OGE_SaveImageAsBMP ( int  iImageId,
string  sBmpFileName 
)

Save image into a BMP file.

Parameters:
[in]iImageIdThe image ID
[in]sBmpFileNameThe BMP file path
void OGE_SetColorKey ( int  iImageId,
int  iColor 
)

Set the color key of the image resource.

Parameters:
[in]iImageIdThe ID of the image resource
[in]iColorThe value of the color key
void OGE_SetImageFont ( int  iImageId,
int  iFontId 
)

Set the font of the image.

Parameters:
[in]iImageIdThe ID of the image
[in]iFontIdThe ID of the font
void OGE_SetPenColor ( int  iImageId,
int  iColor 
)

Set the pen color of the image resource.

Parameters:
[in]iImageIdThe ID of the image resource
[in]iColorThe pen color
void OGE_StretchBltToScreen ( int  iSrcImageId,
int  iRectId 
)

Stretch the image to the screen size and draw it to the screen.

Parameters:
[in]iSrcImageIdThe image ID
[in]iRectIdThe ID of the rect of the image