Example usage for android.graphics RectF RectF

List of usage examples for android.graphics RectF RectF

Introduction

In this page you can find the example usage for android.graphics RectF RectF.

Prototype

public RectF(float left, float top, float right, float bottom) 

Source Link

Document

Create a new rectangle with the specified coordinates.

Usage

From source file:org.mozilla.gecko.gfx.RectUtils.java

public static RectF interpolate(RectF from, RectF to, float t) {
    return new RectF(FloatUtils.interpolate(from.left, to.left, t), FloatUtils.interpolate(from.top, to.top, t),
            FloatUtils.interpolate(from.right, to.right, t), FloatUtils.interpolate(from.bottom, to.bottom, t));
}

From source file:net.simno.dmach.ui.view.SequencerView.java

private void initSteps() {
    for (int channel = 0; channel < CHANNELS; ++channel) {
        for (int step = 0; step < STEPS; ++step) {
            float left = step * stepWidthMargin;
            float right = left + stepWidth;
            float top = channel * stepHeightMargin;
            float bottom = top + stepHeight;
            int index = (channel * STEPS) + step;
            sequence.get(index).rect = new RectF(left, top, right, bottom);
        }/*from  w w  w. j  a  v  a2 s  .co  m*/
    }
}

From source file:org.mozilla.gecko.gfx.ViewportMetrics.java

public ViewportMetrics(JSONObject json) throws JSONException {
    float x = (float) json.getDouble("x");
    float y = (float) json.getDouble("y");
    float width = (float) json.getDouble("width");
    float height = (float) json.getDouble("height");
    float pageWidth = (float) json.getDouble("pageWidth");
    float pageHeight = (float) json.getDouble("pageHeight");
    float offsetX = (float) json.getDouble("offsetX");
    float offsetY = (float) json.getDouble("offsetY");
    float zoom = (float) json.getDouble("zoom");

    mPageSize = new FloatSize(pageWidth, pageHeight);
    mViewportRect = new RectF(x, y, x + width, y + height);
    mViewportOffset = new PointF(offsetX, offsetY);
    mZoomFactor = zoom;//w ww  . j  av  a  2  s  . co  m
    mViewportBias = new PointF(0.0f, 0.0f);
}

From source file:me.lizheng.deckview.views.DeckChildViewHeader.java

@SuppressLint("DrawAllocation")
@Override/*from   w  w w. j  a  va2 s. c o m*/
protected void onDraw(Canvas canvas) {
    // Draw the highlight at the top edge (but put the bottom edge just out of view)
    float offset = (float) Math.ceil(mConfig.taskViewHighlightPx / 2f);
    float radius = mConfig.taskViewRoundedCornerRadiusPx;
    int count = canvas.save(Canvas.CLIP_SAVE_FLAG);
    canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
    canvas.drawRoundRect(
            new RectF(-offset, 0f, (float) getMeasuredWidth() + offset, getMeasuredHeight() + radius), radius,
            radius, sHighlightPaint);
    canvas.restoreToCount(count);
}

From source file:com.google.android.apps.iosched.ui.SessionDetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_session_detail);

    mTitle = (TextView) findViewById(R.id.session_title);
    mSubtitle = (TextView) findViewById(R.id.session_subtitle);
    mStarred = (CompoundButton) findViewById(R.id.star_button);

    mStarred.setFocusable(true);/*from www  .j a  va2s. co m*/
    mStarred.setClickable(true);

    // Larger target triggers star toggle
    final View starParent = findViewById(R.id.list_item_session);
    FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f));

    mAbstract = (TextView) findViewById(R.id.session_abstract);
    mRequirements = (TextView) findViewById(R.id.session_requirements);

    final Intent intent = getIntent();
    mSessionUri = intent.getData();
    mSessionId = Sessions.getSessionId(mSessionUri);

    setupSummaryTab();
    setupNotesTab();

    // Start background queries to load session and track details
    final Uri trackUri = resolveTrackUri(intent);
    final Uri speakersUri = Sessions.buildSpeakersDirUri(mSessionId);

    mHandler = new NotifyingAsyncQueryHandler(getContentResolver(), this);
    mHandler.startQuery(SessionsQuery._TOKEN, mSessionUri, SessionsQuery.PROJECTION);
    mHandler.startQuery(TracksQuery._TOKEN, trackUri, TracksQuery.PROJECTION);
    mHandler.startQuery(SpeakersQuery._TOKEN, speakersUri, SpeakersQuery.PROJECTION);
}

