Source Graphic for BitBlt 
Author Message
 Source Graphic for BitBlt

Hi,

I know I'm probably missing something obvious but...

I need to load a large bitmap with shapes I plan to use for animation with
BitBlt.  I think I have everything figured out except that I need to be able
to load the bitmap in memory so I can reference it without having to use the
form picture property or an image/picture box, all of which will clip it and
the graphic is bigger than the form.

I'm sure this is done with a combination of CreateCompatibleDC and LoadImage
or LoadPicture but I can't figure it out and the reference library was no
help.

If anyone could give me a push in the right direction or a link with
instructions I would be very grateful

Thanks in Advance

Perry

Remove X is replying by email.



Sat, 08 May 2004 09:25:18 GMT  
 Source Graphic for BitBlt
The picture *is* loaded into memory when you assign it to the Picture
property of a Picture Box (or to a stdPicture object or to an Image control
or to your Form). If, for example, you load the picture into a standard
Picture Box (Autosize = False) and the picture is larger than the box then
some of it will, of course, be clipped. However, it is only the actual
display that is clipped. The Picture property continues to point to the
original full size picture in memory. I'm not sure how you intend to
"reference" the picture (as you have said you want to do) but you should
have no problems doing it. As a start, I would suggest loading your picture
into a standard picture object, where you should be able to get at any part
of it with either the PaintPicture method or the appropriate API stuff.

Dim p1 As StdPicture
Set p1 = LoadPicture("c:\mypic.bmp")

Mike


Quote:
> Hi,

> I know I'm probably missing something obvious but...

> I need to load a large bitmap with shapes I plan to use for animation with
> BitBlt.  I think I have everything figured out except that I need to be
able
> to load the bitmap in memory so I can reference it without having to use
the
> form picture property or an image/picture box, all of which will clip it
and
> the graphic is bigger than the form.

> I'm sure this is done with a combination of CreateCompatibleDC and
LoadImage
> or LoadPicture but I can't figure it out and the reference library was no
> help.

> If anyone could give me a push in the right direction or a link with
> instructions I would be very grateful

> Thanks in Advance

> Perry

> Remove X is replying by email.



Sat, 08 May 2004 18:07:35 GMT  
 Source Graphic for BitBlt


Quote:
>I need to load a large bitmap with shapes I plan to use for animation with
>BitBlt.  I think I have everything figured out except that I need to be able
>to load the bitmap in memory so I can reference it without having to use the
>form picture property or an image/picture box, all of which will clip it and
>the graphic is bigger than the form.

>I'm sure this is done with a combination of CreateCompatibleDC and LoadImage
>or LoadPicture but I can't figure it out and the reference library was no
>help.

The API Guide has examples and _declarations_ for Functions and
Constants
http://www.allapi.net/
You may not find the examples to be particularly useful so:

  Dim hdcMem As Long
  Dim hbmp As Long
  Dim oldhbmp As Long
  Dim FileName As String

  'Load a source image
  FileName = "whatever.bmp"
  hbmp = LoadImage(0, FileName, IMAGE_BITMAP, _
                   0, 0, LR_LOADFROMFILE Or LR_CREATEDIBSECTION)

  hdcMem = CreateCompatibleDC(0)
  oldhbmp = SelectObject(hdcMem, hbmp)

'The image is now in the memory device context and you can draw to it,
'and Blit to/from it. You must clean up when you've finished.

 SelectObject hdcMem, oldhbmp
 DeleteObject hbmp
 DeleteDC hdcMem

If you need any more than I would suggest you cross post to:
microsoft.public.vb.winapi.graphics

--
Richard Mason



Sun, 09 May 2004 03:45:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Graphics with BitBlt

2. Graphics with BitBlt

3. BitBlt-=-sndPlaySound & other graphics

4. BitBlt-=-sndPlaySound & other graphics

5. Bitblt source: image file vs ImageListControl, which is better

6. Q: BitBlt w/out source visible?

7. Graphic source in code??

8. VB source for school grading program with graphics

9. Need Source for graphics/images on toolbar buttons?

10. Source of playing card graphics

11. source for .emf graphic files?

12. Looking for VB Graphics Source - Help

 

 
Powered by phpBB® Forum Software