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


Java PointF.set方法代码示例

本文整理汇总了Java中android.graphics.PointF.set方法的典型用法代码示例。如果您正苦于以下问题:Java PointF.set方法的具体用法?Java PointF.set怎么用?Java PointF.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.PointF的用法示例。


在下文中一共展示了PointF.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isTransformedTouchPointInView

import android.graphics.PointF; //导入方法依赖的package包/类
/**
 * Returns whether the touch point is within the child View
 * It is transform aware and will invert the transform Matrix to find the true local points
 * This code is taken from {@link ViewGroup#isTransformedTouchPointInView()}
 */
private static boolean isTransformedTouchPointInView(
    float x,
    float y,
    ViewGroup parent,
    View child,
    PointF outLocalPoint) {
  float localX = x + parent.getScrollX() - child.getLeft();
  float localY = y + parent.getScrollY() - child.getTop();
  Matrix matrix = child.getMatrix();
  if (!matrix.isIdentity()) {
    float[] localXY = mMatrixTransformCoords;
    localXY[0] = localX;
    localXY[1] = localY;
    Matrix inverseMatrix = mInverseMatrix;
    matrix.invert(inverseMatrix);
    inverseMatrix.mapPoints(localXY);
    localX = localXY[0];
    localY = localXY[1];
  }
  if (child instanceof ReactHitSlopView && ((ReactHitSlopView) child).getHitSlopRect() != null) {
    Rect hitSlopRect = ((ReactHitSlopView) child).getHitSlopRect();
    if ((localX >= -hitSlopRect.left && localX < (child.getRight() - child.getLeft()) + hitSlopRect.right)
        && (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
      outLocalPoint.set(localX, localY);
      return true;
    }

    return false;
  } else {
    if ((localX >= 0 && localX < (child.getRight() - child.getLeft()))
        && (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
      outLocalPoint.set(localX, localY);
      return true;
    }

    return false;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:44,代码来源:TouchTargetHelper.java

示例2: StackItem

import android.graphics.PointF; //导入方法依赖的package包/类
public StackItem(StackItem x) {
	curlPos = new PointF();
	curlDir = new PointF();
	mAnimationSource = new PointF();
	mAnimationTarget = new PointF();
	minX = x.getMinX();
	minY = x.getMinY();
	maxX = x.getMaxX();
	maxY = x.getMaxY();
	curlPos.set(x.getCurlPos());
	curlDir.set(x.getCurlDir());
	mAnimationSource.set(x.getAnimationSource());
	mAnimationTarget.set(x.getAnimationTarget());
	TextureID = x.getTextureID();
	FBOId = x.getFBOId();
}
 
开发者ID:AmulaySoftGroup,项目名称:TaBeTa,代码行数:17,代码来源:StackItem.java

示例3: getCenteringTranslationForScale

import android.graphics.PointF; //导入方法依赖的package包/类
/**
 * Calculates the translation factor necessary to center the view's drawable for the given
 * scale.
 *
 * @param imageView the view with a drawable to be centered
 * @param scale     a scale factor that would be applied to the drawable before centering
 * @return the translation factor
 */
private static PointF getCenteringTranslationForScale(@Nullable ImageView imageView, float scale) {
    PointF point = new PointF();
    if (imageView == null || imageView.getDrawable() == null) {
        return point;
    }

    Drawable drawable = imageView.getDrawable();
    int drawableWidth = drawable.getIntrinsicWidth();
    int drawableHeight = drawable.getIntrinsicHeight();
    int viewWidth = getViewWidthMinusPadding(imageView);
    int viewHeight = getViewHeightMinusPadding(imageView);
    if (drawableWidth <= 0 || drawableHeight <= 0 || viewWidth <= 0 || viewHeight <= 0) {
        return point;
    }

    // Translate drawable to center
    float xScaled = drawableWidth * scale;
    float yScaled = drawableHeight * scale;
    float xTranslation = (viewWidth - xScaled) / 2f + 0.5f;
    float yTranslation = (viewHeight - yScaled) / 2f + 0.5f;
    point.set(xTranslation, yTranslation);
    return point;
}
 
开发者ID:metagalactic,项目名称:ScalableImageView,代码行数:32,代码来源:ScalableImageView.java

示例4: isTransformedTouchPointInView

import android.graphics.PointF; //导入方法依赖的package包/类
public static boolean isTransformedTouchPointInView(ViewGroup group, View child, float x, float y,PointF outLocalPoint) {
    if (child.getVisibility() != View.VISIBLE) {
        return false;
    }
    final float[] point = new float[2];
    point[0] = x;
    point[1] = y;
    transformPointToViewLocal(group, child, point);
    final boolean isInView = pointInView(child, point[0], point[1], 0);
    if (isInView && outLocalPoint != null) {
        outLocalPoint.set(point[0]-x, point[1]-y);
    }
    return isInView;
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:15,代码来源:ScrollBoundaryUtil.java

示例5: setPointer

import android.graphics.PointF; //导入方法依赖的package包/类
private static void setPointer(PointF pointer, float hue, float sat, float radiusPx) {
	final float r = radiusPx - 1; // for values 0...1 inclusive
	final double distance = r * Math.sqrt(sat);
	final double angle = hue / 360 * Math.PI / 2;
	final double dx = distance * Math.cos(angle);
	final double dy = distance * Math.sin(angle);
	pointer.set(r - (float)dx, r - (float)dy);
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:9,代码来源:HueSatView.java

示例6: isTransformedTouchPointInView

import android.graphics.PointF; //导入方法依赖的package包/类
private static boolean isTransformedTouchPointInView(ViewGroup group, View child, float x, float y,PointF outLocalPoint) {
    final float[] point = new float[2];
    point[0] = x;
    point[1] = y;
    transformPointToViewLocal(group, child, point);
    final boolean isInView = pointInView(child, point[0], point[1], 0);
    if (isInView && outLocalPoint != null) {
        outLocalPoint.set(point[0]-x, point[1]-y);
    }
    return isInView;
}
 
开发者ID:Brave-wan,项目名称:SmartRefresh,代码行数:12,代码来源:RefreshContentWrapper.java

示例7: rawPixelsToDataPoint

import android.graphics.PointF; //导入方法依赖的package包/类
/**
 * Finds the chart point (i.e. within the chart's domain and range) represented by the given pixel coordinates, if
 * that pixel is within the chart region described by {@link #contentRectMinusAllMargins}. If the point is found,
 * the "dest"
 * argument is set to the point and this function returns true. Otherwise, this function returns false and
 * "dest" is
 * unchanged.
 */
public boolean rawPixelsToDataPoint(float x, float y, PointF dest) {
    if (!contentRectMinusAllMargins.contains((int) x, (int) y)) {
        return false;
    }
    dest.set(currentViewport.left + (x - contentRectMinusAllMargins.left) * currentViewport.width() /
                    contentRectMinusAllMargins.width(),
            currentViewport.bottom + (y - contentRectMinusAllMargins.bottom) * currentViewport.height() /
                    -contentRectMinusAllMargins.height());
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ChartComputator.java

示例8: getCenter

import android.graphics.PointF; //导入方法依赖的package包/类
PointF getCenter(MotionEvent event, PointF out) {
    int P = event.getPointerCount();
    PointF pt = ((out == null) ? new PointF() : out);
    pt.set(event.getX(0), event.getY(0));
    final int zero[] = { 0, 0 };
    getLocationOnScreen(zero);
    for (int j = 1; j < P; j++) {
        pt.x += event.getX(j) + zero[0];
        pt.y += event.getY(j) + zero[1];
    }
    pt.x /= P;
    pt.y /= P;
    return pt;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:15,代码来源:Slate.java

示例9: getTransForm

import android.graphics.PointF; //导入方法依赖的package包/类
public PointF getTransForm() {
    float[] n = new float[9];
    this.matrix.getValues(n);
    PointF point = new PointF();
    point.set(n[2], n[5]);
    return point;
}
 
开发者ID:asif-patel,项目名称:ImageEraser,代码行数:8,代码来源:TouchImageView.java

示例10: midPoint

import android.graphics.PointF; //导入方法依赖的package包/类
/** Calculate the mid point of the first two fingers */
private void midPoint(PointF point, WrapMotionEvent event) {
    // ...
    float x = event.getX(0) + event.getX(1);
    float y = event.getY(0) + event.getY(1);
    point.set(x / 2, y / 2);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:8,代码来源:PhotoSetView.java

示例11: midPoint

import android.graphics.PointF; //导入方法依赖的package包/类
/**
 * 两点的中点
 */
private void midPoint(PointF point, MotionEvent event) {
    float x = event.getX(0) + event.getX(1);
    float y = event.getY(0) + event.getY(1);
    point.set(x / 2, y / 2);
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:9,代码来源:PicViewer.java

示例12: normalizeVector

import android.graphics.PointF; //导入方法依赖的package包/类
private void normalizeVector(PointF point) {
    float abs = point.length();
    point.set(point.x / abs, point.y / abs);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:PieChartRenderer.java

示例13: midPoint

import android.graphics.PointF; //导入方法依赖的package包/类
private void midPoint(PointF point, MotionEvent event)
{
    float x = event.getX(0) + event.getX(1);
    float y = event.getY(0) + event.getY(1);
    point.set(x / 2, y / 2);
}
 
开发者ID:codingdojoangola,项目名称:cda-app,代码行数:7,代码来源:ImagemActivity.java

示例14: computeVisiblePointInViewCoordinate

import android.graphics.PointF; //导入方法依赖的package包/类
@Override
public void computeVisiblePointInViewCoordinate(PointF pointF) {
  RecyclerView view = getHostView().getInnerView();
  pointF.set(view.computeHorizontalScrollOffset(), view.computeVerticalScrollOffset());
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:6,代码来源:BasicListComponent.java

示例15: midPoint

import android.graphics.PointF; //导入方法依赖的package包/类
private void midPoint(PointF point, MotionEvent event) {

        float x = event.getX(0) + event.getX(1);
        float y = event.getY(0) + event.getY(1);
        point.set(x / 2, y / 2);
    }
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:7,代码来源:Fullscreen.java


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