List of usage examples for android.graphics PointF PointF
public PointF(float x, float y)
From source file:org.mozilla.gecko.gfx.ViewportMetrics.java
public PointF getOrigin() { return new PointF(mViewportRect.left, mViewportRect.top); }
From source file:andoridhost.imczy.com.activitymaterial.custom.ReturnChangePosition.java
@Override public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { if (null == startValues || null == endValues) { return null; }/* w w w . j a va 2 s .com*/ if (startValues.view.getId() > 0) { Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION); Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION); final View view = endValues.view; Log.e(TAG, "createAnimator: startRect = " + startRect + " , endRect = " + endRect); Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(), endRect.centerX(), endRect.centerY() - endRect.height() / 2); int radius = startRect.centerY() - endRect.centerY(); Log.e(TAG, "createAnimator: startRect center x = " + startRect.centerX() + " , centerY= " + startRect.centerY()); Log.w(TAG, "createAnimator: end rect center x = " + endRect.centerX() + " , centerY= " + endRect.centerY()); ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, new PropPosition(PointF.class, "position", new PointF(startRect.centerX(), startRect.centerY())), null, changePosPath); objectAnimator.setInterpolator(new FastOutSlowInInterpolator()); return objectAnimator; } return null; }
From source file:project.pamela.slambench.fragments.TemperaturePlot.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Replace LinearLayout by the type of the root element of the layout you're trying to load LinearLayout llLayout = (LinearLayout) inflater.inflate(R.layout.fragment_plot, container, false); // Retrieve bench number Intent mIntent = super.getActivity().getIntent(); final int intValue = mIntent.getIntExtra(ResultActivity.SELECTED_TEST_TAG, 0); SLAMResult value = SLAMBenchApplication.getResults().get(intValue); if (!value.isFinished()) { Log.e(SLAMBenchApplication.LOG_TAG, this.getResources().getString(R.string.debug_proposed_value_not_valid)); return llLayout; }//from w w w . ja va 2s.c om // initialize our XYPlot reference: XYPlot plot = (XYPlot) llLayout.findViewById(R.id.mySimpleXYPlot); plot.setBackgroundColor(Color.WHITE); plot.setTitle(value.test.name); plot.setDomainLabel(this.getResources().getString(R.string.legend_frame_number)); plot.setRangeLabel(this.getResources().getString(R.string.legend_degrees)); plot.setBackgroundColor(Color.WHITE); plot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE); plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE); plot.getGraphWidget().getDomainLabelPaint().setColor(Color.BLACK); plot.getGraphWidget().getRangeLabelPaint().setColor(Color.BLACK); plot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.BLACK); plot.getGraphWidget().getDomainOriginLinePaint().setColor(Color.BLACK); plot.getGraphWidget().getRangeOriginLinePaint().setColor(Color.BLACK); plot.getGraphWidget().setRangeValueFormat(new DecimalFormat("#####.##")); int border = 60; int legendsize = 110; plot.getGraphWidget().position(border, XLayoutStyle.ABSOLUTE_FROM_LEFT, border, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.LEFT_BOTTOM); plot.getGraphWidget() .setSize(new SizeMetrics(border + legendsize, SizeLayoutType.FILL, border, SizeLayoutType.FILL)); // reduce the number of range labels plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 10); plot.setDomainValueFormat(new DecimalFormat("#")); plot.setRangeStep(XYStepMode.SUBDIVIDE, 10); //Remove legend //plot.getLayoutManager().remove(plot.getLegendWidget()); //plot.getLayoutManager().remove(plot.getDomainLabelWidget()); //plot.getLayoutManager().remove(plot.getRangeLabelWidget()); plot.getLayoutManager().remove(plot.getTitleWidget()); // Set legend plot.getLegendWidget().setTableModel(new DynamicTableModel(4, 2)); Paint bgPaint = new Paint(); bgPaint.setColor(Color.BLACK); bgPaint.setStyle(Paint.Style.FILL); bgPaint.setAlpha(140); plot.getLegendWidget().setBackgroundPaint(bgPaint); plot.getLegendWidget() .setSize(new SizeMetrics(legendsize, SizeLayoutType.ABSOLUTE, 0, SizeLayoutType.FILL)); plot.getLegendWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_RIGHT, 0, YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.RIGHT_TOP); plot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_CENTER, 0, YLayoutStyle.RELATIVE_TO_BOTTOM, AnchorPosition.BOTTOM_MIDDLE); int strokecolor = Color.rgb(67, 137, 192); int fillcolor = Color.rgb(213, 229, 255); Double temperatureNumbers[] = value.gettemperatureList(); XYSeries series = new SimpleXYSeries(Arrays.asList(temperatureNumbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, this.getResources().getString(R.string.legend_degrees)); LineAndPointFormatter seriesFormat = new LineAndPointFormatter(strokecolor, strokecolor, null, null); Paint lineFill = new Paint(); lineFill.setAlpha(200); DisplayMetrics metrics = new DisplayMetrics(); super.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); lineFill.setShader( new LinearGradient(0, 0, 0, metrics.heightPixels, Color.WHITE, fillcolor, Shader.TileMode.MIRROR)); seriesFormat.setPointLabeler(new PointLabeler() { @Override public String getLabel(XYSeries series, int index) { return "o"; } }); seriesFormat.setFillPaint(lineFill); plot.addSeries(series, seriesFormat); plot.redraw(); plot.calculateMinMaxVals(); PointF minXY = new PointF(plot.getCalculatedMinX().floatValue(), plot.getCalculatedMinY().floatValue()); PointF maxXY = new PointF(plot.getCalculatedMaxX().floatValue(), plot.getCalculatedMaxY().floatValue()); plot.setDomainBoundaries(0, value.test.dataset.getFrameCount() - 1, BoundaryMode.FIXED); plot.setRangeBoundaries(Math.min(0, minXY.y), maxXY.y * 1.2f, BoundaryMode.FIXED); plot.redraw(); return llLayout; }
From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java
private ValueAnimator getBezierValueAnimator(View target) { //??- - /*from w ww . j a v a 2s . co m*/ BezierEvaluator evaluator = new BezierEvaluator(getPointF(2), getPointF(1)); // ? ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF((mWidth - dWidth) / 2, mHeight - dHeight), new PointF(random.nextInt(getWidth()), 0)); animator.addUpdateListener(new BezierListenr(target)); animator.setTarget(target); animator.setDuration(1500); return animator; }
From source file:org.mozilla.gecko.gfx.ViewportMetrics.java
public PointF getDisplayportOrigin() { return new PointF(mViewportRect.left - mViewportOffset.x, mViewportRect.top - mViewportOffset.y); }
From source file:andoridhost.imczy.com.activitymaterial.custom.ChangePosition.java
@Override public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { if (null == startValues || null == endValues) { return null; }/*from ww w . j ava2s .co m*/ if (startValues.view.getId() > 0) { Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION); Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION); final View view = endValues.view; Log.e(TAG, "createAnimator: startRect = " + startRect + " , endRect = " + endRect); Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(), endRect.centerX(), endRect.centerY()); int radius = startRect.centerY() - endRect.centerY(); ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, new PropPosition(PointF.class, "position", new PointF(endRect.centerX(), endRect.centerY())), null, changePosPath); objectAnimator.setInterpolator(new FastOutSlowInInterpolator()); return objectAnimator; } return null; }
From source file:vi.pdfscanner.fragment.CropFragment.java
private List<PointF> getContourEdgePoints(Bitmap tempBitmap) { float[] points = ScannerEngine.getInstance().getPoints(tempBitmap); float x1 = points[0]; float x2 = points[1]; float x3 = points[2]; float x4 = points[3]; float y1 = points[4]; float y2 = points[5]; float y3 = points[6]; float y4 = points[7]; List<PointF> pointFs = new ArrayList<>(); pointFs.add(new PointF(x1, y1)); pointFs.add(new PointF(x2, y2)); pointFs.add(new PointF(x3, y3)); pointFs.add(new PointF(x4, y4)); return pointFs; }
From source file:com.richtodd.android.quiltdesign.block.PaperPiecedBlockPiece.java
static final PaperPiecedBlockPiece createFromJSONObject(JSONObject jsonObject) throws JSONException { PointF from = new PointF((float) jsonObject.getDouble("from_x"), (float) jsonObject.getDouble("from_y")); PointF to = new PointF((float) jsonObject.getDouble("to_x"), (float) jsonObject.getDouble("to_y")); int color = jsonObject.getInt("color"); PaperPiecedBlockPiece piece = new PaperPiecedBlockPiece(from, to, color); return piece; }
From source file:ca.frozen.rpicameraviewer.views.ZoomPanTextureView.java
private PointF getMaxPan() { int viewWidth = getWidth(); int viewHeight = getHeight(); return new PointF(Math.max(Math.round((fitWidth * zoom - viewWidth) / 2), 0), Math.max(Math.round((fitHeight * zoom - viewHeight) / 2), 0)); }
From source file:dimchoi.com.my.widget.AnimatedSvgView.java
private void init(Context context, AttributeSet attrs) { mFillPaint = new Paint(); mFillPaint.setAntiAlias(true);//from ww w . j a va 2s . c o m mFillPaint.setStyle(Paint.Style.FILL); mTraceColors = new int[1]; mTraceColors[0] = Color.BLACK; mTraceResidueColors = new int[1]; mTraceResidueColors[0] = 0x32000000; if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedSvgView); mViewportWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512); aspectRatioWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512); mViewportHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512); aspectRatioHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512); mTraceTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTime, 2000); mTraceTimePerGlyph = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTimePerGlyph, 1000); mFillStart = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillStart, 1200); mFillTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillTime, 1000); int traceMarkerLength = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceMarkerLength, 16); mMarkerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, traceMarkerLength, getResources().getDisplayMetrics()); int glyphStringsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgGlyphStrings, 0); int traceResidueColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceResidueColors, 0); int traceColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceColors, 0); int fillColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgFillColors, 0); a.recycle(); if (glyphStringsId != 0) { setGlyphStrings(getResources().getStringArray(glyphStringsId)); setTraceResidueColor(Color.argb(50, 0, 0, 0)); setTraceColor(Color.BLACK); } if (traceResidueColorsId != 0) { setTraceResidueColors(getResources().getIntArray(traceResidueColorsId)); } if (traceColorsId != 0) { setTraceColors(getResources().getIntArray(traceColorsId)); } if (fillColorsId != 0) { setFillColors(getResources().getIntArray(fillColorsId)); } mViewport = new PointF(mViewportWidth, mViewportHeight); } // Note: using a software layer here is an optimization. This view works with hardware accelerated rendering but // every time a path is modified (when the dash path effect is modified), the graphics pipeline will rasterize // the path again in a new texture. Since we are dealing with dozens of paths, it is much more efficient to // rasterize the entire view into a single re-usable texture instead. Ideally this should be toggled using a // heuristic based on the number and or dimensions of paths to render. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { setLayerType(LAYER_TYPE_SOFTWARE, null); } }