本文整理汇总了Java中android.graphics.Point.set方法的典型用法代码示例。如果您正苦于以下问题:Java Point.set方法的具体用法?Java Point.set怎么用?Java Point.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Point
的用法示例。
在下文中一共展示了Point.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContentSize
import android.graphics.Point; //导入方法依赖的package包/类
/**
* 获取屏幕宽高
* @param context
* @param contentOffset
* @return
*/
public static Point getContentSize(Activity context, float contentOffset) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point out = new Point();
if (Build.VERSION.SDK_INT >= 13) {
display.getSize(out);
} else {
int width = display.getWidth();
int height = display.getHeight();
out.set(width, height);
}
if (contentOffset > 0) {
out.y -= contentOffset;
}
return out;
}
示例2: getViewMidPoint
import android.graphics.Point; //导入方法依赖的package包/类
/**
* 该方法用于回一个View的终点坐标 如果该View不存在则返回(0,0)
*
* @param view
* @return
*/
private Point getViewMidPoint(View view) {
Point point = new Point();
if (view != null) {
float xx = view.getX();
float yy = view.getY();
int center_x = (int) (xx + view.getWidth() / 2);
int center_y = (int) (yy + view.getHeight() / 2);
point.set(center_x, center_y);
} else {
point.set(0, 0);
}
return point;
}
示例3: drawSelector
import android.graphics.Point; //导入方法依赖的package包/类
private void drawSelector(Canvas canvas, int posX, int posY) {
if (isSelected || hasFocus()) {
paint.setColor(highlightColor);
} else {
paint.setColor(isEnabled() ? arrowColor : disabledColor);
}
Point point1 = selectorPoints[0];
Point point2 = selectorPoints[1];
Point point3 = selectorPoints[2];
point1.set(posX, posY);
point2.set((int) (posX - (arrowSize)), posY);
point3.set((int) (posX - (arrowSize / 2)), (int) (posY + (arrowSize / 2)));
selectorPath.reset();
selectorPath.moveTo(point1.x, point1.y);
selectorPath.lineTo(point2.x, point2.y);
selectorPath.lineTo(point3.x, point3.y);
selectorPath.close();
canvas.drawPath(selectorPath, paint);
}
示例4: drawSelector
import android.graphics.Point; //导入方法依赖的package包/类
private void drawSelector(Canvas canvas, int posX, int posY) {
if (isSelected) {
paint.setColor(highlightColor);
} else {
paint.setColor(isEnabled() ? arrowColor : disabledColor);
}
Point point1 = selectorPoints[0];
Point point2 = selectorPoints[1];
Point point3 = selectorPoints[2];
point1.set(posX, posY);
point2.set((int) (posX - (arrowSize)), posY);
point3.set((int) (posX - (arrowSize / 2)), (int) (posY + (arrowSize / 2)));
selectorPath.reset();
selectorPath.moveTo(point1.x, point1.y);
selectorPath.lineTo(point2.x, point2.y);
selectorPath.lineTo(point3.x, point3.y);
selectorPath.close();
canvas.drawPath(selectorPath, paint);
}
示例5: scalePoint
import android.graphics.Point; //导入方法依赖的package包/类
private Point scalePoint(Point point, int width, int height) {
if (point == null)
return null;
mScreenMetrics.setDesignHeight(height);
mScreenMetrics.setDesignWidth(width);
point.set(mScreenMetrics.scaleX(point.x), mScreenMetrics.scaleY(point.y));
return point;
}
示例6: onProvideShadowMetrics
import android.graphics.Point; //导入方法依赖的package包/类
@Override
public void onProvideShadowMetrics (Point size, Point touch) {
final int width, height;
width = (int) (getView().getWidth());
height = (int) (getView().getHeight());
shadow.setBounds(0, 0, width, height);
size.set(width, height);
touch.set(offset.x, offset.y);
}
示例7: init
import android.graphics.Point; //导入方法依赖的package包/类
private void init() {
hotPath = new Path();
int x1 = DisplayUtil.dip2px(getContext(),290);
int x2 = DisplayUtil.dip2px(getContext(),324);
int x3 = DisplayUtil.dip2px(getContext(),307);
int y1 = DisplayUtil.dip2px(getContext(),0);
int y2 = DisplayUtil.dip2px(getContext(),24);
int y3 = DisplayUtil.dip2px(getContext(),38);
hotPath.moveTo(x1,y1);
hotPath.lineTo(x2,y1);
hotPath.lineTo(x2,y2);
hotPath.lineTo(x3,y3);
hotPath.lineTo(x1,y2);
hotPath.close();
lsPoint = new Point();
lsPoint.set(x1 - 3,0);
lePoint = new Point();
lePoint.set(x2,0);
rTitlePoint = new Point();
rTitlePoint.set(x3, (y1 + y3 - 4)/2);
hotPaint = new Paint();
hotPaint.setColor(Color.RED);
hotPaint.setShadowLayer(2,-2,-1,Color.DKGRAY);
ColorMatrix colorMatrix = new ColorMatrix(new float[]{
0.8f,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,1,0
});
lineFilter = new ColorMatrixColorFilter(colorMatrix);
}
示例8: resolveRelativeTouchPosition
import android.graphics.Point; //导入方法依赖的package包/类
private Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
if (locationOnScreen == null) {
locationOnScreen = new int[2];
touchPosition = new Point();
}
getLocationOnScreen(locationOnScreen);
touchPosition.set(
((int) motionEvent.getRawX()) - locationOnScreen[0],
((int) motionEvent.getRawY()) - locationOnScreen[1]);
return touchPosition;
}
示例9: getScreenDimensions
import android.graphics.Point; //导入方法依赖的package包/类
public static Point getScreenDimensions(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getMetrics(dm);
Point point = new Point();
point.set(dm.widthPixels, dm.heightPixels);
return point;
}
示例10: getScreenResolution
import android.graphics.Point; //导入方法依赖的package包/类
public static Point getScreenResolution(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point screenResolution = new Point();
if (android.os.Build.VERSION.SDK_INT >= 13) {
display.getSize(screenResolution);
} else {
screenResolution.set(display.getWidth(), display.getHeight());
}
return screenResolution;
}
示例11: provideDragShadowMetrics
import android.graphics.Point; //导入方法依赖的package包/类
public void provideDragShadowMetrics(Point size, Point touch) {
size.set((int)(mBitmap.getWidth() * getScaleX()), (int)(mBitmap.getHeight() * getScaleY()));
final float xGrowth = mBitmap.getWidth() * (getScaleX() - 1);
final float yGrowth = mBitmap.getHeight() * (getScaleY() - 1);
touch.set(
mRegistrationX + (int)Math.round(xGrowth / 2),
mRegistrationY + (int)Math.round(yGrowth / 2));
}
示例12: resolveRelativeTouchPosition
import android.graphics.Point; //导入方法依赖的package包/类
private Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
if (locationOnScreen == null) {
locationOnScreen = new int[2];
touchPosition = new Point();
}
getLocationOnScreen(locationOnScreen);
touchPosition.set(
((int) motionEvent.getRawX()) - locationOnScreen[0],
((int) motionEvent.getRawY()) - locationOnScreen[1]);
return touchPosition;
}
示例13: setupLine
import android.graphics.Point; //导入方法依赖的package包/类
/**
* 初始化曲线数据
*/
private void setupLine() {
if (dataList.isEmpty()) return;
int stepTemp = getTableStart();
Point pre = new Point();
pre.set(stepTemp, -getValueHeight(dataList.get(0).getValue()));//坐标系从0,0默认在第四象限绘制
linePoints[0] = pre;
linePath.moveTo(pre.x, pre.y);
if (dataList.size() == 1) {
isInitialized = true;
return;
}
for (int i = 1; i < dataList.size(); i++) {
Data data = dataList.get(i);
Point next = new Point();
next.set(stepTemp += stepSpace, -getValueHeight(data.getValue()));
if (isBezierLine) {
int cW = pre.x + stepSpace / 2;
Point p1 = new Point();//控制点1
p1.set(cW, pre.y);
Point p2 = new Point();//控制点2
p2.set(cW, next.y);
linePath.cubicTo(p1.x, p1.y, p2.x, p2.y, next.x, next.y);//创建三阶贝塞尔曲线
} else {
linePath.lineTo(next.x, next.y);
}
pre = next;
linePoints[i] = next;
}
isInitialized = true;
}
示例14: getDisplaySize
import android.graphics.Point; //导入方法依赖的package包/类
private Point getDisplaySize() {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point point = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
display.getSize(point);
} else {
point.set(display.getWidth(), display.getHeight());
}
return point;
}
示例15: shiftViewCenter
import android.graphics.Point; //导入方法依赖的package包/类
@Override
public void shiftViewCenter(Direction direction, int shiftAmount, Point outCenter) {
int newX = outCenter.x + direction.applyTo(shiftAmount);
outCenter.set(newX, outCenter.y);
}