Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 How do I make the green transparent:[![](http://www.freemmorpgmaker.com/files/imagehost/pics/4e465e040df9ca76722f51a8a362336a.jpg)](http://www.freemmorpgmaker.com/files/imagehost/#4e465e040df9ca76722f51a8a362336a.jpg) Link to comment Share on other sites More sharing options...
Kool_dude4ever Posted August 5, 2010 Share Posted August 5, 2010 did u try making it black? instead of green ? Link to comment Share on other sites More sharing options...
Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 I don't want it black or green. I want it transparent Link to comment Share on other sites More sharing options...
Kool_dude4ever Posted August 5, 2010 Share Posted August 5, 2010 @Mikekan13:> I don't want it black or green. I want it transparenti think black shud automaticly make it transparent.. i dont remember just try Link to comment Share on other sites More sharing options...
Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 That does not make sense Link to comment Share on other sites More sharing options...
jcsnider Posted August 5, 2010 Share Posted August 5, 2010 nless you are blting to a direct draw surface and then to a object (picturebox) I have not found an ideal way to do this.One of the few ways I have attempted this included a nasty memory leak. I didn't research too much though. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 5, 2010 Share Posted August 5, 2010 There's a pretty useful function that you can use to do this actually. It's called **TransparentBlt**. It's similar to **BitBlt**, but it has some extra parameters.```Private Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hDC 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean```Either keep it privately declared or publicly declare it depending on your needs. Here's the breakdown of the parameters, from left to right:hDC - The handle device context you want to blit to. This is usually a form or a picturebox, basicallyx - X-coordinate where you want the graphic on the form/pictureboxy - Y-coordinate where you want the graphic on the form/pictureboxnWidth - Width of the graphicnHeight - Height of the graphichSrcDC - Picturebox or form you're obtaining your graphics from (may need to create your own picturebox and load the graphics onto it since Origins uses BltToDC)xSrc - X-coordinate of the graphic to start loading from (Ex: Your sprite has 12 sprites on the sprite sheet, and they're all in 32 x 32 format. Putting 96 as the xSrc would start loading the 3rd sprite)ySrc - Y-coordinate of the graphic to start loading fromnSrcWidth - You should keep this value the same as **nWidth**nSrcHeight - You should keep this value the same as **nHeight**crTransparent - The transparency. Place **RGB(0, 0, 0)** here, as that makes the graphic appear transparent.Well, that's all. I hope that helps! Link to comment Share on other sites More sharing options...
Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 Hey that looks great! Thank you I will give it a go. Link to comment Share on other sites More sharing options...
Robin Posted August 5, 2010 Share Posted August 5, 2010 @David:> I think black shud automaticly make it transparent.. I dont remember just tryLeave this section and never come back.@Mikekan13:> Hey that looks great! Thank you I will give it a go.Be careful when using that function. Old versions of Eclipse use BitBlt so much that they practically double the amount of memory used by having to load all the graphics into separate pictureBoxes to render them. It should be okay with the occasional sprite, as they're small bitmap images, but make sure you load/unload them properly. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 5, 2010 Share Posted August 5, 2010 Yeah, I was aware that this function is similar to BitBlt in terms of its large memory usage, but I didn't have any other solution for him, and I figured, like you said, that it's fine to use occasionally. Link to comment Share on other sites More sharing options...
Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 Ok thanks guys. Im only going to use it this once. Link to comment Share on other sites More sharing options...
Mikekan13 Posted August 5, 2010 Author Share Posted August 5, 2010 hmm I can't get this to work. I have tried it several different ways and it just won't blt the image at all. ```TransparentBlt frmMenu.picSprite, 0, 0, frmMenu.picSprite.width, frmMenu.picSprite.height, frmMenu.picSrc.Picture, 32 * 7, 0, frmMenu.picSprite.width, frmMenu.picSprite.height, RGB(4, 255, 17)```Edit: nm I guess this only works for picture boxes and not pictures. Still have not gotten it to do what I want but it will atleast blt the imageI also dont see how this can help me if it has to be used on a picture box. even if I make the green transparent the picture box will still show up. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 6, 2010 Share Posted August 6, 2010 Blit the graphics directly on the form instead of on a picturebox. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now