Control.picture and Bitblt'ing

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Control.picture and Bitblt'ing

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:31 pm

by Jens Richnow >> Fri, 2 Feb 2001 0:40:23 GMT

Could somebody please help with some basic API stuff linked to JADE (since I'm not too familar with the in's and out's of the Windows API).

Basically what I want to achieve is taking a number of images, stored as Binaries in a Class, manipulate these images using API's (Bitblt, StretchBlt, etc.) and MemoryDC's, and finally pass the finished image back into the Control.picture property for temporary storage/display.

If I leave the Jade part out of the equation, everything works fine: I can read the images from a file, manipulate the images using MemoryDC's and display (bitblt) the finished image on the appropriate control. Now I don't wont to do this stuff all the time when the Control needs to be repainted (form minimised; form partially or completely covered by another form; different button states, etc.). Can the image created (using, for instance, CreateCompatibleBitmap) be stored as a binary in the Control.picture property (or Class.image [Binary], for that matter)? All, I've got at the moment is the handle to the DC, but nothing to the bitmap itself.

Any help is greatly appreciated.

Jens

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Control.picture and Bitblt'ing

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:31 pm

by David Mitchell >> Fri, 2 Feb 2001 1:21:15 GMT

Once you have BitBlt'ed onto the control you should be able to use createPicture, which returns a binary.

David

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Control.picture and Bitblt'ing

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:31 pm

by Jens Richnow >> Fri, 2 Feb 2001 2:22:47 GMT

I just tried it, but the image stored is that of the control itself rather then the bitblt'ed image "draped" over the control:

vars pic :Binary;begin

... all the bitblt'ing resulting in dislaying the finished image on the button...
pic := button3.createPicture(true, false, 24);
pic.convertToFile("C:\Temp\Test.png", PictureType_Png);
button3.picture := pic;
end;

I added teh picture file save to confirm which image is actually created, and it alsways that of the Windows-like button3 control itself.

Do I miss something, or is there a timing issue involved?

Regards

Jens

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Control.picture and Bitblt'ing

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:31 pm

by Carl Ranson >> Sun, 4 Feb 2001 20:51:38 GMT

I've done some stuff like this before, you're best bet is to take control of the painting yourself and do it with the win API's.

Cheers,
CR


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 30 guests