From source file:om.sstvencoder.CropView.java

private void resetInputRect() {
    float iw = mModeSize.getWidth();
    float ih = mModeSize.getHeight();
    float ow = mImageWidth;
    float oh = mImageHeight;
    if (iw * oh > ow * ih) {
        mInputRect = new RectF(0.0f, 0.0f, (iw * oh) / ih, oh);
        mInputRect.offset((ow - (iw * oh) / ih) / 2.0f, 0.0f);
    } else {//from   www  .ja v  a  2  s  . co  m
        mInputRect = new RectF(0.0f, 0.0f, ow, (ih * ow) / iw);
        mInputRect.offset(0.0f, (oh - (ih * ow) / iw) / 2.0f);
    }
}

From source file:cn.finalteam.galleryfinal.widget.FloatingActionButton.java

void updateBackground() {
    float circleLeft = mShadowRadius;
    float circleTop = mShadowRadius - mShadowOffset;

    final RectF circleRect = new RectF(circleLeft, circleTop, circleLeft + mCircleSize,
            circleTop + mCircleSize);//  w w w. j  a v a 2 s . c o m

    LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { new BitmapDrawable(getResources()),
            createFillDrawable(circleRect), new BitmapDrawable(getResources()), getIconDrawable() });

    float iconOffset = (mCircleSize - getDimension(R.dimen.fab_icon_size)) / 2f;

    int iconInsetHorizontal = (int) (mShadowRadius + iconOffset);
    int iconInsetTop = (int) (circleTop + iconOffset);
    int iconInsetBottom = (int) (mShadowRadius + mShadowOffset + iconOffset);

    layerDrawable.setLayerInset(3, iconInsetHorizontal, iconInsetTop, iconInsetHorizontal, iconInsetBottom);

    setBackgroundCompat(layerDrawable);
}

From source file:com.example.zhangyangjing.roundcornerimageview.BezelImageView.java

private void generateMaskPath(int width, int height) {
    mMaskedPath = new Path();
    mMaskedPath.addRoundRect(new RectF(0.0F, 0.0F, width, height), mCornerRadius, mCornerRadius,
            Path.Direction.CW);/*from   ww  w .ja va 2 s .com*/
    mMaskedPath.setFillType(Path.FillType.INVERSE_WINDING);
}

From source file:com.kmagic.solitaire.DrawMaster.java

/**
 * Draw an empty anchor//from   ww  w . j av a  2 s  .  c  om
 * @param canvas canvas to draw on
 * @param x x coordinate of the anchor
 * @param y y coordinate of the anchor
 * @param done anchor done with any movement
 */
public void drawEmptyAnchor(final Canvas canvas, final float x, final float y, final boolean done) {
    RectF pos = new RectF(x, y, x + Card.WIDTH, y + Card.HEIGHT);
    if (!done) {
        canvas.drawRoundRect(pos, mSuitsSizeHalf, mSuitsSizeHalf, mEmptyAnchorPaint);
    } else {
        canvas.drawRoundRect(pos, mSuitsSizeHalf, mSuitsSizeHalf, mDoneEmptyAnchorPaint);
    }
}

From source file:com.infine.android.devoxx.ui.SessionDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null);
    mTabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost);
    mTabHost.setup();//ww  w.ja  v  a2 s  .  c o  m

    mTitle = (TextView) mRootView.findViewById(R.id.session_title);
    mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle);
    mSponsored = (TextView) mRootView.findViewById(R.id.session_sponsored);
    mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button);

    mStarred.setFocusable(true);
    mStarred.setClickable(true);

    // Larger target triggers star toggle
    final View starParent = mRootView.findViewById(R.id.header_session);
    FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f));

    mSummary = (TextView) mRootView.findViewById(R.id.session_abstract);

    setupSummaryTab();

    return mRootView;
}