List of usage examples for android.graphics PointF set
public final void set(float x, float y)
From source file:com.taobao.weex.ui.component.list.BasicListComponent.java
@Override public void computeVisiblePointInViewCoordinate(PointF pointF) { RecyclerView view = getHostView().getInnerView(); pointF.set(view.computeHorizontalScrollOffset(), view.computeVerticalScrollOffset()); }
From source file:com.mylikes.likes.etchasketch.Slate.java
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);/*w w w. ja va 2 s. c o m*/ 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; }
From source file:com.taobao.weex.ui.component.WXComponent.java
/** * This method computes user visible left-top point in view's coordinate. * The default implementation uses the scrollX and scrollY of the view as the result, * and put the value in the parameter pointer. * Components with different computation algorithm * <strong> should override </strong> this method. * * @param pointF the user visible left-top point in view's coordinate. */// w ww . j av a2 s . com public void computeVisiblePointInViewCoordinate(PointF pointF) { View view = getRealView(); pointF.set(view.getScrollX(), view.getScrollY()); }
From source file:org.medcare.Dicom.DicomActivity.java
/** Calculate the mid point of the first two fingers */ 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); }
From source file:xyz.zpayh.hdimage.HDImageView.java
/** * ???????//from w ww. ja va 2s . c om * @param viewX viewx?? * @param viewY viewy?? * @param sourceTarget ??? * @return * ?? */ private PointF viewToSourceCoordinate(float viewX, float viewY, @NonNull PointF sourceTarget) { if (mViewTranslate == null) return null; sourceTarget.set(viewToSourceX(viewX), viewToSourceY(viewY)); return sourceTarget; }
From source file:xyz.zpayh.hdimage.HDImageView.java
/** * ???????/*from w w w. j a v a 2s . c om*/ * @param sourceX ?x?? * @param sourceY ?y?? * @param viewTarget view?? * @return * ?? */ private PointF sourceToViewCoordinate(float sourceX, float sourceY, @NonNull PointF viewTarget) { if (mViewTranslate == null) { return null; } viewTarget.set(sourceToViewX(sourceX), sourceToViewY(sourceY)); return viewTarget; }
From source file:xyz.zpayh.hdimage.HDImageView.java
private PointF limitedSourceCenter(float sourceCenterX, float sourceCenterY, float scale, @NonNull PointF sourceTarget) { PointF vTranslate = getTranslateForSourceCenter(sourceCenterX, sourceCenterY, scale); int vxCenter = (getPaddingLeft() + getWidth() - getPaddingRight()) / 2; int vyCenter = (getPaddingTop() + getHeight() - getPaddingBottom()) / 2; float sx = (vxCenter - vTranslate.x) / scale; float sy = (vyCenter - vTranslate.y) / scale; sourceTarget.set(sx, sy); return sourceTarget; }
From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java
/** * Convert screen coordinate to source coordinate. *///from w w w . j av a 2s. c o m public final PointF viewToSourceCoord(float vx, float vy, PointF sTarget) { if (vTranslate == null) { return null; } sTarget.set(viewToSourceX(vx), viewToSourceY(vy)); return sTarget; }
From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java
/** * Convert source coordinate to screen coordinate. *//*from w w w. ja v a 2s. co m*/ public final PointF sourceToViewCoord(float sx, float sy, PointF vTarget) { if (vTranslate == null) { return null; } vTarget.set(sourceToViewX(sx), sourceToViewY(sy)); return vTarget; }
From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java
/** * Given a requested source center and scale, calculate what the actual center will have to be to keep the image in * pan limits, keeping the requested center as near to the middle of the screen as allowed. */// w ww . j a v a2 s. c o m private PointF limitedSCenter(float sCenterX, float sCenterY, float scale, PointF sTarget) { PointF vTranslate = vTranslateForSCenter(sCenterX, sCenterY, scale); int vxCenter = getPaddingLeft() + (getWidth() - getPaddingRight() - getPaddingLeft()) / 2; int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop()) / 2; float sx = (vxCenter - vTranslate.x) / scale; float sy = (vyCenter - vTranslate.y) / scale; sTarget.set(sx, sy); return sTarget; }