MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros | Typedefs | Functions
Bitmap file load/save operations

Macros

#define MLS_BLENDMODE_NONE   0x00
 
#define LoadBitmap   LoadBitmapFromFile
 An alias of LoadBitmapFromFile. More...
 
#define LoadMyBitmap   LoadMyBitmapFromFile
 Alias of LoadMyBitmapFromFile. More...
 

Typedefs

typedef void(* CB_ONE_SCANLINE) (void *context, MYBITMAP *my_bmp, int y)
 The type of scanline loaded callback. More...
 

Functions

MG_EXPORT BOOL GUIAPI RegisterBitmapFileType (const char *ext, void *(*init)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal), int(*load)(MG_RWops *fp, void *init_info, MYBITMAP *my_bmp, CB_ONE_SCANLINE cb, void *context), void(*cleanup)(void *init_info), int(*save)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal), BOOL(*check)(MG_RWops *fp))
 Registers a bitmap file loader, saver, and checker. More...
 
MG_EXPORT const char *GUIAPI CheckBitmapType (MG_RWops *fp)
 Checks the type of the bitmap in a data source. More...
 
MG_EXPORT BOOL GUIAPI mlsEnableSlaveScreen (HDC dc_mls, BOOL enable)
 Enable or Disable a MLShadow slave screen. More...
 
MG_EXPORT int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP pBitmap, MG_RWops *area, const char *ext)
 Loads a device-dependent bitmap from a general data source. More...
 
MG_EXPORT int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP pBitmap, const char *spFileName)
 Loads a device-dependent bitmap from a file. More...
 
MG_EXPORT int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP pBitmap, const void *mem, int size, const char *ext)
 Loads a device-dependent bitmap from memory. More...
 
MG_EXPORT void GUIAPI UnloadBitmap (PBITMAP pBitmap)
 Unloads a bitmap. More...
 
MG_EXPORT int GUIAPI SetBitmapKeyColor (HDC hdc, PBITMAP bmp, Uint8 r, Uint8 g, Uint8 b)
 Set the bitmap color key. More...
 
MG_EXPORT void GUIAPI ReplaceBitmapColor (HDC hdc, PBITMAP pBitmap, gal_pixel iOColor, gal_pixel iNColor)
 Replaces a specific pixels in a bitmap with another pixel. More...
 
MG_EXPORT void GUIAPI HFlipBitmap (BITMAP *bmp, unsigned char *inter_buff)
 Horizontal Flip the special Bitmap object. More...
 
MG_EXPORT void GUIAPI VFlipBitmap (BITMAP *bmp, unsigned char *inter_buff)
 Vertical Flip the special Bitmap object. More...
 
MG_EXPORT void *GUIAPI InitMyBitmapSL (MG_RWops *area, const char *ext, MYBITMAP *my_bmp, RGB *pal)
 Initializes scanline loader of the MYBITMAP object from a data source. More...
 
MG_EXPORT int GUIAPI LoadMyBitmapSL (MG_RWops *area, void *load_info, MYBITMAP *my_bmp, CB_ONE_SCANLINE cb, void *context)
 Loads MYBITMAP scanlines from a data source one by one. More...
 
MG_EXPORT int GUIAPI CleanupMyBitmapSL (MYBITMAP *my_bmp, void *load_info)
 Cleanups the scanline loader. More...
 
MG_EXPORT int GUIAPI LoadMyBitmapEx (PMYBITMAP my_bmp, RGB *pal, MG_RWops *area, const char *ext)
 Loads a MYBITMAP object from a data source. More...
 
MG_EXPORT int GUIAPI LoadMyBitmapFromFile (PMYBITMAP my_bmp, RGB *pal, const char *file_name)
 Loads a MYBITMAP object from a file. More...
 
MG_EXPORT int GUIAPI LoadMyBitmapFromMem (PMYBITMAP my_bmp, RGB *pal, const void *mem, int size, const char *ext)
 Loads a MYBITMAP object from memory. More...
 
MG_EXPORT void GUIAPI UnloadMyBitmap (PMYBITMAP my_bmp)
 Unloads a bitmap. More...
 
MG_EXPORT int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB *pal, const char *spFileName)
 Saves a MYBITMAP object to a bitmap file. More...
 
MG_EXPORT int GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP pBitmap, const char *spFileName)
 Saves a BITMAP object to a bitmap file. More...
 
MG_EXPORT BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, BYTE *bits, PBITMAP bmp)
 Initializes a BITMAP object as a normal bitmap. More...
 
MG_EXPORT HDC GUIAPI InitSlaveScreen (const char *name, const char *mode)
 Initializes slave screen. More...
 
MG_EXPORT void GUIAPI TerminateSlaveScreen (HDC hdc)
 Terminates slave screen. More...
 
MG_EXPORT BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp)
 Initializes the bitmap pixel format information of a BITMAP object. More...
 
MG_EXPORT void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp)
 Deletes the bitmap alpha pixel format information of a BITMAP object. More...
 
MG_EXPORT int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp, const MYBITMAP *my_bmp, const RGB *pal, int frame)
 Expands a MYBITMAP object to a BITMAP object. More...
 
MG_EXPORT void GUIAPI ExpandMonoBitmap (HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, Uint32 bg, Uint32 fg)
 Convert a mono color MYBITMAP pixel data to a BITMAP pixel data. More...
 
static void GUIAPI Expand16CBitmap (HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB *pal)
 Convert a 16 color MYBITMAP pixel data to a BITMAP pixel data. More...
 
static void GUIAPI Expand256CBitmap (HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, const RGB *pal, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp)
 Convert a 256 color MYBITMAP pixel data to a BITMAP pixel data. More...
 
MG_EXPORT void GUIAPI CompileRGBABitmap (HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, void *pixel_format, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp)
 Convert a MYBITMAP pixel data to a BITMAP pixel data. More...
 
MG_EXPORT void GUIAPI CompileRGBABitmapEx (HDC hdc, BYTE *bits, Uint32 pitch, const BYTE *my_bits, Uint32 my_pitch, Uint32 w, Uint32 h, DWORD flags, void *pixel_format, CB_DRAW_PIXEL cb_draw, MYBITMAP_CONTXT *mybmp, BYTE *alpha_mask)
 Compile a MYBITMAP pixel data to a BITMAP pixel data. More...
 
MG_EXPORT int GUIAPI PaintImageEx (HDC hdc, int x, int y, MG_RWops *area, const char *ext)
 Paints an image from data source on device directly. More...
 
MG_EXPORT int GUIAPI PaintImageFromFile (HDC hdc, int x, int y, const char *spFileName)
 Paints an image from file on device directly. More...
 
MG_EXPORT int GUIAPI PaintImageFromMem (HDC hdc, int x, int y, const void *mem, int size, const char *ext)
 Paints an image from memory on device directly. More...
 
MG_EXPORT int GUIAPI StretchPaintImageEx (HDC hdc, int x, int y, int w, int h, MG_RWops *area, const char *ext)
 Paints an image from data source on device directly. More...
 
MG_EXPORT int GUIAPI StretchPaintImageFromFile (HDC hdc, int x, int y, int w, int h, const char *spFileName)
 Paints an image from file on device directly. More...
 
MG_EXPORT int GUIAPI StretchPaintImageFromMem (HDC hdc, int x, int y, int w, int h, const void *mem, int size, const char *ext)
 Paints an image from memory on device directly. More...
 
