Jump to content
  • Advertisement
Sign in to follow this  
Hikaru

[.net] Split textures with transparency :S

This topic is 4502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi! I'm currently making a tilebased mapeditor using c# and directx9. up til now i've used Bitmaps as textures, but now i want to have the ability to use transparency. I've converted my tileset from bmp to tga but i don't know how to split it into many textures. my earlier split-function looks something like this, using clone() to split up my tileset into many tiles:
Bitmap [,] textures = new Bitmap[Rows,Cols];
System.Drawing.Bitmap tileset = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile("tileset.bmp");
				
System.Drawing.RectangleF rect;

Texture [,] tileTextures = new Texture[Rows,Cols]; 

for(int x = 0; x<Cols; x++)
{
	for(int y=0; y<Rows; y++)
	{
		rect= new RectangleF(new PointF(x*w,y*h),new SizeF(w,h));
		textures[x,y] = tileset.Clone(rect,tileset.PixelFormat);
		tileTextures[x,y] = Texture.FromBitmap(device, textures[x,y], 0, Pool.Managed);
	}
}


now, i wanna do something like this but with my .tga-file, which i load like this: Microsoft.DirectX.Direct3D.TextureLoader.FromFile(device, "tileset.tga"); //Hikaru

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!