Silly language question. I have an image on a form. How do I display from a bitmap in memory?
I need to display a cropped section of an image file to anIMAGE
DEFINE IMAGE myphoto
ROW 10
COL 10
WIDTH 220
HEIGHT 180
PICTURE myfile
HELPID Nil
VISIBLE .T.
STRETCH .F.
ACTION Nil
END IMAGE
eg:
hBitmap1 := BT_BitmapLoadfile("myfile.jpg")
hBitmap2 := BT_BitmapClone(hBitmap1, 1,160,160,100)
How do I get the image to display the cropped image hBitmap2 ?
I saved the bitmap to a file and then place the file name in myfile
eg: myfile:="Newfile.jpg"
I would like to display directly from the bitmap and not need to save the file.
--Russ
Display Image from bitmap
Moderator: Rathinagiri
Re: Display Image from bitmap
Hi Russ,RussBaker wrote:Silly language question. I have an image on a form. How do I display from a bitmap in memory?
....
I would like to display directly from the bitmap and not need to save the file.
Please take a look for the following function from the BosTaurus library:
Code: Select all
Function BT_HMGSetImage (cFormName, cControlName, hBitmap, lReleasePreviousBitmap)
LOCAL hWnd, k
IF ValType (lReleasePreviousBitmap) <> "L"
lReleasePreviousBitmap := .T.
ENDIF
k := GetControlIndex (cControlName, cFormName)
IF k > 0
#ifdef __HMG__ // HMG Extended
IF _HMG_aControlContainerHandle [k] <> 0 .AND. lReleasePreviousBitmap == .T.
BT_BitmapRelease (_HMG_aControlContainerHandle [k])
ENDIF
_HMG_aControlContainerHandle [k] := hBitmap
_HMG_aControlWidth [k] := BT_BitmapWidth (hBitmap)
_HMG_aControlHeight [k] := BT_BitmapHeight (hBitmap)
#else // HMG Official
IF _HMG_SYSDATA [37, k] <> 0 .AND. lReleasePreviousBitmap == .T.
BT_BitmapRelease (_HMG_SYSDATA [37, k])
ENDIF
_HMG_SYSDATA [37, k] := hBitmap
_HMG_SYSDATA [20, k] := BT_BitmapWidth (hBitmap)
_HMG_SYSDATA [21, k] := BT_BitmapHeight (hBitmap)
#endif
hWnd := GetControlHandle (cControlName, cFormName)
#define _STM_SETIMAGE_ 0x0172
#define _IMAGE_BITMAP_ 0
SendMessage (hWnd, _STM_SETIMAGE_, _IMAGE_BITMAP_, hBitmap)
#undef _IMAGE_BITMAP_
#undef _STM_SETIMAGE_
ENDIF
Return NIL
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: Display Image from bitmap
Grigory Filatov is correct
Refer following example for Resize Image and Set Control Image
C:\hmg\SAMPLES\BosTaurus\demo13.prg
Refer following example for Resize Image and Set Control Image
C:\hmg\SAMPLES\BosTaurus\demo13.prg
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
Re: Display Image from bitmap
gfilatov,
Thanks.
I've browsed the BosTaurus samples and believe this is my new friend. So much power in those.
I think BosTaurus will answer many of my graphic challenges.
--Russ
Thanks.
I've browsed the BosTaurus samples and believe this is my new friend. So much power in those.
I think BosTaurus will answer many of my graphic challenges.
--Russ