MG_EXPORT void GUIAPI RotateBitmap (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
 Rotate a bitmap object. More...
 
MG_EXPORT void GUIAPI RotateBitmapVFlip (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
 Flips vertically and rotates a bitmap object. More...
 
MG_EXPORT void GUIAPI RotateBitmapHFlip (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle)
 Flips horizontally and rotates a bitmap object. More...
 
MG_EXPORT void GUIAPI RotateScaledBitmap (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
 Stretches or shrinks a bitmap object at the same as rotating it. More...
 
MG_EXPORT void GUIAPI RotateScaledBitmapVFlip (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
 Flip vertically, rotates, stretch or shrinks a bitmap object. More...
 
MG_EXPORT void GUIAPI RotateScaledBitmapHFlip (HDC hdc, const BITMAP *bmp, int lx, int ty, int angle, int w, int h)
 Flip horizontaly, rotates, stretch or shrinks a bitmap object. More...
 
MG_EXPORT void GUIAPI PivotBitmap (HDC hdc, const BITMAP *bmp, int lx, int ty, int cx, int cy, int angle)
 Pivot a bitmap object. More...
 
MG_EXPORT void GUIAPI PivotScaledBitmapFlip (HDC hdc, const BITMAP *bmp, fixed x, fixed y, fixed cx, fixed cy, int angle, fixed scale_x, fixed scale_y, BOOL h_flip, BOOL v_flip)
 Rotates, stretches or shrinks, flips a bitmap object. More...
 

Detailed Description

Example:

/*
* The following code loads a BITMAP object from a file and then
* fills a box in a DC.
*
* You should note that the code assigns 'bmType' field of the BITMAP object directly.
*/
{
int tox = 800, toy = 800;
int count;
BITMAP bitmap;
unsigned int start_tick, end_tick;
/* Load the bitmap from the file. */
if (LoadBitmap (hdc, &bitmap, "res/icon.bmp"))
return;
bitmap.bmType = BMP_TYPE_ALPHACHANNEL;
/* Fill a box with the bitmap with alpha channel. */
start_tick = GetTickCount ();
count = 1000;
while (count--) {
tox = rand() % 800;
toy = rand() % 800;
/* Set a random alpha channel. */
bitmap.bmAlpha = rand() % 256;
/* Fill the box. */
FillBoxWithBitmap (hdc, tox, toy, 0, 0, &bitmap);
}
end_tick = GetTickCount ();
TellSpeed (hwnd, start_tick, end_tick, "Alpha Blended Bitmap", 1000);
bitmap.bmType = BMP_TYPE_ALPHACHANNEL | BMP_TYPE_COLORKEY;
/* Set the color key (the transparent pixel) of the bitmap. */
bitmap.bmColorKey = GetPixelInBitmap (&bitmap, 0, 0);
/* Fill a box with the bitmap with alpha channel and color key. */
start_tick = GetTickCount ();
count = 1000;
while (count--) {
tox = rand() % 800;
toy = rand() % 800;
/* Set a random alpha channel. */
bitmap.bmAlpha = rand() % 256;
/* Fill the box. */
FillBoxWithBitmap (hdc, tox, toy, 0, 0, &bitmap);
}
end_tick = GetTickCount ();
TellSpeed (hwnd, start_tick, end_tick, "Alpha Blended Transparent Bitmap", 1000);
UnloadBitmap (&bitmap);
}

Macro Definition Documentation

#define LoadBitmap   LoadBitmapFromFile

An alias of LoadBitmapFromFile.

See also
LoadBitmapFromFile

Definition at line 7652 of file gdi.h.

#define LoadMyBitmap   LoadMyBitmapFromFile

Alias of LoadMyBitmapFromFile.

See also
LoadMyBitmapFromFile

Definition at line 7828 of file gdi.h.

#define MLS_BLENDMODE_NONE   0x00

This function is used to set attributes of MLShadow slave screen. After creating a slave screen by InitSlaveScreen successfully, you should call this function to set its attributes. When blend_flags is MLS_INFOMASK_ALL, it will set all attributes of slave screen.

Parameters
dc_mlsThe handle to the slave screen.
maskThe attributes mask, can be or'ed values of the following mask:
  • MLS_INFOMASK_OFFSET
    Set x and y offset value of slave screen.
  • MLS_INFOMASK_BLEND
    Set blend mode of slave screen.
  • MLS_INFOMASK_ZORDER
    Set z_order value of slave screen.
  • MLS_INFOMASK_ALL
    Set all attribute value of slave screen.
Parameters
offset_xThe x offset value of slave screen relative to masterscreen.
offset_yThe y offset value of slave screen relative to masterscreen.
blend_flagsThe blend flags, can be one of the following values:
  • MLS_BLENDMODE_COLORKEY
    Set color_key value of slave screen.
  • MLS_BLENDMODE_ALPHA
    Set alpha value of slave screen.
  • MLS_BLENDMODE_NONE
    The value of alpha and color_key is invalid.
Parameters
color_keyThe colorkey value of MLShadow slave screen.
alphaThe alpha value of MLShadow slave screen.
z_orderThe zorder of MLShadow slave screen.
Returns
TRUE on success, FALSE on error.

Definition at line 7564 of file gdi.h.

Typedef Documentation

typedef void(* CB_ONE_SCANLINE)(void *context, MYBITMAP *my_bmp, int y)

The type of scanline loaded callback.

Definition at line 7462 of file gdi.h.

Function Documentation

const char *GUIAPI CheckBitmapType ( MG_RWops fp)

Checks the type of the bitmap in a data source.

This function checks the type of the bitmap in the data source fp, and returns the extension of this type of bitmap file.

Parameters
fpThe pointer to the data source.
Returns
The extension of the type of bitmap file. NULL for not recongnized bitmap type.
See also
RegisterBitmapFileType
int GUIAPI CleanupMyBitmapSL ( MYBITMAP my_bmp,
void *  load_info 
)

Cleanups the scanline loader.

This function cleanups the scanline loader.

Parameters
my_bmpThe pointer to the MYBITMAP object.
load_infoThe initialized information retured by InitMyBitmapSL function.
Returns
0 on success, less than 0 on error.
See also
LoadMyBitmapEx, InitMyBitmapSL, LoadMyBitmapSL
void GUIAPI CompileRGBABitmap ( HDC  hdc,
BYTE bits,
Uint32  pitch,
const BYTE my_bits,
Uint32  my_pitch,
Uint32  w,
Uint32  h,
DWORD  flags,
void *  pixel_format,
CB_DRAW_PIXEL  cb_draw,
MYBITMAP_CONTXT *  mybmp 
)

Convert a MYBITMAP pixel data to a BITMAP pixel data.

This function Convert a MYBITMAP pixel data to a BITMAP pixel data.

Parameters
hdcThe device context.
bitsThe BITMAP pixel data(RGBA etc.).
pitchThe pitch of the BITMAP object.
my_bitsThe MYBITMAP pixel data to be compile.
my_pitchThe pitch of the MYBITMAP object.
wThe width of the MYBITMAP object.
hThe height of the MYBITMAP object.
flagsThe flags of the MYBITMAP object.
pixel_formatThe pixel format of the MYBITMAP object.
cb_drawThe draw callback function.
mybmpThe context of cb_draw.
See also
CompileRGBABitmapEx

Referenced by Expand256CBitmap().

void GUIAPI CompileRGBABitmapEx ( HDC  hdc,
BYTE bits,
Uint32  pitch,
const BYTE my_bits,
Uint32  my_pitch,
Uint32  w,
Uint32  h,
DWORD  flags,
void *  pixel_format,
CB_DRAW_PIXEL  cb_draw,
MYBITMAP_CONTXT *  mybmp,
BYTE alpha_mask 
)

Compile a MYBITMAP pixel data to a BITMAP pixel data.

This function compile a MYBITMAP pixel data to a BITMAP pixel data.

See also
CompileRGBABitmap

Referenced by Expand256CBitmap().

void GUIAPI DeleteBitmapAlphaPixel ( PBITMAP  bmp)

Deletes the bitmap alpha pixel format information of a BITMAP object.

This function deletes the bitmap alpha pixel format information of the BITMAP object bmp.

See also
InitBitmapPixelFormat
void GUIAPI Expand16CBitmap ( HDC  hdc,
BYTE bits,
Uint32  pitch,
const BYTE my_bits,
Uint32  my_pitch,
Uint32  w,
Uint32  h,
DWORD  flags,
const RGB pal 
)
inlinestatic

Convert a 16 color MYBITMAP pixel data to a BITMAP pixel data.

This function compile a 16 color MYBITMAP pixel data to a BITMAP pixel data.

Parameters
hdcThe device context.
bitsThe BITMAP pixel data(RGBA etc.).
pitchThe pitch of the BITMAP object.
my_bitsThe MYBITMAP pixel data to be compile.
my_pitchThe pitch of the MYBITMAP object.
wThe width of the MYBITMAP object.
hThe height of the MYBITMAP object.
flagsThe flags of the MYBITMAP object.
palThe Palette of the MYBITMAP object.
See also
ExpandMonoBitmap, Expand256CBitmap

Definition at line 8087 of file gdi.h.

References FALSE.

void GUIAPI Expand256CBitmap ( HDC  hdc,
BYTE bits,
Uint32  pitch,
const BYTE my_bits,
Uint32  my_pitch,
Uint32  w,
Uint32  h,
DWORD  flags,
const RGB pal,
CB_DRAW_PIXEL  cb_draw,
MYBITMAP_CONTXT *  mybmp 
)
inlinestatic

Convert a 256 color MYBITMAP pixel data to a BITMAP pixel data.

This function compile a 256 color MYBITMAP pixel data to a BITMAP pixel data.

Parameters
hdcThe device context.
bitsThe BITMAP pixel data(RGBA etc.).
pitchThe pitch of the BITMAP object.
my_bitsThe MYBITMAP pixel data to be compile.
my_pitchThe pitch of the MYBITMAP object.
wThe width of the MYBITMAP object.
hThe height of the MYBITMAP object.
flagsThe flags of the MYBITMAP object.
palThe Palette of the MYBITMAP object.
cb_drawThe draw callback function.
mybmpThe context of cb_draw.
See also
ExpandMonoBitmap, Expand16CBitmap

Definition at line 8124 of file gdi.h.

References AddGlyphsToBMPFont(), CompileRGBABitmap(), CompileRGBABitmapEx(), CreateBMPDevFont(), DestroyBMPFont(), FALSE, PaintImageEx(), PaintImageFromFile(), PaintImageFromMem(), PivotBitmap(), PivotScaledBitmapFlip(), RotateBitmap(), RotateBitmapHFlip(), RotateBitmapVFlip(), RotateScaledBitmap(), RotateScaledBitmapHFlip(), RotateScaledBitmapVFlip(), StretchPaintImageEx(), StretchPaintImageFromFile(), and StretchPaintImageFromMem().

void GUIAPI ExpandMonoBitmap ( HDC  hdc,
BYTE bits,
Uint32  pitch,
const BYTE my_bits,
Uint32  my_pitch,
Uint32  w,
Uint32  h,
DWORD  flags,
Uint32  bg,
Uint32  fg 
)

Convert a mono color MYBITMAP pixel data to a BITMAP pixel data.

This function compile a MYBITMAP pixel data to a BITMAP pixel data.

Parameters
hdcThe device context.
bitsThe BITMAP pixel data(RGBA etc.).
pitchThe pitch of the BITMAP object.
my_bitsThe MYBITMAP pixel data to be compile.
my_pitchThe pitch of the MYBITMAP object.
wThe width of the MYBITMAP object.
hThe height of the MYBITMAP object.
flagsThe flags of the MYBITMAP object.
bgThe foreground color of the BITMAP object.
fgThe foreground color of the BITMAP object.
See also
Expand16CBitmap, Expand256CBitmap
int GUIAPI ExpandMyBitmap ( HDC  hdc,
PBITMAP  bmp,
const MYBITMAP my_bmp,
const RGB pal,
int  frame 
)

Expands a MYBITMAP object to a BITMAP object.

This function expands the MYBITMAP object pointed to by my_bmp to a BITMAP object (bmp).

Parameters
hdcThe device context.
bmpThe expanded BITMAP object.
my_bmpThe MYBITMAP object to be expanded.
palThe palette of the MYBITMAP object.
frameThe frame of the MYBITMAP object.
Returns
0 on success, non-zero on error.
void void GUIAPI HFlipBitmap ( BITMAP bmp,
unsigned char *  inter_buff 
)

Horizontal Flip the special Bitmap object.

Parameters
bmpThe BITMAP object.
inter_buffThe one scan line pre-alloc buffer of bitmap.
BOOL GUIAPI InitBitmap ( HDC  hdc,
Uint32  w,
Uint32  h,
Uint32  pitch,
BYTE bits,
PBITMAP  bmp 
)

Initializes a BITMAP object as a normal bitmap.

This function initializes the bitmap pointed to by bmp as a normal bitmap. It sets the bitmap structure fields, and allocates the bits if bits is NULL.

Parameters
hdcThe device context.
wThe width of the bitmap.
hThe height of the bitmap.
pitchThe pitch of the bitmap.
bitsThe bits of the bitmap.
bmpThe BITMAP object to be initialized.
Returns
TRUE on success, FALSE on error.
Note
LoadBitmapEx will initialize the BITMAP object itself.
See also
InitBitmapPixelFormat, UnloadBitmap, Bitmap structure
BOOL GUIAPI InitBitmapPixelFormat ( HDC  hdc,
PBITMAP  bmp 
)

Initializes the bitmap pixel format information of a BITMAP object.

This function initializes the bitmap pixel format information of the BITMAP object pointed to by bmp. This includes bmBitsPerPixel and bmBytesPerPixel fields, and the private pixel format if the bitmap is a bitmap with alpha.

Parameters
hdcThe device context.
bmpThe BITMAP object to be initialized.
Returns
TRUE on success, FALSE on error.
See also
InitBitmap, Bitmap structure
void *GUIAPI InitMyBitmapSL ( MG_RWops area,
const char *  ext,
MYBITMAP my_bmp,
RGB pal 
)

Initializes scanline loader of the MYBITMAP object from a data source.

This function initializes scanline loader of the MYBITMAP object from a data source.

Parameters
areaThe data source.
extThe extension of the type of this bitmap.
my_bmpThe pointer to the MYBITMAP object.
palThe palette will be returned.
Returns
The initialized information which should be passed to LoadMyBitmapSL function, and NULL on error.
See also
LoadMyBitmapEx, LoadMyBitmapSL, CleanupMyBitmapSL
HDC GUIAPI InitSlaveScreen ( const char *  name,
const char *  mode 
)

Initializes slave screen.

Parameters
nameThe gal engine name.
modeThe display mode. For example : 640x480-16bpp.
Returns
Valid handle on success, HDC_INVALID on failure.
int GUIAPI LoadBitmapEx ( HDC  hdc,
PBITMAP  pBitmap,
MG_RWops area,
const char *  ext 
)

Loads a device-dependent bitmap from a general data source.

This function loads a device-dependent bitmap from the data source area.

Parameters
hdcThe device context.
pBitmapThe pointer to the BITMAP object.
areaThe data source.
extThe extension of the type of this bitmap.
Returns
0 on success, less than 0 on error.
Return values
ERR_BMP_OKLoading successfully
ERR_BMP_IMAGE_TYPENot a valid bitmap.
ERR_BMP_UNKNOWN_TYPENot recongnized bitmap type.
ERR_BMP_CANT_READRead error.
ERR_BMP_CANT_SAVESave error.
ERR_BMP_NOT_SUPPORTEDNot supported bitmap type.
ERR_BMP_MEMMemory allocation error.
ERR_BMP_LOADLoading error.
ERR_BMP_FILEIOI/O failed.
ERR_BMP_OTHEROther error.
ERR_BMP_ERROR_SOURCEA error data source.
See also
LoadBitmapFromFile, LoadBitmapFromMem
int GUIAPI LoadBitmapFromFile ( HDC  hdc,
PBITMAP  pBitmap,
const char *  spFileName 
)

Loads a device-dependent bitmap from a file.

See also
LoadBitmapEx
int GUIAPI LoadBitmapFromMem ( HDC  hdc,
PBITMAP  pBitmap,
const void *  mem,
int  size,
const char *  ext 
)

Loads a device-dependent bitmap from memory.

See also
LoadBitmapEx
int GUIAPI LoadMyBitmapEx ( PMYBITMAP  my_bmp,
RGB pal,
MG_RWops area,
const char *  ext 
)

Loads a MYBITMAP object from a data source.

This function loads a MYBITMAP object from the data source area.

Parameters
my_bmpThe pointer to the MYBITMAP object.
areaThe data source.
palThe palette will be returned.
extThe extension of the type of this bitmap.
Returns
0 on success, less than 0 on error.
See also
LoadBitmapEx
int GUIAPI LoadMyBitmapFromFile ( PMYBITMAP  my_bmp,
RGB pal,
const char *  file_name 
)

Loads a MYBITMAP object from a file.

See also
LoadMyBitmapEx
int GUIAPI LoadMyBitmapFromMem ( PMYBITMAP  my_bmp,
RGB pal,
const void *  mem,
int  size,
const char *  ext 
)

Loads a MYBITMAP object from memory.

This function loads a MYBITMAP object from memory.

Parameters
my_bmpThe pointer to the MYBITMAP object.
palThe palette will be retruned through this pointer.
memThe pointer to the memory area.
sizeThe size of the memory area.
extThe extension name used to determine the type of the bitmap.
See also
LoadMyBitmapEx, MYBITMAP
int GUIAPI LoadMyBitmapSL ( MG_RWops area,
void *  load_info,
MYBITMAP my_bmp,
CB_ONE_SCANLINE  cb,
void *  context 
)

Loads MYBITMAP scanlines from a data source one by one.

This function loads MYBITMAP scanlines from the data source area one by one.

Parameters
areaThe data source.
load_infoThe initialized information retured by InitMyBitmapSL function.
my_bmpThe pointer to the MYBITMAP object.
cbThe callback to inform one scanline loaded. It can be NULL.
contextThe context information passed to the callback.
Returns
0 on success, less than 0 on error.
See also
LoadMyBitmapEx, InitMyBitmapSL, CleanupMyBitmapSL
BOOL GUIAPI mlsEnableSlaveScreen ( HDC  dc_mls,
BOOL  enable 
)

Enable or Disable a MLShadow slave screen.

This function is used to enable or diable a MLShadow slave screen. After creating a slave screen by InitSlaveScreen successfully, its default status is diabled.

Parameters
dc_mlsThe handle of MLShadow slave screen.
enableWhether to enable the MLShadow slave screen.
Returns
TRUE on success, FALSE on error.
int GUIAPI PaintImageEx ( HDC  hdc,
int  x,
int  y,
MG_RWops area,
const char *  ext 
)

Paints an image from data source on device directly.

This function paints an image from data source onto device directly.

Parameters
hdcThe device context.
x(x,y), the paint position on device.
y(x,y), the paint position on device.
areaThe data source.
extThe extension of the type of this bitmap.
Returns
0 on success, less than 0 on error.
Return values
ERR_BMP_OKPainted successfully
ERR_BMP_IMAGE_TYPENot a valid image type.
ERR_BMP_UNKNOWN_TYPENot recongnized bitmap type.
ERR_BMP_CANT_READRead error.
ERR_BMP_NOT_SUPPORTEDNot supported bitmap type.
ERR_BMP_MEMMemory allocation error.
ERR_BMP_LOADLoading error.
ERR_BMP_FILEIOI/O failed.
ERR_BMP_OTHEROther error.
ERR_BMP_ERROR_SOURCEA error data source.
See also
PaintImageFromFile, PaintImageFromMem

Referenced by Expand256CBitmap().

int GUIAPI PaintImageFromFile ( HDC  hdc,
int  x,
int  y,
const char *  spFileName 
)

Paints an image from file on device directly.

Parameters
hdcThe device context.
x(x,y), the paint position on device.
y(x,y), the paint position on device.
spFileNameThe file name of the image file.
Returns
0 on success, less than 0 on error.
See also
PaintImageEx

Referenced by Expand256CBitmap().

int GUIAPI PaintImageFromMem ( HDC  hdc,
int  x,
int  y,
const void *  mem,
int  size,
const char *  ext 
)

Paints an image from memory on device directly.

Parameters
hdcThe device context.
x(x,y), the paint position on device.
y(x,y), the paint position on device.
memThe pointer to memory containing image data.
sizeThe size of the image data.
extThe name of the image which indicates the type of the image.
Returns
0 on success, less than 0 on error.
See also
PaintImageEx

Referenced by Expand256CBitmap().

void GUIAPI PivotBitmap ( HDC  hdc,
const BITMAP bmp,
int  x,
int  y,
int  cx,
int  cy,
int  angle 
)

Pivot a bitmap object.

This function aligns the point in the bitmap given by (cx, cy) to (x, y) in device context, then rotates around this point.

See also
PivotScaledBitmapFlip

Referenced by Expand256CBitmap().

void GUIAPI PivotScaledBitmapFlip ( HDC  hdc,
const BITMAP bmp,
fixed  x,
fixed  y,
fixed  cx,
fixed  cy,
int  angle,
fixed  scale_x,
fixed  scale_y,
BOOL  h_flip,
BOOL  v_flip 
)

Rotates, stretches or shrinks, flips a bitmap object.

This function flips the bitmap vertically if v_flip is TRUE, flips the bitmap horizontally if h_flip is TRUE first. Then stretches or shrinks the bitmap according to scale and aligns the point in the bitmap given by (cx, cy) to (x, y) in device context, Finally rotates specified angle pointed to angle in 1/64ths of a degree around this point (cx, cy).

Parameters
hdcThe device context.
bmpThe pointer of BITMAP object.
x(x,y) The x coordinate of a point in fixed point on dc.
y(x,y) The y coordinate of a point in fixed point on dc.
cx(cx,cy) The x coordinate of a point in fixed point on the bitmap.
cy(cx,cy) The y coordinate of a point in fixed point on the bitmap.
angleThe specified rotated angle around its center.
scale_xThe ratio of width of stretching or shrinking the bitmap in fixed point.
scale_yThe ratio of height of stretching or shrinking the bitmap in fixed point.
h_flipThe flags of fliping horizontally.
v_flipThe flags of fliping vertically.

Referenced by Expand256CBitmap().

BOOL GUIAPI RegisterBitmapFileType ( const char *  ext,
void *(*)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal)  init,
int(*)(MG_RWops *fp, void *init_info, MYBITMAP *my_bmp, CB_ONE_SCANLINE cb, void *context)  load,
void(*)(void *init_info)  cleanup,
int(*)(MG_RWops *fp, MYBITMAP *my_bmp, RGB *pal)  save,
BOOL(*)(MG_RWops *fp)  check 
)

Registers a bitmap file loader, saver, and checker.

This function registers a new bitmap file loader, saver, and checker. You should pass the extension of the bitmap files, the functions to init, load, and cleanup this type of bitmap file, the function to save, and the function to check the type.

Parameters
extThe extension name of the type of bitmap file, like "jpg" or "gif".
initThe routine to init the MYBITMAP object (bmp). This routine fills the MYBITMAP structure and get the pallete if needed. It will return the init_info for the following load routine.
loadThe routine to load the scanlines of the bitmap file. This routine will load the initialized MYBITMAP object (bmp) from the data source (fp). It will call the scanline loaded callback (cb) by passing through the context (context), the MYBITMAP object (bmp), and the index of the scanline.
cleanupThe cleanup routine.
saveThe saver of the bitmap file, can be NULL.
checkThe checker of the bitmap file.
Returns
TRUE on success, FALSE on error.
See also
CheckBitmapType, InitMyBitmapSL, LoadMyBitmapSL, CleanupMyBitmapSL, General read/write operations
void GUIAPI ReplaceBitmapColor ( HDC  hdc,
PBITMAP  pBitmap,
gal_pixel  iOColor,
gal_pixel  iNColor 
)

Replaces a specific pixels in a bitmap with another pixel.

This function replaces the specific pixels with value iOColor with the other pixel value iNcolor in the bitmap pBitmap.

Parameters
hdcThe device context.
pBitmapThe BITMAP object.
iOColorThe pixel value of the color will be replaced.
iNColorThe pixel value of the new color.
void GUIAPI RotateBitmap ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle 
)

Rotate a bitmap object.

Parameters
hdcThe device context.
bmpThe pointer of Bitmap object.
lx(lx,ty), the x coordinate of top left corner.
ty(lx,ty), the y coordinate of top left corner.
angleThe specified rotated angle around its center. It must be in 1/64ths of a degree.
See also
PivotScaledBitmapFlip

Referenced by Expand256CBitmap().

void GUIAPI RotateBitmapHFlip ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle 
)

Flips horizontally and rotates a bitmap object.

See also
RotateBitmap

Referenced by Expand256CBitmap().

void GUIAPI RotateBitmapVFlip ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle 
)

