Sign in to follow this  

[.net] Split textures with transparency :S

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this