项目:Farmacias
文件:Scrollerlinearlayoutmanager.java
@Override
public void smoothScrollToPosition(RecyclerView recyclerView,RecyclerView.State state,int position) {
//
LinearSmoothScroller smoothScroller = new LinearSmoothScroller(mContext){
@Nullable
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
return Scrollerlinearlayoutmanager.this.computeScrollVectorForPosition
(targetPosition);
}
//1 pixel -> 0.05 ms
//1000 pixel -> x=50 ms to go over the height of the screen
@Override
protected float calculateSpeedPerPixel(displayMetrics displayMetrics) {
return 0.05f;
//return x /displayMetrics.densityDpi;
}
};
smoothScroller.setTargetPosition(position);
startSmoothScroll(smoothScroller);
}
项目:crumber
文件:CrumbView.java
/**
* Creates a path array to be used to draw lines
*
* @param points nodes which will be concatenate. Points are relative to the view and values between [0,1]
* @return float array that can be used on both drawing straight or dotted lines
*/
protected float[] createPathArray(List<PointF> points) {
float[] pathArray = new float[(points.size() - 1) * 4];
for (int i = 0; i < points.size() - 1; i++) {
int index = i * 4;
PointF from = points.get(i);
pathArray[index] = translateX(from.x);
pathArray[index + 1] = translateY(from.y);
PointF to = points.get(i + 1);
pathArray[index + 2] = translateX(to.x);
pathArray[index + 3] = translateY(to.y);
}
return pathArray;
}
项目:event-me
文件:TouchImageView.java
DoubleTapZoom(float targetZoom,float focusX,float focusY,boolean stretchImagetoSuper) {
setState(State.ANIMATE_ZOOM);
startTime = System.currentTimeMillis();
this.startZoom = normalizedScale;
this.targetZoom = targetZoom;
this.stretchImagetoSuper = stretchImagetoSuper;
PointF bitmapPoint = transformCoordTouchToBitmap(focusX,focusY,false);
this.bitmapX = bitmapPoint.x;
this.bitmapY = bitmapPoint.y;
//
// Used for translating image during scaling
//
startTouch = transformCoordBitmapToTouch(bitmapX,bitmapY);
endTouch = new PointF(viewWidth / 2,viewHeight / 2);
}
项目:Android-CoolMenu
文件:DragValueAnimator.java
private long getDragAnimaDuration(Object... pointFs) {
float x = ((PointF) pointFs[0]).x - ((PointF) pointFs[pointFs.length - 1]).x;
float y = ((PointF) pointFs[0]).y - ((PointF) pointFs[pointFs.length - 1]).y;
long duration = (long) (Math.hypot(x,y) * 1.6F);
//关于这个比例自己调吧
if (duration == 0) {
return mDragAnimaDuration;
} else if (duration > 0 && duration <= MIN_DURATION) {
return MIN_DURATION;
} else if (duration > MIN_DURATION && duration <= MAX_DURATION) {
return duration;
}
return MAX_DURATION;
}
项目:LueansRead
文件:TouchImageView.java
/**
* This function will transform the coordinates in the touch event to the coordinate
* system of the drawable that the imageview contain
* @param x x-coordinate of touch event
* @param y y-coordinate of touch event
* @param clipToBitmap Touch event may occur within view,but outside image content. True,to clip return value
* to the bounds of the bitmap size.
* @return Coordinates of the point touched,in the coordinate system of the original drawable.
*/
private PointF transformCoordTouchToBitmap(float x,float y,boolean clipToBitmap) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float finalX = ((x - transX) * origW) / getimageWidth();
float finalY = ((y - transY) * origH) / getimageHeight();
if (clipToBitmap) {
finalX = Math.min(Math.max(finalX,0),origW);
finalY = Math.min(Math.max(finalY,origH);
}
return new PointF(finalX,finalY);
}
项目:HDImageView
文件:HDImageView.java
private void setFilingGesture(Context context) {
mFlingDetector = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
@Override
public boolean onFling(MotionEvent e1,MotionEvent e2,float veLocityX,float veLocityY) {
if (mTranslateEnabled && mReadySent && mViewTranslate != null && e1 != null && e2 != null
&& (Math.abs(e1.getX() - e2.getX()) > 50 || Math.abs(e1.getY() - e2.getY()) > 50)
&& (Math.abs(veLocityX) > 500 || Math.abs(veLocityY) > 500) && !mIsZooming) {
PointF vTranslateEnd =
new PointF(mViewTranslate.x + (veLocityX * 0.25f),mViewTranslate.y + (veLocityY * 0.25f));
float sCenterXEnd = ((getWidth() / 2.0F) - vTranslateEnd.x) / mScale;
float sCenterYEnd = ((getHeight() / 2.0F) - vTranslateEnd.y) / mScale;
startFilingAnimation(sCenterXEnd,sCenterYEnd);
if (BuildConfig.DEBUG) Log.d(TAG,"onFling: 正在滑行");
return true;
}
return false;
}
});
}
项目:Sega
文件:TouchImageView.java
/**
* This function will transform the coordinates in the touch event to the coordinate
* system of the drawable that the imageview contain
*
* @param x x-coordinate of touch event
* @param y y-coordinate of touch event
* @param clipToBitmap Touch event may occur within view,to clip return value
* to the bounds of the bitmap size.
* @return Coordinates of the point touched,finalY);
}
public RadarView(Context context,AttributeSet attrs) {
super(context,attrs);
this.BACKGROUND_COLOR = new int[]{-3283459,-2692611,-1641730,-853763,-1};
this.FILL_COLOR = new int[]{-14581016,-15501602,-13858067,-12477447,-13397517};
this.stroke_COLOR = -3417355;
this.CIRCLE_NUMBER = this.BACKGROUND_COLOR.length;
this.LINE_NUMBER = this.FILL_COLOR.length;
this.DEFAULT_DURATION = 1000;
this.stroke_WIDTH = 1;
this.START_ANGLE = -90;
this.MIN_RADIUS = 36.0f;
this.points = new PointF[this.LINE_NUMBER];
this.centerPoints = new PointF[this.LINE_NUMBER];
this.percent = new float[]{0.0f,0.0f,0.0f};
this.target = new float[]{0.0f,0.0f};
init(context);
}
项目:spruce-android
文件:LinearSort.java
@SuppressWarnings("deprecation")
public void init(AttributeSet attrs,int defStyleAttr) {
if (isInEditMode())
return;
TypedArray a = getContext().obtainStyledAttributes(attrs,R.styleable.CheckBox,defStyleAttr,0);
drawable = new CheckableDrawable(getContext(),R.raw.carbon_checkBox_checked,R.raw.carbon_checkBox_unchecked,R.raw.carbon_checkBox_filled,new PointF(-0.09f,0.11f));
setButtonDrawable(getResources().getDrawable(android.R.color.transparent));
setCompoundDrawablesWithIntrinsicBounds(drawable,null,null);
ColorStateList csl = a.getColorStateList(R.styleable.CheckBox_carbon_checkColor);
if (csl != null)
drawable.setColor(csl);
setCheckedImmediate(isChecked());
a.recycle();
}
项目:JueDiQiuSheng
文件:DayNightLoadingRenderer.java
private void initStarHolders(RectF currentBounds) {
mStarHolders.add(new StarHolder(0.3f,new PointF(currentBounds.left + currentBounds.width() * 0.175f,currentBounds.top + currentBounds.height() * 0.0934f)));
mStarHolders.add(new StarHolder(0.2f,currentBounds.top + currentBounds.height() * 0.62f)));
mStarHolders.add(new StarHolder(0.2f,new PointF(currentBounds.left + currentBounds.width() * 0.2525f,currentBounds.top + currentBounds.height() * 0.43f)));
mStarHolders.add(new StarHolder(0.5f,new PointF(currentBounds.left + currentBounds.width() * 0.4075f,currentBounds.top + currentBounds.height() * 0.0934f)));
mStarHolders.add(new StarHolder(new PointF(currentBounds.left + currentBounds.width() * 0.825f,currentBounds.top + currentBounds.height() * 0.04f)));
mStarHolders.add(new StarHolder(new PointF(currentBounds.left + currentBounds.width() * 0.7075f,currentBounds.top + currentBounds.height() * 0.147f)));
mStarHolders.add(new StarHolder(new PointF(currentBounds.left + currentBounds.width() * 0.3475f,currentBounds.top + currentBounds.height() * 0.2567f)));
mStarHolders.add(new StarHolder(0.6f,new PointF(currentBounds.left + currentBounds.width() * 0.5825f,currentBounds.top + currentBounds.height() * 0.277f)));
mStarHolders.add(new StarHolder(new PointF(currentBounds.left + currentBounds.width() * 0.84f,currentBounds.top + currentBounds.height() * 0.32f)));
mStarHolders.add(new StarHolder(new PointF(currentBounds.left + currentBounds.width() * 0.8f,currentBounds.top + currentBounds.height() / 0.502f)));
mStarHolders.add(new StarHolder(0.6f,new PointF(currentBounds.left + currentBounds.width() * 0.7f,currentBounds.top + currentBounds.height() * 0.473f)));
mMaxSTaroffsets = currentBounds.height();
}
项目:ucar-weex-core
文件:BorderCornerTest.java
@Test
public void testGetSharpCornerEnd() throws Exception {
PointF topLeft = createBorderCorner(TOP_LEFT,10,50,borderBox)
.getSharpCornerEnd();
assertthat(topLeft.x,is(5f));
assertthat(topLeft.y,is(0f));
PointF topRight = createBorderCorner(TOP_RIGHT,borderBox)
.getSharpCornerEnd();
assertthat(topRight.x,is(400f));
assertthat(topRight.y,is(5f));
PointF bottomright = createBorderCorner(BottOM_RIGHT,borderBox)
.getSharpCornerEnd();
assertthat(bottomright.x,is(395f));
assertthat(bottomright.y,is(400f));
PointF bottomLeft = createBorderCorner(BottOM_LEFT,borderBox)
.getSharpCornerEnd();
assertthat(bottomLeft.x,is(0f));
assertthat(bottomLeft.y,is(395f));
}
项目:SpriteKit-Android
文件:MainActivity.java
private void shuffleCoinPosition() {
Random rand = new Random();
for (Sprite whiteSprite:coinsprites) {
float whiteDx = rand.nextInt(20)-10;
float whiteDy = rand.nextInt(20)-10;
float whiteX = whiteSprite.getPosition().x + whiteDx;
float whiteY = whiteSprite.getPosition().y + whiteDy;
if (whiteX > 800 || whiteX < 100 || whiteY > 800 || whiteY < 100){
whiteY = rand.nextInt(800)+100;
whiteX = rand.nextInt(800)+100;
}
whiteSprite.setPosition(new PointF(whiteX,whiteY));
}
new Timer().schedule(new TimerTask() {
@Override
public void run() {
shuffleCoinPosition();
}
},500);
}
项目:BLE-Indoor-Positioning
文件:BeaconMap.java
protected void drawBeaconBackground(Canvas canvas,Beacon beacon,PointF beaconCenter) {
float advertisingRadius = (float) canvasProjection.getCanvasUnitsFromMeters(beacon.getEstimatedAdvertisingRange());
Paint innerBeaconRangePaint = new Paint(beaconRangePaint);
innerBeaconRangePaint.setAlpha(100);
Shader rangeShader = new RadialGradient(
beaconCenter.x,beaconCenter.y,advertisingRadius - (pixelsPerDip * 0),primaryFillPaint.getColor(),beaconRangePaint.getColor(),Shader.TileMode.MIRROR);
innerBeaconRangePaint.setShader(rangeShader);
//canvas.drawCircle(beaconCenter.x,advertisingRadius,innerBeaconRangePaint);
canvas.drawCircle(beaconCenter.x,beaconRangePaint);
}
项目:Rxjava2.0Demo
文件:ScrollBoundaryUtil.java
public static boolean canLoadmore(View targetView,MotionEvent event) {
if (!canScrollDown(targetView) && canScrollUp(targetView) && targetView.getVisibility() == View.VISIBLE) {
return true;
}
if (targetView instanceof ViewGroup && event != null) {
ViewGroup viewGroup = (ViewGroup) targetView;
final int childCount = viewGroup.getChildCount();
PointF point = new PointF();
for (int i = 0; i < childCount; i++) {
View child = viewGroup.getChildAt(i);
if (isTransformedTouchPointInView(viewGroup,child,event.getX(),event.getY(),point)) {
event = MotionEvent.obtain(event);
event.offsetLocation(point.x,point.y);
return canLoadmore(child,event);
}
}
}
return false;
}
项目:spruce-android
文件:CorneredSort.java
@Override
public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent,List<View> children) {
final PointF comparisonPoint = getdistancePoint(parent,children);
List<SpruceTimedView> timedViews = new ArrayList<>();
long currentTimeOffset = 0;
double lastdistance = 0;
for (View view : children) {
double viewdistance = getdistanceBetweenPoints(Utils.viewToPoint(view),comparisonPoint);
if (Math.floor(lastdistance) != Math.floor(viewdistance)) {
lastdistance = viewdistance;
currentTimeOffset += interObjectDelay;
}
timedViews.add(new SpruceTimedView(view,currentTimeOffset));
}
return timedViews;
}
项目:geometric-progress-view
文件:GeometricProgressView.java
private void initializefigures() {
if (!isInEditMode()) cancelAnimation();
int size = Math.min(width,height);
double circumference = numberOfAngles * figurePadding;
double distanceFromCenter = circumference / (Math.PI * 2);
int radius = size / 2 - (int) (distanceFromCenter);
double startAngle = 90 + (360.0 / numberOfAngles) / 2;
List<PointF> angles = new ArrayList<>();
for (int i = 0; i < numberOfAngles; i++) {
double angle = startAngle + i * (360.0 / numberOfAngles);
angles.add(new PointF(
(float) (center.x + radius * Math.cos(Math.toradians(angle))),(float) (center.y + radius * Math.sin(Math.toradians(angle))))
);
}
figures = new ArrayList<>();
if (TYPE.KITE.equals(type)) {
buildfiguresUsingKites(angles,startAngle,distanceFromCenter);
} else {
buildfiguresUsingTriangles(angles,distanceFromCenter);
}
setupAnimation();
}
项目:CoordinateAxisChart
文件:CoordinateAxisChart.java
/**
* generate the power function lines
* @param a {@link PowerType#PowerType(float,float,float)}
* @param b {@link PowerType#PowerType(float,float)}
* @param canvas canvas
*/
private void generatePowerLines(Float a,Float b,Float c,Canvas canvas){
// raw
PointF start = leftPoint;
PointF end = rightPoint;
float unit = (end.x - start.x) / xPointsValues.length;
for (int i = 0; i < xPointsValues.length; i++) {
// get the split point
PointF split = new PointF(start.x + i * unit,start.y);
// logical
PointF splitLogic = convertRawPoint2Logical(split,unitLength);
// calculate
splitLogic.y = FuncUtils.getPowYValue(a,b,c,splitLogic.x);
// convert logical to raw
PointF splitRaw = convertLogicalPoint2Raw(splitLogic,unitLength);
xPointsValues[i] = splitRaw;
}
drawBezier(canvas,FuncType.POWER_TYPE);
}
项目:FilterPlayer
文件:GPUImageFilter.java
protected void setPoint(final int location,final PointF point) {
runOnDraw(new Runnable() {
@Override
public void run() {
float[] vec2 = new float[2];
vec2[0] = point.x;
vec2[1] = point.y;
GLES20.gluniform2fv(location,1,vec2,0);
}
});
}
项目:simpledialogFragments
文件:ColorWheelView.java
void setGeometry(PointF center,float radius,float padding){
if (!mCenter.equals(center) || radius != mRadius || padding != mPadding){
geometryNeedsUpdate = true;
}
mCenter = center;
mRadius = radius;
mPadding = padding;
}
项目:SmartRefreshLayout
文件:StoreHouseBarItem.java
public StoreHouseBarItem(int index,PointF start,PointF end,int color,int linewidth) {
this.index = index;
midPoint = new PointF((start.x + end.x) / 2,(start.y + end.y) / 2);
mCStartPoint = new PointF(start.x - midPoint.x,start.y - midPoint.y);
mCEndPoint = new PointF(end.x - midPoint.x,end.y - midPoint.y);
setColor(color);
setlinewidth(linewidth);
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.stroke);
}
项目:BlogBookApp
文件:ZoomImageView.java
/**
* Return the point at the center of the zoomed image. The PointF coordinates range
* in value between 0 and 1 and the focus point is denoted as a fraction from the left
* and top of the view. For example,the top left corner of the image would be (0,0).
* And the bottom right corner would be (1,1).
*
* @return PointF representing the scroll position of the zoomed image.
*/
public PointF getScrollPosition() {
Drawable drawable = getDrawable();
if (drawable == null) {
return null;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
PointF point = transformCoordTouchToBitmap(viewWidth / 2,viewHeight / 2,true);
point.x /= drawableWidth;
point.y /= drawableHeight;
return point;
}
项目:JueDiQiuSheng
文件:DayNightLoadingRenderer.java
public StarHolder(float flashOffset,PointF mPoint) {
this.mAlpha = MAX_ALPHA;
this.mCurrentPoint = new PointF();
this.mPoint = mPoint;
this.mFlashOffset = flashOffset;
this.mInterpolator = INTERPOLATORS[mRandom.nextInt(INTERPOLATORS.length)];
}
项目:361Camera
文件:CameraUtil.java
public static PointF normalizedSensorCoordsFornormalizeddisplayCoords(
float nx,float ny,int sensorOrientation) {
switch (sensorOrientation) {
case 0:
return new PointF(nx,ny);
case 90:
return new PointF(ny,1.0f - nx);
case 180:
return new PointF(1.0f - nx,1.0f - ny);
case 270:
return new PointF(1.0f - ny,nx);
default:
return null;
}
}
项目:GitHub
文件:ElectricFanLoadingRenderer.java
@Override
public void onAnimationUpdate(ValueAnimator animation) {
PointF point = (PointF) animation.getAnimatedValue();
target.mLeafRect.set((int) point.x,(int) point.y,(int) (point.x + mLeafdrawable.getIntrinsicWidth()),(int) (point.y + mLeafdrawable.getIntrinsicHeight()));
target.mLeafRotation = target.mMaxRotation * animation.getAnimatedFraction();
}
项目:ImageEraser
文件:TouchImageView.java
public TouchImageView(Context context) {
super(context);
this.isPaningOn = false;
this.userTouchListener = null;
this.last = new PointF();
sharedConstructing(context);
}
项目:event-me
文件:TouchImageView.java
/**
* Interpolate between where the image should start and end in order to translate
* the image so that the point that is touched is what ends up centered at the end
* of the zoom.
* @param t
*/
private void translateImagetoCenterTouchPosition(float t) {
float targetX = startTouch.x + t * (endTouch.x - startTouch.x);
float targetY = startTouch.y + t * (endTouch.y - startTouch.y);
PointF curr = transformCoordBitmapToTouch(bitmapX,bitmapY);
matrix.postTranslate(targetX - curr.x,targetY - curr.y);
}
项目:Mire
文件:DepthRendrer.java
void drawShadow(PointF point1,PointF point2,float correctionValue,Canvas canvas,DepthLayout dl) {
float angle = Math.abs(Math.abs(getAngle(point1,point2)) + correctionValue);
float alpha = angle / 180f;
shadowPaint.setAlpha((int) (alpha * 255f * shadowAlpha));
canvas.drawRect(0,dl.getWidth(),dl.getHeight(),shadowPaint);
}
项目:XERUNG
文件:CheckableDrawable.java
public CheckableDrawable(Context context,int checkedRes,int uncheckedRes,int filledRes,PointF offset) {
this.context = context;
this.checkedRes = checkedRes;
this.uncheckedRes = uncheckedRes;
this.filledRes = filledRes;
this.offset = offset;
maskPaint.setAlpha(255);
maskPaint.setColor(0xffffffff);
}
项目:LeftIndicatorViewGroup
文件:LeftIndicatorViewGroup.java
/**
* genearate samll points.
*
* @param bigStart prev big circle position.
* @param current current big circle position.
*/
private void generateSmallPoints(float bigStart,float current) {
// location start.
float smallStart = bigStart + mHalfBigHeight;
// location end.
float smallEnd = current - mHalfBigHeight;
float smallHeight = mHalfSmallHeight * 2 + mSmalldistance * 2;
// if has space.
if (smallEnd - smallStart < smallHeight) {
return;
}
// half of top points.
float halfTop = (bigStart + current) / 2 - mHalfSmallHeight - mSmalldistance;
while (halfTop - smallStart >= smallHeight) {
mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(),halfTop - smallHeight / 2));
halfTop -= smallHeight;
}
// does need extra.
if (halfTop - smallStart >= smallHeight - mSmalldistance + mBigAndSmallOffset) {
mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(),halfTop - smallHeight / 2));
}
// center.
mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(),(bigStart + current) / 2));
// half bottom points.
float halfBottom = (bigStart + current) / 2 + mHalfSmallHeight + mSmalldistance;
while (halfBottom + smallHeight <= smallEnd) {
mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(),halfBottom + smallHeight / 2));
halfBottom += smallHeight;
}
// does need extra.
if (halfBottom + smallHeight - mSmalldistance + mBigAndSmallOffset <= smallEnd) {
mSmallIndicatorPoints.add(new PointF(getIndicatorXPointF(),halfBottom + smallHeight / 2));
}
}
项目:Cable-Android
文件:MoveGestureDetector.java
/**
* Determine (multi)finger focal point (a.k.a. center point between all
* fingers)
*
* @return PointF focal point
*/
private PointF determineFocalPoint(MotionEvent e) {
// Number of fingers on screen
final int pCount = e.getPointerCount();
float x = 0f;
float y = 0f;
for (int i = 0; i < pCount; i++) {
x += e.getX(i);
y += e.getY(i);
}
return new PointF(x / pCount,y / pCount);
}
项目:LaunchEnr
文件:FlingToDeleteHelper.java
Runnable getFlingAnimation(DropTarget.DragObject dragObject) {
PointF vel = isFlingingToDelete();
if (vel == null) {
return null;
}
return new FlingAnimation(dragObject,vel,mDropTarget,mLauncher);
}
项目:GitHub
文件:Ease.java
private void init(float startX,float startY,float endX,float endY) {
PointF start = new PointF(startX,startY);
PointF end = new PointF(endX,endY);
c.x = 3 * start.x;
b.x = 3 * (end.x - start.x) - c.x;
a.x = 1 - c.x - b.x;
c.y = 3 * start.y;
b.y = 3 * (end.y - start.y) - c.y;
a.y = 1 - c.y - b.y;
}
项目:spline
文件:Layer.java
/**
* Convenience methods for the control points of the layer's bounding Box
*/
public PointF getTopLeft() {
topLeft.x = getLeft();
topLeft.y = getTop();
return topLeft;
}
项目:PhotoPicker-master
文件:TouchImageView.java
/**
* Return a Rect representing the zoomed image.
*
* @return rect representing zoomed image
*/
public RectF getZoomedRect() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
}
PointF topLeft = transformCoordTouchToBitmap(0,true);
PointF bottomright = transformCoordTouchToBitmap(viewWidth,viewHeight,true);
float w = getDrawable().getIntrinsicWidth();
float h = getDrawable().getIntrinsicHeight();
return new RectF(topLeft.x / w,topLeft.y / h,bottomright.x / w,bottomright.y / h);
}
项目:GitHub
文件:ScaleCircleNavigator.java
@Override
protected void onDraw(Canvas canvas) {
for (int i = 0,j = mCirclePoints.size(); i < j; i++) {
PointF point = mCirclePoints.get(i);
float radius = mCircleRadiusArray.get(i,(float) mMinRadius);
mPaint.setColor(ArgbEvaluatorHolder.eval((radius - mMinRadius) / (mMaxRadius - mMinRadius),mnormalCircleColor,mSelectedCircleColor));
canvas.drawCircle(point.x,getHeight() / 2.0f,radius,mPaint);
}
}
项目:AndroidbackendlessChat
文件:TouchImageView.java
/**
* Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
* drawable's coordinate system to the view's coordinate system.
* @param bx x-coordinate in original bitmap coordinate system
* @param by y-coordinate in original bitmap coordinate system
* @return Coordinates of the point in the view's coordinate system.
*/
private PointF transformCoordBitmapToTouch(float bx,float by) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float px = bx / origW;
float py = by / origH;
float finalX = m[Matrix.MTRANS_X] + getimageWidth() * px;
float finalY = m[Matrix.MTRANS_Y] + getimageHeight() * py;
return new PointF(finalX,finalY);
}
项目:PeSanKita-android
文件:MotionEntity.java
public PointF absoluteCenter() {
float topLeftX = layer.getX() * canvasWidth;
float topLeftY = layer.getY() * canvasHeight;
float centerX = topLeftX + getWidth() * holyScale * 0.5F;
float centerY = topLeftY + getHeight() * holyScale * 0.5F;
return new PointF(centerX,centerY);
}
项目:Fatigue-Detection
文件:DrawMultiTriangleNet.java
PointF a(float paramFloat1,float paramFloat2,float[] paramArrayOfFloat)
{
PointF localPointF = new PointF();
localPointF.x = (paramArrayOfFloat[0] * paramFloat1 + paramArrayOfFloat[1] * paramFloat2 + paramArrayOfFloat[2]);
localPointF.y = (paramArrayOfFloat[3] * paramFloat1 + paramArrayOfFloat[4] * paramFloat2 + paramArrayOfFloat[5]);
return localPointF;
}
项目:HDImageView
文件:HDImageView.java
private PointF getTranslateForSourceCenter(float sourceCenterX,float sourceCenterY,float scale){
int vxCenter = (getPaddingLeft() + getWidth() - getPaddingRight())/2;
int vyCenter = (getPaddingTop() + getHeight() - getPaddingBottom())/2;
mSatTemp.mScale = scale;
mSatTemp.mViewTranslate.set(vxCenter - sourceCenterX*scale,vyCenter-sourceCenterY*scale);
fitToBounds(true,mSatTemp);
return mSatTemp.mViewTranslate;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。