Hey, its probably something really simple but when I use TransparentBlt, my image comes out far too big for the screen and I cant seem to fix it. It worked perfect when just using BitBlt so I've probably messed something up.
Yeah I've looked at that to get the function. What parameters would you suggest I use? The "theSprite.x/y+548" was used in the bitblt function because it was too large, so I assumed using it again would work but its not. Apart from that I dont see much else wrong.
Yeah, apart from the error nothing's wrong (probably).
I mean, what do you expect when you pass nonsensical values for the destination size?
What are you trying to do in the first place?
Just display a bitmap sprite on the screen with transparency for my game, it was working fine with the Bitblt but I didnt want do go any further with the game until I had transparency. At the moment its just all stretched and stretches more as you move to the right hand side of the screen.
Unless you want to stretch/distort the image, the dest size and source size should be the same. Per Athar's link, the parameter list is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
BOOL TransparentBlt(
__in HDC hdcDest, // the 'dest' DC to draw to
__in int xoriginDest, // X coord on the dest to draw to
__in int yoriginDest, // Y coord
__in int wDest, // how many pixels wide the image will appear on dest
__in int hDest, // how many pixels tall
__in HDC hdcSrc, // the 'source' DC from which the image is pulled from
__in int xoriginSrc, // where on the DC the image is coming from
__in int yoriginSrc, // " "
__in int wSrc, // how many pixels wide the image is on the source DC
__in int hSrc, // how many pixels tall it is
__in UINT crTransparent // the transparent color
);
Now look at what you're passing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
TransparentBlt(
backHDC, // dest DC
theSprite.x, // dest x
theSprite.y+5, // dest y
theSprite.x+548, // dest width
theSprite.y+548, // dest height
bitmapHDC, // src dc
0, // src x
0, // src y
61, // src w
68, // src h
RGB(255,255,255));
You're taking an image that is 61 x 68 and stretching it to 548+ x 548+ !
What Athar was saying is that you should actually understand the parameters you're passing, rather than just pass nonsense and hope it works. Here, passing theSprite.x+548 doesn't make any sense -- and had you read what the parameters are actually for, you might have noticed that for yourself. ;P