当前位置: 首页>>代码示例>>Java>>正文


Java Point类代码示例

本文整理汇总了Java中android.graphics.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Point类属于android.graphics包,在下文中一共展示了Point类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setManualFramingRect

import android.graphics.Point; //导入依赖的package包/类
/**
 * Allows third party apps to specify the scanning rectangle dimensions, rather than determine
 * them automatically based on screen resolution.
 *
 * @param width The width in pixels to scan.
 * @param height The height in pixels to scan.
 */
public synchronized void setManualFramingRect(int width, int height) {
  if (initialized) {
    Point screenResolution = configManager.getScreenResolution();
    if (width > screenResolution.x) {
      width = screenResolution.x;
    }
    if (height > screenResolution.y) {
      height = screenResolution.y;
    }
    int leftOffset = (screenResolution.x - width) / 2;
    int topOffset = (screenResolution.y - height) / 2;
    framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
    Log.d(TAG, "Calculated manual framing rect: " + framingRect);
    framingRectInPreview = null;
  } else {
    requestedFramingRectWidth = width;
    requestedFramingRectHeight = height;
  }
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:27,代码来源:CameraManager.java

示例2: drawScrollLine

import android.graphics.Point; //导入依赖的package包/类
private void drawScrollLine(Canvas canvas) {
    Point startp;
    Point endp;
    for (int i = 0; i < mPoints.length - 1; i++) {
        startp = mPoints[i];
        endp = mPoints[i + 1];
        int wt = (startp.x + endp.x) / 2;
        Point p3 = new Point();
        Point p4 = new Point();
        p3.y = startp.y;
        p3.x = wt;
        p4.y = endp.y;
        p4.x = wt;

        Path path = new Path();
        path.moveTo(startp.x, startp.y);
        path.cubicTo(p3.x, p3.y, p4.x, p4.y, endp.x, endp.y);
        canvas.drawPath(path, mPaint);
    }
}
 
开发者ID:freelifer,项目名称:limitjson,代码行数:21,代码来源:LinearGraphView.java

示例3: initFromCameraParameters

import android.graphics.Point; //导入依赖的package包/类
public void initFromCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    Point theScreenResolution = new Point();
    theScreenResolution = getDisplaySize(display);

    screenResolution = theScreenResolution;
    Log.i(TAG, "Screen resolution: " + screenResolution);

    /** 因为换成了竖屏显示,所以不替换屏幕宽高得出的预览图是变形的 */
    Point screenResolutionForCamera = new Point();
    screenResolutionForCamera.x = screenResolution.x;
    screenResolutionForCamera.y = screenResolution.y;

    if (screenResolution.x < screenResolution.y) {
        screenResolutionForCamera.x = screenResolution.y;
        screenResolutionForCamera.y = screenResolution.x;
    }

    cameraResolution = findBestPreviewSizeValue(parameters, screenResolutionForCamera);
    Log.i(TAG, "Camera resolution x: " + cameraResolution.x);
    Log.i(TAG, "Camera resolution y: " + cameraResolution.y);
}
 
开发者ID:WindFromFarEast,项目名称:SmartButler,代码行数:25,代码来源:CameraConfigurationManager.java

示例4: initFromCameraParameters

import android.graphics.Point; //导入依赖的package包/类
/**
 * Reads, one time, values from the camera that are needed by the app.
 */
void initFromCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    // We're landscape-only, and have apparently seen issues with display thinking it's portrait
    // when waking from sleep. If it's not landscape, assume it's mistaken and reverse them:
    if (width < height) {
        Log.i(TAG, "Display reports portrait orientation; assuming this is incorrect");
        int temp = width;
        width = height;
        height = temp;
    }
    screenResolution = new Point(width, height);
    Log.i(TAG, "Screen resolution: " + screenResolution);
    cameraResolution = findBestPreviewSizeValue(parameters, screenResolution);
    Log.i(TAG, "Camera resolution: " + cameraResolution);
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:23,代码来源:CameraConfigurationManager.java

示例5: getNextTilePoint

import android.graphics.Point; //导入依赖的package包/类
private Point getNextTilePoint(int row, int col, int direction) {
    switch (direction) {
        case TrainDirection.LEFT:
            col--;
            break;
        case TrainDirection.RIGHT:
            col++;
            break;
        case TrainDirection.UP:
            row--;
            break;
        case TrainDirection.DOWN:
            row++;
            break;
    }

    return new Point(row, col);
}
 