Flips vertically and rotates a bitmap object.

This function flips vertically before rotating the bitmap pointed to bmp.

See also
RotateBitmap

Referenced by Expand256CBitmap().

void GUIAPI RotateScaledBitmap ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle,
int  w,
int  h 
)

Stretches or shrinks a bitmap object at the same as rotating it.

See also
RotateBitmap

Referenced by Expand256CBitmap().

void GUIAPI RotateScaledBitmapHFlip ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle,
int  w,
int  h 
)

Flip horizontaly, rotates, stretch or shrinks a bitmap object.

This function is similar to RotateScaledBitmap() expect that it flips the bitmap horizontally first.

See also
RotateScaledBitmap()

Referenced by Expand256CBitmap().

void GUIAPI RotateScaledBitmapVFlip ( HDC  hdc,
const BITMAP bmp,
int  lx,
int  ty,
int  angle,
int  w,
int  h 
)

Flip vertically, rotates, stretch or shrinks a bitmap object.

This function is similar to RotateScaledBitmap() expect that it flips the bitmap vertically first.

See also
RotateScaledBitmap()

Referenced by Expand256CBitmap().

int GUIAPI SaveBitmapToFile ( HDC  hdc,
PBITMAP  pBitmap,
const char *  spFileName 
)

Saves a BITMAP object to a bitmap file.

