當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。