Please help me with this source.
Please help me with this source.
(OP)
Ok, if you can do this you not only have skill but exprience. i have yet to find a book or a person who can help me although i have seen it in .exe form.
i need to take a bitmap file w/ several "sprites" in it going from left to right and upload it as one bitmap image ("Picture1") and select settain sprites from the whole thing so i can use them as seprate pictures so i can save space by not having 5000 seperate pictures.
btw im going to animate them but i think i have that part figured out yet.
i have been pointed in sooooo many directions rangeing from "bit blt" to mid$ and left$ none of whice were very prosperous. so if you have some source w/ what i need in it or you can write it or explain it for me i would be very greatfull and do you a favor if you should hapen to need one.
Dave
i need to take a bitmap file w/ several "sprites" in it going from left to right and upload it as one bitmap image ("Picture1") and select settain sprites from the whole thing so i can use them as seprate pictures so i can save space by not having 5000 seperate pictures.
btw im going to animate them but i think i have that part figured out yet.
i have been pointed in sooooo many directions rangeing from "bit blt" to mid$ and left$ none of whice were very prosperous. so if you have some source w/ what i need in it or you can write it or explain it for me i would be very greatfull and do you a favor if you should hapen to need one.
Dave
RE: Please help me with this source.
But anyway: There's an animation control supplied - is that not any good to you?
It does limit you to no-sound avi files or rle compressed avi files.
Below is example text from VB help file.
Mike
The following example opens an .avi file by using the Open Dialog, and begins playing it automatically. To try the example, place an Animation control and a CommonDialog control on a form, and paste the code into the form's Declarations section. Run the example, and choose an .avi file to open.
Private Sub Animation1_Click ()
With CommonDialog1
.Filter = "avi (*.avi)¦*.avi"
.ShowOpen
End With
With Animation1
.Autoplay = True
.Open CommonDialog1.Filename
End With
End Sub
Mike Lacey
Mike_Lacey@Cargill.Com
Cargill's Corporate Web Site
RE: Please help me with this source.
I know what you want to do. You could use the Paintpicture method but for speed and functionality you need to become familiar with BitBlt. Below is a very quick and dirty intro.
BitBlt has the following declaration:
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
where
hDestDC is the handle to the device context you want to BitBlt to - or, in English, a reference number to the object you want to draw on. It also means that you can only BitBlt to certain controls, i.e. ones which have an hDC, e.g. a Form, a PictureBox, a Frame, etc. You cannot BitBlt to an Image control.
x and y are the X and Y co-ordinates of the destination - i.e. the top left corner of the picture you "paste" will be here. These are usually both 0 if you want to place the picture in the top left corner of the target but you needn't - you can choose to paste it anywhere in the image.
nWidth and nHeight specify the size of the image to be pasted. This can be bigger or smaller than either the source or the target - so you can "copy" a piece from a picture and "paste" it anywhere in the target.
hSrcDC is the hDC to the picture you want to BitBlt from. Same restraints and conditions as with the destination hDC (hDestDC).
xSrc and ySrc are the co-ordinates from which you would like to start BitBlt-ing on the source picture. Again, these are usually 0, but in your case you will set them to the top-left corner of the picture you want to copy from within the larger image. Note that there are no Width or Height parameters which means that the part of the picture you copy cannot be resized (with this function - there are others which can do it).
dwRop is a flag representing the Raster Operation - i.e. how it "pastes" the source into the destination. I've listed the ROps below. For the moment play with SRCCOPY.
Private Const BLACKNESS = &H42
Private Const DSTINVERT = &H550009
Private Const MERGECOPY = &HC000CA
Private Const MERGEPAINT = &HBB0226
Private Const NOTSRCCOPY = &H330008
Private Const NOTSRCERASE = &H1100A6
Private Const PATCOPY = &HF00021
Private Const PATINVERT = &H5A0049
Private Const PATPAINT = &HFB0A09
Private Const SRCAND = &H8800C6
Private Const SRCCOPY = &HCC0020
Private Const SRCERASE = &H440328
Private Const SRCINVERT = &H660046
Private Const SRCPAINT = &HEE0086
Private Const WHITENESS = &HFF0062
Now you have the tools. To play with with them you will need (at least) two PictureBox controls. Make sure that their AutoRefresh properties are set to True. I would also suggest setting the ScaleMode to Pixel (3) and the AutoResize to False after yoo have loaded pictures into the picture boxes (at design time).
Try the following:
BitBlt Pic1.hDC, 0, 0, 20, 20, Pic2.hDC, 5, 5, SRCCOPY
Pic1.Refresh
Note the Refresh - It's quite important.
This should copy a 20x20 pixel area from Pic2 (starting 5 pixels in and 5 pixels down) to the top left corner of Pic1.
Good Luck. If you need more samples I'll be glad to help.
Ian
RE: Please help me with this source.
-ml
Mike Lacey
Mike_Lacey@Cargill.Com
Cargill's Corporate Web Site
RE: Please help me with this source.
RE: Please help me with this source.
There are some some other factors to take into consideration though. Firstly, the PictureClip control looks like a wrapper for BitBlt & StretchBlt and, as can be expected, the really nice bits were ignored. Secondly, the use of "sprites" usually implies some form of transparency, which means that BitBlt is going to have to be used anyway, so why bother to add an 80K control when you don't really need it.
Should I need to store five or six images, I wouldn't bother with the overhead; should I need to store 5000 and not require transparency then PictureClip looks attractive. But then being a control-freak (as opposed to a Control-freak) - and aren't all programmers - I would hate to waste all the effort I put into the BitBlt routines! B-)
-Ian