This function saves the BITMAP object pBitmap to the bitmap file named spFileName.

Parameters
hdcThe device context.
pBitmapThe BITMAP object.
spFileNameThe file name.
Returns
0 on success, less than 0 on error.
See also
SaveMyBitmapToFile
int GUIAPI SaveMyBitmapToFile ( PMYBITMAP  my_bmp,
RGB pal,
const char *  spFileName 
)

Saves a MYBITMAP object to a bitmap file.

This function saves the MYBITMAP object my_bmp to the bitmap file named spFileName.

Parameters
my_bmpThe MYBITMAP object.
palThe palette.
spFileNameThe file name.
Returns
0 on success, less than 0 on error.
See also
SaveBitmapToFile
int GUIAPI SetBitmapKeyColor ( HDC  hdc,
PBITMAP  bmp,
Uint8  r,
Uint8  g,
Uint8  b 
)

Set the bitmap color key.

This function set the bitmap member bmColorKey with the param r,g,b and set the BMP_TYPE_COLORKEY flag.

Parameters
hdcThe device context.
bmpPoint of the bitmap which to set color key.
rThe red componets of RGB color.
gThe green componets of RGB color.
bThe blue componets of RGB color.
Returns
ERR_BMP_OK for success, ERR_BMP_UNKNOWN_TYPE for error.

