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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:14:10+00:00 2026-05-22T12:14:10+00:00

I have a bitmap that sets two variables centreX, centreY through the onTouchEvent() method.

  • 0

I have a bitmap that sets two variables centreX, centreY through the onTouchEvent() method. From these x,y co-ordinates i draw a circle over the bitmap and can change the circle’s pixels to different rgb values through a slideBar. I target the circle’s inner pixels with an algorithm but unfortunately as it stands i have to search the entire bitmap pixel by pixel to target the circle’s pixels. this has a massive method call overhead that i’d like to reduce.

What i’m thinking of doing is creating a bounding box around the circle so my algorithm has less space to search, so will speed things up hopefully. How can i create a rectangle arounf the circle using the circle’s x,y centre co-ords and a radius of 50?

Thanks matt.

public void findCirclePixels(){ 


        for (int i=0; i < bgr.getWidth(); ++i) {
            for (int y=0; y < bgr.getHeight(); ++y) {

    if( Math.sqrt( Math.pow(i - centreX, 2) + ( Math.pow(y - centreY, 2) ) ) <= radius ){

                    bgr.setPixel(i,y,Color.rgb(Progress+50,Progress,Progress+100));
                }
            }
        }   

        }// end of changePixel()
  • 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-22T12:14:11+00:00Added an answer on May 22, 2026 at 12:14 pm

    Change your outer loop limits from circle.x – radius to circle.x + radius, and your inner loop limits from circle.y – radius to circle.y + radius. You may, depending on what your x and y can be, need to check if any of those values are less than 0 or greater than the limits of your images width or height.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that I call and it returns bitmap data from a
I have a bitmap object and draw some curves on it by setpixel method.
I have a bitmap that I load from the SD card by allowing the
I have a Bitmap that I want to enlarge programatically to ~1.5x or 2x
I have a chart (in bitmap format) that I'm trying to render to a
I have a PNG image that has an unsupported bitmap graphics context pixel format.
I have a large bitmap that i would like to keep in memory when
i have two bitmap images ..and i need to merge the bitmaps with precise
i have create an imagelist with 20 bitmap inside and a dropdownlist value from
I have an application that receives information from a database, and is used 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.