如何锐化位图? [英] How to sharpen a Bitmap?
问题描述
我现在正在 Xamarin 中开发适用于 Android 的应用程序,但我被困在了一小步上.我在互联网上搜索 MonoDroid 的锐化算法,但我发现的一切似乎都不起作用.任何人都可以向我提供一些原样的脚本或一些文档吗?提前致谢.
I am now developing an app for Android in Xamarin and I am stuck on a little step. I was searching on the interwebs for a sharpening alogrithm for MonoDroid and everything I find doesn`t seem to work. Can anybody provide me with some as-is script or some documentation? Thanks in advance.
推荐答案
Mohit 的出色回答是针对 .NET System.Drawing.Bitmap 类的.Android 有不同的绘图类和颜色表示.您可以在此处找到有关 Color 的文档:https://developer.xamarin.com/api/type/Android.Graphics.Color/
The great answer by Mohit is targeted at the .NET System.Drawing.Bitmap class. Android has a different drawing class and representation of Color. You can find documentation on Color here: https://developer.xamarin.com/api/type/Android.Graphics.Color/
可以通过以下方式获得颜色的 A、R、G 和 B 值:
The A, R, G, and B values from a color can be obtained with:
int color = bitmap.GetPixel(x, y);
var androidColor = new Color(color);
byte r = androidColor.R;
byte g = androidColor.G;
byte b = androidColor.B;
byte alpha = androidColor.A;
应该可以按原样使用提供的算法,并进行这些修改.
It should be possible to use the provided algorithm as-is with those modifications in place.
这篇关于如何锐化位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!