Saving Bitmaps 
Author Message
 Saving Bitmaps

Hi,

Anyone have an example of saving a bitmap to disk?

I'n BitBlt'ing a small bitmap onto a larger one (both in picture boxes), and
I want to save the resultant (merged) image as a bitmap or wmf.

The problem is that the picture boxes don't know that the second bitmap
exists (it's only drawn onto the DC).

I've got a feeling that it's something like CreateCompatibleBitmap and then
...?
Or maybe CopyRect?  Doesn't seem to work tho.

This _must_ be a common problem, but I can't get any info anywhere!
I'm CAN'T use third-party controls or DLLs, tho I may be able to get away
with the DIBAPI.DLL (Proj Mgr wants to stay with the standard controls).

Thanks.

LC.



Sat, 10 Feb 2001 03:00:00 GMT  
 Saving Bitmaps
I've got a way around it now, thanks.

What I'm doing is compositing a number of symbols (weather symbols) onto a
background map.

The final image then needs to be saved to a file.

The problem was that PaintPicture or BitBlt doesn't actually modify the
image in the picturebox, but simply draws on top of it, so if you use
SavePicture, you get the original image :-(

What I finally worked out is this:

Create a handle to a compatible bitmap for the source image
(CreateCompatibleBitmap)
Select the object into the destination picture (SelectObject)
BitBlt the picture from the source to the destination (BitBlt)
Copy the contents of the source to the clipboard
The just paste the data to the destination picture from the clipboard

Thanks all the same.

LC.



Sun, 11 Feb 2001 03:00:00 GMT  
 Saving Bitmaps

writes

Quote:
>I've got a way around it now, thanks.

>What I'm doing is compositing a number of symbols (weather symbols) onto a
>background map.

>The final image then needs to be saved to a file.

>The problem was that PaintPicture or BitBlt doesn't actually modify the
>image in the picturebox, but simply draws on top of it, so if you use
>SavePicture, you get the original image :-(

>What I finally worked out is this:

>Create a handle to a compatible bitmap for the source image
>(CreateCompatibleBitmap)
>Select the object into the destination picture (SelectObject)
>BitBlt the picture from the source to the destination (BitBlt)
>Copy the contents of the source to the clipboard
>The just paste the data to the destination picture from the clipboard

For graphics questions a much better forum than this one is
microsoft.public.vb.winapi.graphics and a similar question has just been
answered there under the thread "BitBlt then save to BMP?"

picDest.AutoRedraw = True
BitBlt's
'Display the Image
picDest.Refresh
'Save the Image (Picture doesn't exist)
SavePicture picDest.Image, filename

'Alternatively
picDest.AutoRedraw = True
BitBlt's
'Set the Picture and display the Image
picDest.Picture = PicDest.Image
SavePicture picDest.Picture, filename

--
Richard Mason



Mon, 12 Feb 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Saving Bitmaps

2. Help! Saving Bitmaps

3. Saving Bitmaps to different color modes

4. saving bitmaps, icons, metafiles in 1 file

5. Saving bitmaps.

6. How to save bitmaps/wav files in Resource File

7. HELP!! - Saving Bitmaps+Data

8. Saving Bitmaps to a Database

9. Saving Bitmaps with SavePicture

10. Saving Bitmaps

11. Saving Bitmaps to a Database

12. Saving bitmaps into a database

 

 
Powered by phpBB® Forum Software