本文整理匯總了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);
}