Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Posted
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.
Posted

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

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

Posted
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.
Posted

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...