[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
GBMPDISP()
Display a bitmap (.BMP) file on screen
------------------------------------------------------------------------------
Syntax
GBMPDISP(<aBmpArray> | <cFile>, <nX>, <nY>, [<nTransColor>]
--> NIL
Arguments
<aBmpArray> defines the pointer created with GBMPLOAD().
-OR-
<cFile> defines the .BMP file to be displayed.
<nX> is the position of the starting point on the X-axis (column).
<nY> is the position of the starting point on the Y-axis (line).
<nTransColor> is the color to be excluded.
If <nColor> is set, all colors in the image are displayed except
<nColor>.
Returns
GBMPDISP() always returns NIL.
Description
GBMPDISP() displays a bitmap (.BMP) or icon (.ICO) file previously
loaded into memory or display a BMP directly from disk. This function
can be used only if you have set the screen to a graphic mode using SET
VIDEOMODE. GBMPDISP() respects the constraints defined by GSETCLIP().
Warning! The current color palette is used when you display a .BMP.
Be aware that if you allow users to modify the color palette, the colors
used in creating your .BMP may be changed because of the current palette
components.
Notes
It is possible to create visual effects on top of a .BMP, such as a
button that appears to be depressed when the user clicks on it. This
can be done by superimposing a rectangle in XOR mode:
#include "Llibg.ch"
LOCAL aMyButton
SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16
// Load the BMP
aMyButton := gBmpload ("MyButton.BMP")
// Display the BMP, always in SET mode
gBmpDisp (aMyButton,100,200)
.
. // Your code
.
IF mState()[LLM_STATE_LEFT] == LLM_BUTTON_DOWN
// When the mouse button is pressed, we superimpose a BMP
gRect( 100,;
200,;
100 + aMyButton[LLG_BMP_X],;
200 + aMyButton[LLG_BMP_Y],;
LLG_FILL,;
8,;
LLG_MODE_XOR)
ENDIF
// As long as the button is down...
DO WHILE mState()[LLM_STATE_LEFT] == LLM_BUTTON_DOWN
.
. // Your code
.
ENDDO
// When the mouse button is released we reload
// the BMP to restore the original look
gRect(100,;
200,;
100 + aMyButton[LLG_BMP_X],;
200 + aMyButton[LLG_BMP_Y],;
LLG_FILL,;
8,;
LLG_MODE_XOR)
Examples
. This example displays buttons previously stored in aIcons
using gBmpLoad():
gBmpDisp(aIcons,100,200)
. This example loads and displays a background without using a
variable. In this case, the area occupied in VMM when the array is
loaded, is freed by CA-Clipper once the display ends.
gBmpDisp(gBmpLoad("MyDesk.BMP") , 0 , 0 )
See Also:
GBMPLOAD()
GSETPAL()
GWRITEAT()
SET VIDEOMODE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson