music7611 Posted January 15, 2005 Posted January 15, 2005 I have a Bitmap and I wanted to set the transparent color. I decided to use MakeTransparent(), but it seems that just adds the color to a list of transparent colors. Is there a way to set the one and only transparent color? Quote
ThePentiumGuy Posted January 16, 2005 Posted January 16, 2005 Yeah just call myBitmap.MakeTransparent(Color.Something) only once and only for one color -TPG Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
music7611 Posted January 16, 2005 Author Posted January 16, 2005 Yeah that could work except my program has one of those things where you have the little eye dropper on the image and you need to select a color to be transparent. It works just fine when they click once, but when they click on that color then another color, they both become transparent. Quote
ThePentiumGuy Posted January 16, 2005 Posted January 16, 2005 Oh yikes. Just add a boolean check andsee if you've already made it transparent.... oh wait, then how would you remove the previous transparent color? Hmm. I guses your only choice is: Public Sub ChangeColor(mynewcolor as color) Dim temp as new bitmap(mybitmap.image) temp.maketransparent(mynewcolor) mybitmap = new bitmap(temp.image) mybitmap = temp End Sub Since youre not really making a game, i doubt it would make a performance hit in yoru application since you're not rendering objects every frame...etc -TPG Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
music7611 Posted January 16, 2005 Author Posted January 16, 2005 First of all, I am making a game (funny you say so) but this part is only the tool you use to make tilesets. The problem with this is, lets say I have a 256 tile tileset (worst case scenario), then it has to store 512 images. I don't think its worth storing the same image twice for every tile in the game. So, until I can think of something better, the only thing to do is select the transparent color and hope the user can tell whether it works or not. Quote
ThePentiumGuy Posted January 17, 2005 Posted January 17, 2005 Hmm. It's still only a tool :D, even though it's for a game :cool: , I still doubt it would affect your performacnce a lot, except for that one time where it has to update the new color. You're really not storing 512x512 images, since you store it back into the original bitmap (or array of bitmaps) anyways. So give it a shot. Yeah it would probably be a performance hit but just for a second or two while it updates(if you're using HUGE amounts of tiles, but your 256x256 scenario would take a lot less time, depending on the size of the image) -The Pentium Guy Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.