當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。