本文整理汇总了Java中android.graphics.PointF.offset方法的典型用法代码示例。如果您正苦于以下问题:Java PointF.offset方法的具体用法?Java PointF.offset怎么用?Java PointF.offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.PointF
的用法示例。
在下文中一共展示了PointF.offset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: offset
import android.graphics.PointF; //导入方法依赖的package包/类
public void offset(
float x,
float y)
{
PointF pt = new PointF(mCenter.x, mCenter.y);
pt.offset(x, y);
setCenter(pt.x, pt.y);
}
示例2: onLayout
import android.graphics.PointF; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
mScrimView.layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
mIndicatorView.layout(mCenterPoint.x - (int) (mIndicatorView.getMeasuredWidth() / 2.0),
mCenterPoint.y - (int) (mIndicatorView.getMeasuredHeight() / 2.0),
mCenterPoint.x + (int) (mIndicatorView.getMeasuredWidth() / 2.0),
mCenterPoint.y + (int) (mIndicatorView.getMeasuredHeight() / 2.0));
int index = 0;
for (Map.Entry<Action, ActionView> entry : mActionViews.entrySet()) {
float startAngle = getOptimalStartAngle(entry.getValue().getActionCircleRadiusExpanded());
ActionView actionView = entry.getValue();
PointF point = getActionPoint(index, startAngle, actionView);
point.offset(-actionView.getCircleCenterX(), -actionView.getCircleCenterY());
actionView.layout((int) point.x, (int) point.y, (int) (point.x + actionView.getMeasuredWidth()), (int) (point.y + actionView.getMeasuredHeight()));
ActionTitleView titleView = mActionTitleViews.get(entry.getKey());
if (titleView != null) {
float titleLeft = point.x + (actionView.getMeasuredWidth() / 2) - (titleView.getMeasuredWidth() / 2);
float titleTop = point.y - 10 - titleView.getMeasuredHeight();
titleView.layout((int) titleLeft, (int) titleTop, (int) (titleLeft + titleView.getMeasuredWidth()), (int) (titleTop + titleView.getMeasuredHeight()));
}
index++;
}
if (!mAnimated) {
animateActionsIn();
animateIndicatorIn();
animateScrimIn();
mAnimated = true;
}
}
示例3: createFieldGeometry
import android.graphics.PointF; //导入方法依赖的package包/类
private void createFieldGeometry(Field f, float startAngle, float sweepAngle) {
startAngle = mod(startAngle, 360);
int rot = startAngle < 120 ? 0 : startAngle < 240 ? 1 : 2;
startAngle = mod(startAngle, 120);
float R = mRadius - mPadding;
float p = mPadding;
PointF p_i1 = calcInnerPoint(R, p, startAngle, true);
PointF p_i2 = calcInnerPoint(R, p, startAngle + sweepAngle, false);
float aAd = (float) Math.toDegrees(Math.asin(p/2/R));
float alpha_1 = startAngle + aAd;
float alpha_2 = startAngle + sweepAngle - aAd;
// PointF p_a1 = new PointF(R*(float)Math.cos(Math.toRadians(alpha_1)), R*(float)Math.sin(Math.toRadians(alpha_1)));
// PointF p_a2 = new PointF(R*(float)Math.cos(Math.toRadians(alpha_2)), R*(float)Math.sin(Math.toRadians(alpha_2)));
p_i1.offset(mCenter.x, mCenter.y);
p_i2.offset(mCenter.x, mCenter.y);
// p_a1.offset(mCenter.x, mCenter.y);
// p_a2.offset(mCenter.x, mCenter.y);
RectF oval = new RectF(mCenter.x - R, mCenter.y - R, mCenter.x + R, mCenter.y + R);
//f.points = new PointF[]{p_i1, p_a1, p_a2, p_i2};
f.rawPath = new Path();
f.rawPath.moveTo(p_i1.x, p_i1.y);
// f.path.lineTo(p_a1.x, p_a1.y);
// f.path.lineTo(p_a2.x, p_a2.y);
f.rawPath.arcTo(oval, alpha_1, alpha_2-alpha_1);
f.rawPath.lineTo(p_i2.x, p_i2.y);
f.rawPath.close();
Matrix mMatrix = new Matrix();
mMatrix.postRotate( -90 + rot*120, mCenter.x, mCenter.y);
f.rawPath.transform(mMatrix);
f.startAngle = mod(alpha_1 -90 + rot*120, 360);
f.endAngle = mod(alpha_2 -90 + rot*120, 360);
}
示例4: getActionPoint
import android.graphics.PointF; //导入方法依赖的package包/类
private PointF getActionPoint(int index, float startAngle, ActionView view) {
PointF point = new PointF(mCenterPoint);
float angle = (float) (Math.toRadians(startAngle) + getActionOffsetAngle(index, view));
point.offset((int) (Math.cos(angle) * getTotalRadius(view.getActionCircleRadiusExpanded())), (int) (Math.sin(angle) * getTotalRadius(view.getActionCircleRadiusExpanded())));
return point;
}