本文整理汇总了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;
}
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例12: normalizeVector
import android.graphics.PointF; //导入方法依赖的package包/类
private void normalizeVector(PointF point) {
float abs = point.length();
point.set(point.x / abs, point.y / abs);
}
示例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);
}
示例14: computeVisiblePointInViewCoordinate
import android.graphics.PointF; //导入方法依赖的package包/类
@Override
public void computeVisiblePointInViewCoordinate(PointF pointF) {
RecyclerView view = getHostView().getInnerView();
pointF.set(view.computeHorizontalScrollOffset(), view.computeVerticalScrollOffset());
}
示例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);
}