[.net] Split textures with transparency :S

Started by
-1 comments, last by Hikaru 18 years, 1 month ago
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

This topic is closed to new replies.

Advertisement