开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