VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I told you I'd reply back, but so quick? DiscoStew (3 replies, 0 views) (2001-Mar-7) The problem with the Left (and Top) sides of the screen is a result from your clipping technique.
Set the values for the right and bottom of your destrect is correct, but the value of your left and top aren't.
When you set the left/top values, you used your Sqr(Value ^ 2) to get the absolute value, which would have been easier to just do this -> Abs(Value), but this is still incorrect for this problem. When you did this, you took the DestRect value, did the calculation, and placed it in the SrcRect, which is a no-no.
Ex:
SrcRect has value of...
Left = 64
Top = 96
Right = 96
Bottom = 128
...and you want to place this at position -10,-10
With you code, the srcrect would have become...
Left = Sqr((-10) ^ 2) = 10
Top = Sqr((-10) ^ 2) = 10
Right = 96
Bottom = 128
...that how it shows a stretching effect.
To fix this, you change it to...
If .Top < 0 then
SrcRect.Top = SrcLeft.Top - .Top (since .Top is negative, it would add instead of subtract)
.Top = 0
End If
If .Left < 0 then
SrcRect.Left = SrcLeft.Left - .Left (since .Left is negative, it would add instead of subtract)
.Left = 0
End If
I hope I hasn't being a pest about what you did wrong in the code, I just wanted to show you what had resulted. I hope this helps you.
|