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 4553842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:00:16+00:00 2026-05-21T17:00:16+00:00

How can I reliably determine the exact extent of a rectangle when it is

  • 0

How can I reliably determine the exact extent of a rectangle when it is rendered using Graphics2D?

Suppose I have a rectangle that originates at (20,40) and is 200 pixels wide and 100 pixels tall:

drawRect (20,40,200,100);

The answer to my question is easy when this is a simple rectangle, drawn crudely with a 1-pixel pen. However, what are the exact bounds that are affected in the rendering process when the pen is 2 pixels, 3 pixels, or more? And will the rectangle “spill over” to adjacent pixels when anti-aliasing is used?

What is the most reliable way to calculate the exact bounds that will be manipulated?

  • 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-21T17:00:17+00:00Added an answer on May 21, 2026 at 5:00 pm

    If you need to know the bounds of a stroked shape, you can stroke it yourself and check the bounds.

    Graphics2D g;
    g.getStroke().createStrokedShape(myRect).getBounds();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have an example of script that can work reliably well across IE/Firefox
I have my users DOB as a string (don't ask), how can I reliably
I am using NXP LPC17xx family microcontrollers (LPC1759 and LPC1768). How can I determine
How can I determine the type of file system that is used by a
I have a simple Rails 3.1.rc6 app that I'm using to try to test
I have a regex that, according to what I can tell and to what
How can you reliably and dynamically load a JavaScript file? This will can be
This is basic stuff but I can't get this following form to process reliably.
I can't seem to get a reliable timestamp using winapi functions. For example: int
I have a web form that needs to act differently if the request to

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.