开发者ID:nirhart,项目名称:shortrain,代码行数:19,代码来源:PathParser.java

示例6: setManualFramingRect

import android.graphics.Point; //导入依赖的package包/类
/**
 * Allows third party apps to specify the scanning rectangle dimensions, rather than determine
 * them automatically based on screen resolution.
 *
 * @param width  The width in pixels to scan.
 * @param height The height in pixels to scan.
 */
public synchronized void setManualFramingRect(int width, int height) {
    if (initialized) {
        Point screenResolution = configManager.getScreenResolution();
        if (width > screenResolution.x) {
            width = screenResolution.x;
        }
        if (height > screenResolution.y) {
            height = screenResolution.y;
        }
        int leftOffset = (screenResolution.x - width) / 2;
        int topOffset = (screenResolution.y - height) / 2;
        framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
        Log.d(TAG, "Calculated manual framing rect: " + framingRect);
        framingRectInPreview = null;
    } else {
        requestedFramingRectWidth = width;
        requestedFramingRectHeight = height;
    }
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:27,代码来源:CameraManager.java

示例7: isNavigationBarShow

import android.graphics.Point; //导入依赖的package包/类
public static boolean isNavigationBarShow(Activity activity){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y!=size.y;
    }else {
        boolean menu = ViewConfiguration.get(activity).hasPermanentMenuKey();
        boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        if(menu || back) {
            return false;
        }else {
            return true;
        }
    }
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:19,代码来源:ViewUtil.java

示例8: drawLinePoints

import android.graphics.Point; //导入依赖的package包/类
/**
 * 绘制曲线上的锚点
 *
 * @param canvas
 */
private void drawLinePoints(Canvas canvas) {
    if (linePoints == null) return;

    float pointWidth = dip2px(pointWidthDP) / 2;
    int pointCount = linePoints.length;
    if (isPlayAnim) {
        pointCount = Math.round(currentValue * linePoints.length);
    }
    for (int i = 0; i < pointCount; i++) {
        Point point = linePoints[i];
        if (point == null) break;
        if (isCubePoint) {
            canvas.drawPoint(point.x, point.y, pointPaint);
        } else {
            canvas.drawCircle(point.x, point.y, pointWidth, pointPaint);
        }
        //绘制点的文本
        drawLinePointText(canvas, String.valueOf(dataList.get(i).getValue()), point.x, point.y);
    }
}
 
开发者ID:jeanboydev,项目名称:Android-LineChart,代码行数:26,代码来源:LineChartView.java

示例9: clickedOn

import android.graphics.Point; //导入依赖的package包/类
/**
 * checks if pt is on root and calls itself recursivly to check root's children
 * @param pt the point we want to check the location of
 * @param root the message we want to check if the point is on
 * @return root if pt is on it, null otherwise
 * @author Paul Best
 */
public Message clickedOn(Point pt, Message root){
    Message answer;
    for(int i = 0; i<root.getChildren().size();i++){
        answer = clickedOn(pt,root.getChildren().get(i));
        if(answer!=null){
            return  answer;
        }
    }
    if(Math.pow(Math.pow(pt.x/mScaleFactor-(root.getGoval().getX()+mPosX/mScaleFactor),2)+Math.pow(pt.y/mScaleFactor-(root.getGoval().getY()+mPosY/mScaleFactor),2),0.5)<root.getGoval().getRay()){
        return root;
    }
    else{
        return null;
    }
}
 
开发者ID:jkobject,项目名称:PiPle,代码行数:23,代码来源:Window.java

示例10: getRealScreenSize

import android.graphics.Point; //导入依赖的package包/类
public static Point getRealScreenSize(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();

    if (Build.VERSION.SDK_INT >= 17) {
        display.getRealSize(size);
    } else {
        try {
            size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
            size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    return size;
}
 
开发者ID:qiujuer,项目名称:AirPanel,代码行数:19,代码来源:MainActivity.java

示例11: getFramingRectInPreview

import android.graphics.Point; //导入依赖的package包/类
/**
 * Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
 * not UI / screen.
 */
public Rect getFramingRectInPreview() {
	if (framingRectInPreview == null) {
		Rect rect = new Rect(getFramingRect());
		Point cameraResolution = configManager.getCameraResolution();
		Point screenResolution = configManager.getScreenResolution();
		//modify here
		//      rect.left = rect.left * cameraResolution.x / screenResolution.x;
		//      rect.right = rect.right * cameraResolution.x / screenResolution.x;
		//      rect.top = rect.top * cameraResolution.y / screenResolution.y;
		//      rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
		rect.left = rect.left * cameraResolution.y / screenResolution.x;
		rect.right = rect.right * cameraResolution.y / screenResolution.x;
		rect.top = rect.top * cameraResolution.x / screenResolution.y;
		rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
		framingRectInPreview = rect;
	}
	return framingRectInPreview;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:CameraManager.java

示例12: resetDensity

import android.graphics.Point; //导入依赖的package包/类
/**
 * 重新计算displayMetrics.xhdpi, 使单位pt重定义为设计稿的相对长度
 * @see #activate()
 *
 * @param context
 * @param designWidth 设计稿的宽度
 */
public static void resetDensity(Context context, float designWidth){
    if(context == null)
        return;

    Point size = new Point();
    ((WindowManager)context.getSystemService(WINDOW_SERVICE)).getDefaultDisplay().getSize(size);

    Resources resources = context.getResources();

    resources.getDisplayMetrics().xdpi = size.x/designWidth*72f;

    DisplayMetrics metrics = getMetricsOnMiui(context.getResources());
    if(metrics != null)
        metrics.xdpi = size.x/designWidth*72f;
}
 
开发者ID:Firedamp,项目名称:Rudeness,代码行数:23,代码来源:RudenessScreenHelper.java

示例13: drawWaypoints

import android.graphics.Point; //导入依赖的package包/类
private void drawWaypoints(Canvas canvas, Paint paint, List<Point> waypoints) {
	if ((waypoints == null) || (waypoints.size()==0)) {
		return;
	}
	Paint p = new Paint(paint);
	p.setStyle(Style.STROKE);
	p.setColor(Color.RED);
	p.setStrokeWidth(2.0f);
	Path path = new Path();
	Point startPoint = waypoints.get(0);
	path.moveTo(startPoint.x, startPoint.y);
	for (int i=1; i<waypoints.size()-1; i++) {
		Point point = waypoints.get(i);
		path.lineTo(point.x, point.y);
	}
	Point endPoint = waypoints.get(waypoints.size()-1);
	path.setLastPoint(endPoint.x, endPoint.y);
	canvas.drawPath(path, p);
}
 
开发者ID:zipzapdat,项目名称:AndroFish,代码行数:20,代码来源:AndroidFishEatingFish.java

示例14: CubeLoadingView

import android.graphics.Point; //导入依赖的package包/类
public CubeLoadingView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CubeLoadingView);
    mShadowEnable = a.getBoolean(R.styleable.CubeLoadingView_shadowEnable, true);
    MAIN_COLOR = a.getColor(R.styleable.CubeLoadingView_mainColor, MAIN_COLOR);
    CEIL_COLOR = a.getColor(R.styleable.CubeLoadingView_ceilColor, CEIL_COLOR);
    SHADOW_COLOR = a.getColor(R.styleable.CubeLoadingView_shadowColor, SHADOW_COLOR);
    T = a.getInteger(R.styleable.CubeLoadingView_duration, T);
    a.recycle();
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);
    mOrigin = new Point();
    mCubes = new ArrayList<>();

    if (SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mCubePathCollection = new Path();
        mShadowPathCollection = new Path();
        mCeilPathCollection = new Path();
    } else {
        mCubePaths = new ArrayList<>();
        mShadowPaths = new ArrayList<>();
        mCeilPaths = new ArrayList<>();
    }
}
 
开发者ID:thunderpunch,项目名称:CubeLoadingView,代码行数:25,代码来源:CubeLoadingView.java

示例15: MuPDFReflowView

import android.graphics.Point; //导入依赖的package包/类
public MuPDFReflowView(Context c, MuPDFCore core, Point parentSize) {
	super(c);
	mHandler = new Handler();
	mCore = core;
	mParentSize = parentSize;
	mScale = 1.0f;
	mContentHeight = parentSize.y;
	getSettings().setJavaScriptEnabled(true);
	addJavascriptInterface(new Object(){
		public void reportContentHeight(String value) {
			mContentHeight = (int)Float.parseFloat(value);
			mHandler.post(new Runnable() {
				public void run() {
					requestLayout();
				}
			});
		}
	}, "HTMLOUT");
	setWebViewClient(new WebViewClient() {
		@Override
		public void onPageFinished(WebView view, String url) {
			setScale(mScale);
		}
	});
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-old,代码行数:26,代码来源:MuPDFReflowView.java


注:本文中的android.graphics.Point类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。