• Advertisement
Sign in to follow this  

[.net] Split textures with transparency :S

This topic is 4379 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
Sign in to follow this  

  • Advertisement