2 Attachment(s)
[RESOLVED] BitBlt issue smearing the image...
VB6
Windows 7
Using BitBlt to move an image which is my map. The idea is to have my character centered (probably animated, but centered nonetheless) and have the map move so that it appears that the character is traveling. I have the character BitBlt covered. My issue is this...
This is what it looks like at the start:
Attachment 109579
And this is what it looks like when I move it using BitBlt:
Attachment 109581
I am adding 1 to the ByVal X As Long, ByVal Y As Long API call to move the map.
I've attempted
-----Refreshing the final PictureBox
-----Loading the buffer image straight into the final PictureBox
-------------This has resulted in flashing, which the entire purpose of BitBlt is to get rid of that
-----Refreshing the final PictureBox
-----Using PaintPicture
-------------This results the same as the second image above
All of my PictureBoxes have AutoRedraw set to True except my final PictureBox.
Feel free to ask questions if you need help in helping me answer mine.
Re: BitBlt issue smearing the image...
I've had that problem using BitBlt and moving the object manually by mouse down on object and moving the mouse pointer but the smearing stops (picture returns to normal) when the movement stops. Also I don't think you should have AutoRedraw = True; that causes too much overhead. Try using False when you move the object. In my case if I remember it was because the picture was either too big and/or using wrong scale mode or I had AutoRedraw = True.
Re: BitBlt issue smearing the image...
Setting AutoRedraw to True blanks out the image. For BitBlt to work, all PictureBoxes need to have AutoRedraw set to True except the final PictureBox where everything ends up. Stopping the movement (I'm using a Timer) does nothing for the final image. The image is 240x144 pixels, so the size isn't the issue. And the scale I am using works for everything else, so I know that's not it.
Re: BitBlt issue smearing the image...
Quote:
Originally Posted by
Conroy Vanderbluff
Setting AutoRedraw to True blanks out the image. For BitBlt to work, all PictureBoxes need to have AutoRedraw set to True except the final PictureBox where everything ends up. Stopping the movement (I'm using a Timer) does nothing for the final image. The image is 240x144 pixels, so the size isn't the issue. And the scale I am using works for everything else, so I know that's not it.
So, set it to False
EDIT: I think you need to save the rectangle where you are moving to. Then move to that. When you move away restore the area you saved and do this again. What's happening is you are leaving a trail behind you as you BitBlt to a new position
Re: BitBlt issue smearing the image...
Quote:
Originally Posted by
Conroy Vanderbluff
All of my PictureBoxes have AutoRedraw set to True except my final PictureBox.
It was originally.
Re: BitBlt issue smearing the image...
Let me reiterate; whether the AutoRedraw is set to True or False, it doesn't work. One blanks out the image entirely, while the other smears it.
Re: BitBlt issue smearing the image...
Assuming you're bitblting the map from some other source, if you don't clear the exposed area (the area that you are not bitblitting the map to), then of course you are going to see the one pixel band vertically and horizontally of the map left side and top line replicated as you move the map down to the right.
Any part of the buffer you don't draw to is going to have the previous contents of the buffer unless you clear the buffer first.
Re: BitBlt issue smearing the image...
Quote:
Originally Posted by
passel
Assuming you're bitblting the map from some other source, if you don't clear the exposed area (the area that you are not bitblitting the map to), then of course you are going to see the one pixel band vertically and horizontally of the map left side and top line replicated as you move the map down to the right.
Any part of the buffer you don't draw to is going to have the previous contents of the buffer unless you clear the buffer first.
This is exactly what is happening. He needs to find something to draw to the space it moved from. It looks like his tile is smaller than the actual map so he actually has nothing to draw. I think Jacob Roman may have done something like this since he writes a lot of game related stuff. Try PMing him to this thread. He might have some experience with this exact scenario.
Re: BitBlt issue smearing the image...
Quote:
Originally Posted by
Niya
It looks like his tile is smaller than the actual map so he actually has nothing to draw.
Took me a second to understand what you meant by that, but now I get it. Nothing in the previous comments was making sense.
If the character was moving Northwest, eventually the map would have to stop at 0, 0. Thanks for helping me.
Re: [RESOLVED] BitBlt issue smearing the image...