![](/img/trans.png)
[英]How to Draw a Bitmap image in a arc shape in android to create a spin
[英]How to find Center of Gravity of the shape in the Image (Bitmap)
這是我的工作,我試圖使用選定的圖像坐標在圖像(位圖)中找到形狀的重心:
float xpos = 0f , ypos = 0f;
PointF currF = new PointF();
for (PointF pointF : pointFArrayList){
xpos += pointF.x;
pos += pointF.y;
}
currF.x = xpos/pointFArrayList.size();
currF.y = ypos/pointFArrayList.size();
addRoundIconToViewRed(currF); //Marking the center of gravity
例如,請參閱此圖像:
1.首先將位圖設置為圖像視圖
2.獲取該特定圖像視圖的中心點
centreX=imageView.getX() + imageView.getWidth() / 2;
centreY=imageView.getY() + imageView.getHeight() / 2;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.