How to use BT_BitmapPaste

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

How to use BT_BitmapPaste

Post by bluebird »

Dear Bos Taurus users,

Has anyone seen an example of how to use BT_BitmapPaste

I want to create a composite bitmap and store several images into it, then save the composite to disk.
Using the logic below, I only see a blank BLUE composite. The function BT_BitmapPaste seems to have no effect.

Are there other steps I need to take to make it work properly?

I hope the code fragment below is enough to explain what I have tried.

Thanks to any friend who can help.

*--------------------------------------------------------------------------------------------------------------------
PS If I use the BT_DrawSetPixel and Get pixel color functions inside suitable loops, I can get what I
want, It is slow but its does work.
I was hoping the paste function would speed things up by doing the xfer in a block.
*---------------------------------------------------------------------------------------------------------------------

// create a composite bitmap to receive a collection
// of other image bitmaps

Private hBitmap_C

hBitmap_C:=BT_BitmapCreateNew (1400, 1200, BLUE )

// later on in the PRG, call the function below to fill in
// a part of hBitmap_C with some jpg image

*--------------------------------------
Function SaveComposite()
*---------------------------------------
Local hBitmap_2
// read a component file and paste it into the composite destination
// hBitmap_C. Save the composite to disk.

hBitmap_2:=BT_BitmapLoadFile("AnyImageFile.jpg")

BT_BitmapPaste (hBitmap_C, 350, 375, 650, 500, BT_SCALE,hBitmap_2)

BT_BitmapSaveFile (hBitmap_C, "BTtest_Composites.jpg", BT_FILEFORMAT_JPG) //the result is only a plain blue image.


//Releasing the bitmaps


BT_BitmapRelease (hBitmap_2)

BT_BitmapRelease (hBitmap_C)

Return
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: How to use BT_BitmapPaste

Post by bpd2000 »

Refer demo C:\hmg\SAMPLES\BosTaurus\Demo8.prg
BPD
Convert Dream into Reality through HMG
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: How to use BT_BitmapPaste

Post by mustafa »

Hola amigo bluebird:
Mira el codigo fuente , si te puede servir ?

http://www.hmgforum.com/viewtopic.php?f ... int#p47324

Screenshot_Captura_Pantalla_New_9-Mail_Counter_Print.zip

Saludos
Mustafa
*--------------------------------------------------------------------------------------------------------------------*
Hello Friend bluebird
Look at the source code ,if it can help you?

http://www.hmgforum.com/viewtopic.php?f ... int#p47324

Screenshot_Captura_Pantalla_New_9-Mail_Counter_Print.zip

Regards
Mustafa
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: How to use BT_BitmapPaste

Post by bluebird »

To all friends who replied.

I finally traced my problem to not having released the BTStruct array associated with the composite bitmap hCD.
After closing the array with BT_DeleteDC (BTstruct) the Composite jpg image was as expected.

I had to release this array before trying to use BT_BitmapPaste and saving the composite file.

Thanks for your responses
Post Reply