use of android.graphics.PointF in project yoo_home_Android by culturer.
the class SkyWheel method calculateValue.
/**
* 计算圆心、半径、夹角
*/
public void calculateValue() {
// 圆心
center = new PointF();
center.x = getWidth() / 2;
center.y = getHeight() / 2;
int maxwidth = 0;
int maxheight = 0;
for (int i = 0; i < getChildCount(); i++) {
maxwidth = Math.max(maxwidth, getChildAt(i).getWidth());
maxheight = Math.max(maxheight, getChildAt(i).getHeight());
}
// 半径
float r1 = center.x - maxwidth;
float r2 = center.y - maxheight;
radius = Math.min(r1, r2);
// 夹角
cellDegree = Math.PI * 2 / getChildCount();
}
use of android.graphics.PointF in project yellowmessenger-sdk by yellowmessenger.
the class TouchImageView method setZoom.
/**
* Set zoom parameters equal to another TouchImageView. Including scale, position,
* and ScaleType.
* @param TouchImageView
*/
public void setZoom(TouchImageView img) {
PointF center = img.getScrollPosition();
setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
}
use of android.graphics.PointF in project yellowmessenger-sdk by yellowmessenger.
the class TouchImageView method getZoomedRect.
/**
* 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, 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);
}
use of android.graphics.PointF in project yellowmessenger-sdk by yellowmessenger.
the class TouchImageView method getScrollPosition.
/**
* 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;
}
use of android.graphics.PointF in project android by nextcloud.
the class TouchImageView method setZoom.
/**
* Set zoom parameters equal to another TouchImageView. Including scale, position,
* and ScaleType.
* @param img
*/
public void setZoom(TouchImageView img) {
PointF center = img.getScrollPosition();
setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
}
Aggregations