Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6227073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:09:03+00:00 2026-05-24T09:09:03+00:00

In Java for some reason the Ellipse2D.Double uses the parameters (height, width, x, y)

  • 0

In Java for some reason the Ellipse2D.Double uses the parameters (height, width, x, y) where as when I create a RectF in Android the parameters are (left, top, right, bottom) so I’m a bit confused on adjusting to the differences.

If a create an Ellipse in Java and use the following:

//Ellipse2D.Double(height, width, x, y)

x = 100;
y = 120;
centerX = getWidth() / 2;
centerY = getHeight() / 2;

//Ellipse2D.Double(100, 120, (centerX - 100) * 2, (centerY - 120) * 2);
new Ellipse2D.Double(x, y, (centerX - x) * 2, (centerY - y) * 2);

Would this be equivalent for Android:

//RectF(left, top, right, bottom)

x = 100;
y = 120;
centerX = getWidth() / 2;
centerY = getHeight() / 2;

new RectF((centerX - 100) * 2, (centerY - 120) * 2), 120 - ((centerX - 100) * 2), 100 - ((centerY -120) * 2); 

//canvas.drawOval(myRectF, paint);

I’m not quite sure if they are equivalent, and am wondering if I am calculating it correctly?

Alternatively, can one override the RectF to make it simliar to how Ellipse2D? Ie. change the parameters to work with height and width rather than right and bottom?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:09:04+00:00Added an answer on May 24, 2026 at 9:09 am

    For the override part, I don’t thing it would be a good idea since RectF isn’t only used for ellipses.

    you can easily write a method that draw the Oval by passing the data the way you prefer…

    something like:

    public RectF myOval(float width, float height, float x, float y){
        float halfW = width / 2;
        float halfH = height / 2;
        return new RectF(x - halfW, y - halfH, x + halfW, y + halfH);
    }
    
    canvas.drawOval(myOval(width, height, x, y), paint);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a JavaFX application that uses Java Web Start. For some reason, the
For some reason my eclipse/android development environment has stopped creating the r.java files and
For some reason Eclipse doesn't remember source lookup path for some java projects, and
I have some Java code that uses curly braces in two ways // Curly
For some reason this is locking up the java application. Did I handle the
I am trying to create a menu. And, for some reason I get org.hibernate.exception.GenericJDBCException:
I am running an aggregate function in java through hibernate and for some reason
I'm calling importtsv from within a Java class and for some reason it's not
I have the following shell script. For some reason the java program's standard error
I'm an intermediate java coder, writing a librarian Java app, and for some reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.