/**
* 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;
}
}
java类android.graphics.Point的实例源码
CameraManager.java 文件源码
项目:tvConnect_android
阅读 77
收藏 0
点赞 0
评论 0
LinearGraphView.java 文件源码
项目:limitjson
阅读 33
收藏 0
点赞 0
评论 0
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);
}
}
CameraConfigurationManager.java 文件源码
项目:SmartButler
阅读 38
收藏 0
点赞 0
评论 0
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);
}
CameraConfigurationManager.java 文件源码
项目:android-mrz-reader
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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);
}
PathParser.java 文件源码
项目:shortrain
阅读 41
收藏 0
点赞 0
评论 0
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);
}
CameraManager.java 文件源码
项目:CodeScaner
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
ViewUtil.java 文件源码
项目:Bigbang
阅读 41
收藏 0
点赞 0
评论 0
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;
}
}
}
LineChartView.java 文件源码
项目:Android-LineChart
阅读 50
收藏 0
点赞 0
评论 0
/**
* 绘制曲线上的锚点
*
* @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);
}
}
Window.java 文件源码
项目:PiPle
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
MainActivity.java 文件源码
项目:AirPanel
阅读 37
收藏 0
点赞 0
评论 0
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;
}
CameraManager.java 文件源码
项目:GitHub
阅读 43
收藏 0
点赞 0
评论 0
/**
* 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;
}
RudenessScreenHelper.java 文件源码
项目:Rudeness
阅读 34
收藏 0
点赞 0
评论 0
/**
* 重新计算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;
}
AndroidFishEatingFish.java 文件源码
项目:AndroFish
阅读 37
收藏 0
点赞 0
评论 0
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);
}
CubeLoadingView.java 文件源码
项目:CubeLoadingView
阅读 35
收藏 0
点赞 0
评论 0
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<>();
}
}
MuPDFReflowView.java 文件源码
项目:mupdf-android-viewer-old
阅读 39
收藏 0
点赞 0
评论 0
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);
}
});
}
FitViewHelper.java 文件源码
项目:EZFilter
阅读 35
收藏 0
点赞 0
评论 0
/**
* 计算预览区域大小
*
* @param measureWidth
* @param measureHeight
* @return 是否应该调用requestLayout刷新视图
*/
protected boolean calculatePreviewSize(int measureWidth, int measureHeight) {
Point size;
if (mScaleType == ScaleType.FIT_CENTER) {
size = fitCenter(measureWidth, measureHeight);
} else if (mScaleType == ScaleType.FIT_WIDTH) {
size = fitWidth(measureWidth, measureHeight);
} else if (mScaleType == ScaleType.FIT_HEIGHT) {
size = fitHeight(measureWidth, measureHeight);
} else {
size = centerCrop(measureWidth, measureHeight);
}
boolean change = size.x != mPreviewWidth || size.y != mPreviewHeight;
mPreviewWidth = size.x;
mPreviewHeight = size.y;
return change;
}
MyApplication.java 文件源码
项目:seeta4Android
阅读 37
收藏 0
点赞 0
评论 0
/**
* 获取最佳预览大小
* @param parameters 相机参数
* @param screenResolution 屏幕宽高
* @return
*/
public static Point getBestCameraResolution(Camera.Parameters parameters, Point screenResolution) {
float tmp = 0f;
float mindiff = 100f;
float x_d_y = (float) screenResolution.x / (float) screenResolution.y;
Camera.Size best = null;
List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes();
for (Camera.Size s : supportedPreviewSizes) {
tmp = Math.abs(((float) s.width / (float) s.height) - x_d_y);
if (tmp < mindiff) {
mindiff = tmp;
best = s;
}
}
return new Point(best.width, best.height);
}
CameraConfigurationManager.java 文件源码
项目:tvConnect_android
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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();
Point theScreenResolution = new Point();
display.getSize(theScreenResolution);
screenResolution = theScreenResolution;
Log.i(TAG, "Screen resolution: " + screenResolution);
//解决竖屏后图像拉伸问题
Point screenResolutionForCamera = new Point();
screenResolutionForCamera.x = screenResolution.x;
screenResolutionForCamera.y = screenResolution.y;
// preview size is always something like 480*320, other 320*480
if (screenResolution.x < screenResolution.y) {
screenResolutionForCamera.x = screenResolution.y;
screenResolutionForCamera.y = screenResolution.x;
}
//TODO check
// cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);
cameraResolution = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolutionForCamera);
Log.i(TAG, "Camera resolution: " + cameraResolution);
}
PreviewCallback.java 文件源码
项目:tvConnect_android
阅读 37
收藏 0
点赞 0
评论 0
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Point cameraResolution = configManager.getCameraResolution();
Handler thePreviewHandler = previewHandler;
if (cameraResolution != null && thePreviewHandler != null) {
Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x,
cameraResolution.y, data);
message.sendToTarget();
previewHandler = null;
} else {
Log.d(TAG, "Got preview callback, but no handler or resolution available");
}
}
CameraConfigurationManager.java 文件源码
项目:Hitalk
阅读 35
收藏 0
点赞 0
评论 0
private static Point findBestPreviewSizeValue(CharSequence previewSizeValueString, Point screenResolution) {
int bestX = 0;
int bestY = 0;
int diff = Integer.MAX_VALUE;
for (String previewSize : COMMA_PATTERN.split(previewSizeValueString)) {
previewSize = previewSize.trim();
int dimPosition = previewSize.indexOf('x');
if (dimPosition < 0) {
continue;
}
int newX;
int newY;
try {
newX = Integer.parseInt(previewSize.substring(0, dimPosition));
newY = Integer.parseInt(previewSize.substring(dimPosition + 1));
} catch (NumberFormatException nfe) {
continue;
}
int newDiff = Math.abs(newX - screenResolution.x) + Math.abs(newY - screenResolution.y);
if (newDiff == 0) {
bestX = newX;
bestY = newY;
break;
} else if (newDiff < diff) {
bestX = newX;
bestY = newY;
diff = newDiff;
}
}
if (bestX > 0 && bestY > 0) {
return new Point(bestX, bestY);
}
return null;
}
CameraConfigurationManager.java 文件源码
项目:TPlayer
阅读 36
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private Point getDisplaySize(final Display display) {
final Point point = new Point();
try {
display.getSize(point);
} catch (NoSuchMethodError ignore) {
point.x = display.getWidth();
point.y = display.getHeight();
}
return point;
}
DocPageView.java 文件源码
项目:mupdf-android-viewer-nui
阅读 41
收藏 0
点赞 0
评论 0
public boolean hitTest(Point pt)
{
PointF ul = new PointF(mPoint.x, mPoint.y-50);
PointF dr = new PointF(mPoint.x+50, mPoint.y);
Rect rect = new Rect((int)ul.x, (int)ul.y, (int)dr.x, (int)dr.y);
if (rect.contains(pt.x, pt.y))
return true;
return false;
}
GifSizeFilter.java 文件源码
项目:P2Video-master
阅读 35
收藏 0
点赞 0
评论 0
@Override
public UncapableCause filter(Context context, Item item) {
if (!needFiltering(context, item))
return null;
Point size = PhotoMetadataUtils.getBitmapBound(context.getContentResolver(), item.getContentUri());
if (size.x < mMinWidth || size.y < mMinHeight || item.size > mMaxSize) {
return new UncapableCause(UncapableCause.DIALOG, context.getString(R.string.error_gif, mMinWidth,
String.valueOf(PhotoMetadataUtils.getSizeInMB(mMaxSize))));
}
return null;
}
NaviConfirmPointActivity.java 文件源码
项目:AssistantBySDK
阅读 31
收藏 0
点赞 0
评论 0
/**
* 设置检索结果显示索引(若有多个结果则地图缩放到保证所有结果可见)
**/
private void setPoiPosition() {
if (aList.size() == 0 || poiOverlay == null)
return;
if (aList.size() == 1) {
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
.targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
.zoom(17F);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
} else
poiOverlay.zoomToSpan();
}
CameraManager.java 文件源码
项目:letv
阅读 41
收藏 0
点赞 0
评论 0
public Rect getFramingRectInPreview() {
if (this.framingRectInPreview == null) {
Rect rect = new Rect(getFramingRect());
Point cameraResolution = this.configManager.getCameraResolution();
Point screenResolution = this.configManager.getScreenResolution();
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;
this.framingRectInPreview = rect;
}
return this.framingRectInPreview;
}
CommonUtils.java 文件源码
项目:martian-cli
阅读 46
收藏 0
点赞 0
评论 0
public static int getDisplayWidth(Activity activity){
int width=0;
if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) {
Point point=new Point();
activity.getWindowManager().getDefaultDisplay().getSize(point);
width = point.x;
}
return width;
}
Touch.java 文件源码
项目:AdronEngine
阅读 41
收藏 0
点赞 0
评论 0
/**
* @param onTouchListener interface implemented in activity
*/
public Touch(IOnTouchListener onTouchListener) {
this.mOnTouchListener = onTouchListener;
numOfTouches = 0;
isBeingTouch = false;
this.mPoint = new Point();
}
CameraConfigurationManager.java 文件源码
项目:APIJSON-Android-RxJava
阅读 49
收藏 0
点赞 0
评论 0
/**
* Reads, one time, values from the camera that are needed by the app.
*/
void initFromCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
previewFormat = parameters.getPreviewFormat();
previewFormatString = parameters.get("preview-format");
Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
screenResolution = new Point(display.getWidth(), display.getHeight());
Log.d(TAG, "Screen resolution: " + screenResolution);
// //Lemon add 扫描框修改,解决拉伸但导致成像模糊识别率很低。<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// Point screenResolutionForCamera = new Point();
// screenResolutionForCamera.x = screenResolution.x;
// screenResolutionForCamera.y = screenResolution.y;
// // preview size is always something like 480*320, other 320*480
// if (screenResolution.x < screenResolution.y) {
// screenResolutionForCamera.x = screenResolution.y;
// screenResolutionForCamera.y = screenResolution.x;
// }
//Lemon add 扫描框修改,解决拉伸>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Lemon 扫描框修改,解决拉伸但导致成像模糊识别率很低 screenResolution改为screenResolutionForCamera);<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cameraResolution = getCameraResolution(parameters, screenResolution);
Log.d(TAG, "Camera resolution: " + screenResolution);
//Lemon 扫描框修改,解决拉伸但导致成像模糊识别率很低 screenResolution改为screenResolutionForCamera);>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
}
Utils.java 文件源码
项目:editor-sql
阅读 40
收藏 0
点赞 0
评论 0
public static Point MeasureString(Context context, String text, float fontSize, int widthMeasureSpec, int heightMeasureSpec) {
int width = 0;
int height = 0;
if (null == context || null == text || text.isEmpty() || 0 == fontSize) {
return null;
}
TextView tv = new TextView(context);
tv.setText(text);// 待测文本
tv.setTextSize(fontSize);// 字体
if (ViewGroup.LayoutParams.WRAP_CONTENT != widthMeasureSpec && ViewGroup.LayoutParams.MATCH_PARENT != widthMeasureSpec) {
tv.setWidth(widthMeasureSpec);// 如果设置了宽度,字符串的宽度则为所设置的宽度
}
if (ViewGroup.LayoutParams.WRAP_CONTENT != heightMeasureSpec && ViewGroup.LayoutParams.MATCH_PARENT != heightMeasureSpec) {
tv.setHeight(heightMeasureSpec);
}
tv.setSingleLine(false);// 多行
tv.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
width = tv.getMeasuredWidth();
height = tv.getMeasuredHeight();
Point point = new Point();
point.x = width;
point.y = height;
return point;
}
ColorFinder.java 文件源码
项目:https-github.com-hyb1996-NoRootScriptDroid
阅读 39
收藏 0
点赞 0
评论 0
@Override
public void run() {
Thread thread = Thread.currentThread();
ColorIterator.Pixel pixel = new ColorIterator.Pixel();
while (mColorIterator.hasNext() && !thread.isInterrupted()) {
mColorIterator.nextColor(pixel);
if (mColorDetector.detectsColor(pixel.red, pixel.green, pixel.blue)) {
mResult.add(new Point(mColorIterator.getX(), mColorIterator.getY()));
}
}
if (thread.isInterrupted()) {
throw new ScriptInterruptedException();
}
}