pixman圖像庫可以在兩個圓之間繪製徑向顏色漸變。我希望徑向漸變填充完全由「寬度」和「高度」定義的矩形區域。現在我的問題,我應該如何選擇外圈的半徑?選擇圓半徑以完全填充矩形
我目前的參數如下:
A) inner circle (start of gradient)
center pointer of inner circle: (width*0.5|height*0.5)
radius of inner circle: 1
color: black
B) outer circle (end of gradient)
center pointer of outer circle: (width*0.5|height*0.5)
radius of outer circle: ???
color: white
我應該如何選擇外圓半徑,以確保外圈將完全填補寬*高定義我的邊框。角落裏不應有空白區域,該區域應完全被圓圈覆蓋。換句話說,邊界矩形的寬度,高度必須完全適合外圓。選擇
outer_radius = max(width, height) * 0.5
作爲外圈的半徑顯然是不夠的。它必須更大,但更大?
謝謝!