WPF BitmapImage and transparency
-
Does anyone know how you select a pixel from a BitmapImage instance, say the one at 0.0, and set that as the transparent color for a bitmap.
-
Does anyone know how you select a pixel from a BitmapImage instance, say the one at 0.0, and set that as the transparent color for a bitmap.
Have a look at the Bitblt in Win32 APIs. thats one way fo doing this, though through Interop in .NET
Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!
-
Does anyone know how you select a pixel from a BitmapImage instance, say the one at 0.0, and set that as the transparent color for a bitmap.
-
Have a look at the Bitblt in Win32 APIs. thats one way fo doing this, though through Interop in .NET
Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!
Thanks for that. With Windows Forms etc it was easy just bitmap.MakeTransparent(bitmap.GetPixel(0, 0)); and I'm sure Bitblt would do it but I always try and avoid unmanaged code as it seems like such a backward step especially with WPF and XAML on the horizon.
-
Wow.And to think I just used to write bitmap.MakeTransparent(bitmap.GetPixel(0, 0)); Still, that's progress for you. Thanks for the info, I'll give it a try.
-
Thanks for that. With Windows Forms etc it was easy just bitmap.MakeTransparent(bitmap.GetPixel(0, 0)); and I'm sure Bitblt would do it but I always try and avoid unmanaged code as it seems like such a backward step especially with WPF and XAML on the horizon.
Anytime Steve :) Yes Bitmap class offers the transparency thing, but under the hoods its using the same API so i chose to put forward the native thing :D. There are tons of benefits of blitting but then not all is offered through the GDI+ classes and the likes. MS is making life easier for us by putting better and more abstractions over the native ways....and that is really productive. However, knowing how my car runs can reduce my dependency on the mechanic :))
Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!