Opacity in images in WPF
开发者_如何学编程How can I detect transparent pixels in an image
using WPF so that I know where a user clicks?
U don't need Image class, it is not design for pixel manipulation. Rater use Bitmap* class
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"/test.png",UriKind.RelativeOrAbsolute);
bi.EndInit();
an exapmle
Implement public PixelColor[,] GetPixels(BitmapSource source) method and then interate through returned array to find Alpha channel ( a simple loop). Mind that some images does not support transparency and the file vary depends on structure (ARGB, RGBA) etc.
精彩评论