List of usage examples for android.graphics PointF PointF
public PointF(float x, float y)
From source file:com.donsen.svg.ui.common.AnimatedSvgView.java
@SuppressWarnings("NewApi") private void init(Context context, AttributeSet attrs) { mFillPaint = new Paint(); mFillPaint.setAntiAlias(true);//from w ww . j a v a 2 s . co m mFillPaint.setStyle(Paint.Style.FILL); mMarkerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, MARKER_LENGTH_DIP, getResources().getDisplayMetrics()); mTraceColors = new int[1]; mTraceColors[0] = Color.BLACK; mTraceResidueColors = new int[1]; mTraceResidueColors[0] = Color.argb(50, 0, 0, 0); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedSvgView); mViewportWidth = a.getInt(R.styleable.AnimatedSvgView_svgImageSizeX, 433); mRatioSizingInfo.aspectRatioWidth = a.getInt(R.styleable.AnimatedSvgView_svgImageSizeX, 433); mViewportHeight = a.getInt(R.styleable.AnimatedSvgView_svgImageSizeY, 433); mRatioSizingInfo.aspectRatioHeight = a.getInt(R.styleable.AnimatedSvgView_svgImageSizeY, 433); mTraceTime = a.getInt(R.styleable.AnimatedSvgView_svgTraceTime, 2000); mTraceTimePerGlyph = a.getInt(R.styleable.AnimatedSvgView_svgTraceTimePerGlyph, 1000); mFillStart = a.getInt(R.styleable.AnimatedSvgView_svgFillStart, 1200); mFillTime = a.getInt(R.styleable.AnimatedSvgView_svgFillTime, 1000); a.recycle(); mViewport = new PointF(mViewportWidth, mViewportHeight); } // See https://github.com/romainguy/road-trip/blob/master/application/src/main/java/org/curiouscreature/android/roadtrip/IntroView.java // 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. // Note that PathDashPathEffects can lead to clipping issues with hardware rendering. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { setLayerType(LAYER_TYPE_SOFTWARE, null); } }
From source file:ca.frozen.rpicameraviewer.views.ZoomPanTextureView.java
public void setPan(float newPanX, float newPanY) { setPan(new PointF(newPanX, newPanY)); }
From source file:com.daitu_liang.study.mytest.svg.AnimatedSvgView.java
private void init(Context context, AttributeSet attrs) { mFillPaint = new Paint(); mFillPaint.setAntiAlias(true);//from w w w .jav a 2s .co m mFillPaint.setStyle(Paint.Style.FILL); mMarkerLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, MARKER_LENGTH_DIP, getResources().getDisplayMetrics()); mTraceColors = new int[1]; mTraceColors[0] = Color.BLACK; mTraceResidueColors = new int[1]; mTraceResidueColors[0] = Color.argb(50, 0, 0, 0); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedSvgView); mViewportWidth = a.getInt(R.styleable.AnimatedSvgView_oakSvgImageSizeX, 433); Log.i(TAG, "mViewportWidth=" + mViewportWidth); mRatioSizingInfo.aspectRatioWidth = a.getInt(R.styleable.AnimatedSvgView_oakSvgImageSizeX, 433); mViewportHeight = a.getInt(R.styleable.AnimatedSvgView_oakSvgImageSizeY, 433); mRatioSizingInfo.aspectRatioHeight = a.getInt(R.styleable.AnimatedSvgView_oakSvgImageSizeY, 433); mTraceTime = a.getInt(R.styleable.AnimatedSvgView_oakSvgTraceTime, 2000); mTraceTimePerGlyph = a.getInt(R.styleable.AnimatedSvgView_oakSvgTraceTimePerGlyph, 1000); mFillStart = a.getInt(R.styleable.AnimatedSvgView_oakSvgFillStart, 1200); mFillTime = a.getInt(R.styleable.AnimatedSvgView_oakSvgFillTime, 1000); a.recycle(); mViewport = new PointF(mViewportWidth, mViewportHeight); } }
From source file:com.iutiao.sdk.views.PasswordEditText.java
public PointF getTopRightCorner() { float src[] = new float[8]; float[] dst = new float[] { 0, 0, getWidth(), 0, 0, getHeight(), getWidth(), getHeight() }; getMatrix().mapPoints(src, dst);// w ww . ja v a 2s . c om return new PointF(getX() + src[2], getY() + src[3]); }
From source file:org.stockchart.series.LinearSeries.java
@Override protected void drawPoint(Canvas c, SeriesPaintInfo pinfo, float x1, float x2, LinePoint p) { fDistanceBetweenPoints = x2 - x1;//from w w w. j a va 2 s . c o m float x = (x1 + x2) / 2f; float y = pinfo.getY(p.getValue()); if (fPoints.isEmpty()) fLinePath.moveTo(x, y); else fLinePath.lineTo(x, y); if (fPoints.isEmpty()) fFillPath.moveTo(x, y); else fFillPath.lineTo(x, y); this.fPoints.add(new PointF(x, y)); if (y < minY) minY = y; }
From source file:io.mattcarroll.hover.defaulthovermenu.view.ViewHoverMenu.java
private PointF loadSavedAnchorState() { return new PointF(mPrefs.getFloat(PREFS_KEY_ANCHOR_SIDE, 2), mPrefs.getFloat(PREFS_KEY_ANCHOR_Y, 0.5f)); }
From source file:org.mozilla.gecko.gfx.ViewportMetrics.java
public PointF getOptimumViewportOffset(IntSize displayportSize) { /* XXX Until bug #524925 is fixed, changing the viewport origin will * cause unnecessary relayouts. This may cause rendering time to * increase and should be considered. *///from www . jav a 2s . com RectF viewport = getClampedViewport(); FloatSize bufferSpace = new FloatSize(displayportSize.width - viewport.width(), displayportSize.height - viewport.height()); PointF optimumOffset = new PointF(bufferSpace.width * ((mViewportBias.x + 1.0f) / 2.0f), bufferSpace.height * ((mViewportBias.y + 1.0f) / 2.0f)); // Make sure this offset won't cause wasted pixels in the displayport // (i.e. make sure the resultant displayport intersects with the page // as much as possible) if (viewport.left - optimumOffset.x < 0) optimumOffset.x = viewport.left; else if ((bufferSpace.width - optimumOffset.x) + viewport.right > mPageSize.width) optimumOffset.x = bufferSpace.width - (mPageSize.width - viewport.right); if (viewport.top - optimumOffset.y < 0) optimumOffset.y = viewport.top; else if ((bufferSpace.height - optimumOffset.y) + viewport.bottom > mPageSize.height) optimumOffset.y = bufferSpace.height - (mPageSize.height - viewport.bottom); return new PointF(Math.round(optimumOffset.x), Math.round(optimumOffset.y)); }
From source file:ca.frozen.rpicameraviewer.views.ZoomPanTextureView.java
public void setZoomPan(float newZoom, float newPanX, float newPanY) { setZoomPan(newZoom, new PointF(newPanX, newPanY)); }
From source file:ru.tinkoff.acquiring.sdk.views.KeyView.java
@Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() != MotionEvent.ACTION_DOWN) { return super.onTouchEvent(event); }//from w w w . ja v a2 s . c om if (drawingPressAnimation) { circleAnimator.cancel(); } drawingPressAnimation = true; circleCenter = new PointF(event.getX(), event.getY()); circleAnimator = createCircleAnimator(); circleAnimator.start(); return super.onTouchEvent(event); }
From source file:cc.kenai.common.AnimatedSvgView.java
public void setViewportSize(int viewportWidth, int viewportHeight) { mViewportWidth = viewportWidth;//from w w w . jav a 2 s . c o m mViewportHeight = viewportHeight; mRatioSizingInfo.aspectRatioWidth = viewportWidth; mRatioSizingInfo.aspectRatioHeight = viewportHeight; mViewport = new PointF(mViewportWidth, mViewportHeight); requestLayout(); }