我想要获取Bitmap中像素的颜色。通常情况下,我使用GetPixel(x,y)方法来实现。但是在Android.Graphics中,该方法返回一个表示颜色的int类型值。因此,我需要知道如何从这个整数值中获取颜色。
事实上,这正是我最终要做的(在mPlan中去除白色):
for (int x=0; x < PlanWidth; x++)
{
for (int y=0; y < PlanHeight; y++)
{
if (mPlan.GetPixel(x, y) == Color.White)
mPlan.SetPixel(x, y, (Color.White - mPlan.GetPixel(x, y)));
}
}
Color.White
是int。 - Sergey GlotovColor.White.ToArgb()
? 您可以将Color.White
转换为整数,而不是每次使用GetPixel()
方法获取结果。 - Sergey Glotov