当前位置: 首页>>代码示例>>Java>>正文


Java PointF.offset方法代码示例

本文整理汇总了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);
}
 
开发者ID:nextgis,项目名称:android_nextgis_mobile,代码行数:9,代码来源:MapDrawing.java

示例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;
    }
}
 
开发者ID:ovenbits,项目名称:QuickActionView,代码行数:33,代码来源:QuickActionView.java

示例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);

        }
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:44,代码来源:ColorWheelView.java

示例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;
}
 
开发者ID:ovenbits,项目名称:QuickActionView,代码行数:7,代码来源:QuickActionView.java


注:本文中的android.graphics.PointF.offset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。