/sa SetMemDCColorKey

int GUIAPI StretchPaintImageEx ( HDC  hdc,
int  x,
int  y,
int  w,
int  h,
MG_RWops area,
const char *  ext 
)

Paints an image from data source on device directly.

This function paints an image from data source onto device directly with stretch.

Parameters
hdcThe device context.
x(x,y), the paint position on device.
y(x,y), the paint position on device.
wthe width of the stretched bitmap.
hthe height of the stretched bitmap.
areaThe data source.
extThe extension of the type of this bitmap.
Returns
0 on success, less than 0 on error.
Return values
ERR_BMP_OKPainted successfully
ERR_BMP_IMAGE_TYPENot a valid image type.
ERR_BMP_UNKNOWN_TYPENot recongnized bitmap type.
ERR_BMP_CANT_READRead error.
ERR_BMP_NOT_SUPPORTEDNot supported bitmap type.
ERR_BMP_MEMMemory allocation error.
ERR_BMP_LOADLoading error.
ERR_BMP_FILEIOI/O failed.
ERR_BMP_OTHEROther error.
ERR_BMP_ERROR_SOURCEA error data source.
See also
PaintImageFromFile, PaintImageFromMem

Referenced by Expand256CBitmap().

int GUIAPI StretchPaintImageFromFile ( HDC  hdc,
int  x,
int  y,
int  w,
int  h,
const char *  spFileName 
)

