Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

transparent textures from gdi

 

Hello,

I'm trying to use the alpha channel of a gdi bitmap, but it isn't working..

does anyone know how to do it?

Bild = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(Bild);

//those lines also didn't work
//   SolidBrush bop = new SolidBrush(Color.Green);
// g.FillRectangle(bop, 0, 0, 200, 200);
// Bild.MakeTransparent(Color.Green);

Font f = new Font("Verdana", 30);
SolidBrush b = new SolidBrush(Color.FromArgb(255, 255, 0, 0));
g.DrawString("Just one line!", f, b, 5, 40);                                        
ReadyTexture3 = Texture.FromBitmap( device, Bild, 0, Pool.Managed);

 

Renderstates:

dev.RenderState.AlphaBlendEnable = true;
dev.RenderState.SourceBlend = Blend.SourceAlpha;
dev.RenderState.DestinationBlend = Blend.InvSourceAlpha;

Edited by Staeff

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...