我在java示例中遇到了hough變換下的這個程序。但即時通訊在C#做我的項目,我無法弄清楚這個部分代碼「0xff000000」是什麼。這段代碼是什麼 - 0xff000000是它的顏色?如果它的顏色我如何轉換它C#?未知的代碼片段 - 0xff000000
private void drawPolarLine(int value, int r, int theta) {
for(int x=0;x<width;x++) {
for(int y=0;y<height;y++) {
int temp = (int)(x*Math.cos(((theta)*Math.PI)/180) + y*Math.sin(((theta)*Math.PI)/180));
if((temp - r) == 0)
output[y*width+x] = 0xff000000 | (value << 16 | value << 8 | value);
}
}
}
if ((input[y*width+x] & 0xff)== 255) {
//.........
}
不管哪種編程語言是從哪個轉換而來的,你應該總是努力用常數來代替[Magic Numbers](http://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constants)。 'private static final int COMPLETELY_OPAQUE = 0xFF000000;'等 – Mike
@Mike謝謝 – user1017919