How do you make certain colors of a bitmap not show up in C#

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Manifest222
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 9
Joined: Tue Jan 26, 2010 10:17 pm

How do you make certain colors of a bitmap not show up in C#

Post by Manifest222 »

Note that I am using Visual C# 2008 Express Edition right now.

Hey guys, right now I'm working on a level editor and my tile set bitmap is set inside a Picture Box with the name of myTileSetPic.

A problem I have encountered is that with my level editor there are tiles like trees and stuff, but my tiles that are trees have the design of a tree, and then the rest of the tile is white. This is not transparency, but it is just white. What I need to figure out how to do is to take the whiteness of the bitmap, and sort of, cancel it out I guess. I basically need to make it so you can not see the white part of the tile. I have no idea how the hell to do this, so please tell me possibly a way to do this. Thanks.
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: How do you make certain colors of a bitmap not show up in C#

Post by RyanPridgeon »

Here you go :)

http://msdn.microsoft.com/en-us/library ... arent.aspx

This function sets one of the colours in the image to be displayed as transparent I believe.
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: How do you make certain colors of a bitmap not show up in C#

Post by dandymcgee »

RyanPridgeon wrote:Here you go :)

http://msdn.microsoft.com/en-us/library ... arent.aspx

This function sets one of the colours in the image to be displayed as transparent I believe.
Yup, just used that function about 2 hours ago in class.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: How do you make certain colors of a bitmap not show up in C#

Post by RyanPridgeon »

What's funny is I don't even have any form of C# compiler installed. I've never used GDI and I've barely touched the language, but I find this stuff by a couple of searches in google.

I'm amazed people still can't use Google or a good reference like MSDN :lol:

But still happy to help ^^
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
Post Reply