0
卸下圖像疊加我正在寫一個程序,使用掩模(覆蓋圖像)從一個PNG圖像中移除的覆蓋使用掩模圖像
具有圖像1和2我想才達到圖像3.
我嘗試過使用lockbits,並嘗試了很多東西,但我不能做數學的權利我認爲
rgbValues是覆蓋的字節數組,rgbValues2是給定圖像的字節數組。
for (int counter = 0; counter < rgbValues.Length; counter ++)
{
int x = (counter/4) * 4;
if (rgbValues[x + 3] != 0)
{
if (rgbValues[x + 3] == rgbValues2[x + 3])
{
rgbValues2[counter] = 0;
}
else
{
float a1 = (float)rgbValues[counter];
float a2 = (float)rgbValues2[counter] ;
float b1 = (float)rgbValues[x + 3];
float b2 = (float)rgbValues2[x + 3];
rgbValues2[counter] = (byte)(2 * a2- a1);
}
}
}
偉大的答案。謝謝。我自己也做過類似的事情,但結果非常奇怪。我一定在某個地方犯了一個錯誤。最後我累了。再次感謝 –