Paints an image from file on device directly.

Parameters
hdcThe device context.
x(x,y), the paint position on device.
y(x,y), the paint position on device.
wThe width of the stretched bitmap.
hThe height of the stretched bitmap.
spFileNamethe file name of the image file.
Returns
0 on success, less than 0 on error.
See also
StretchPaintImageEx

Referenced by Expand256CBitmap().

int GUIAPI StretchPaintImageFromMem ( HDC  hdc,
int  x,
int  y,
int  w,
int  h,
const void *  mem,
int  size,
const char *  ext 
)

Paints an image from memory on device directly.

Parameters
hdcThe device context.
x(x,y) the paint position on device.
y(x,y) the paint position on device.
wThe width of the stretched bitmap.
hThe height of the stretched bitmap.
memThe pointer to memory containing image data.
sizeThe size of the image data.
extThe name of the image which indicates the type of the image.
Returns
0 on success, less than 0 on error.
See also
StretchPaintImageEx

Referenced by Expand256CBitmap().

void TerminateSlaveScreen ( HDC  hdc)

Terminates slave screen.

Parameters
hdcThe slave device context.
void GUIAPI UnloadBitmap ( PBITMAP  pBitmap)

Unloads a bitmap.

This function unloads the specified bitmap pBitmap. It will free the private pixel format and the bits of the bitmap.

Parameters
pBitmapThe BITMAP object.
See also
LoadBitmapEx
void GUIAPI UnloadMyBitmap ( PMYBITMAP  my_bmp)

Unloads a bitmap.

This function unloads the specified MYBITMAP object my_bmp. It will free the bits of the bitmap.

Parameters
my_bmpThe pointer to the MYBITMAP object.
See also
LoadMyBitmapEx
void GUIAPI VFlipBitmap ( BITMAP bmp,
unsigned char *  inter_buff 
)

Vertical Flip the special Bitmap object.

Parameters
bmpThe BITMAP object.
inter_buffThe one scan line pre-alloc buffer of bitmap.