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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:08:15+00:00 2026-06-10T10:08:15+00:00

I am making an app that mimic a classic game. Therefore I need to

  • 0

I am making an app that mimic a classic game. Therefore I need to render some pixel art.

I have a 100×100 Bitmap as a buffer and I draw everything on the buffer without any difficulties.

When I try to render it on a 480×480 Canvas, here comes the problem.

Bitmap.createScaledBitmap will give me a blurred bitmap, so I use the following code for a clear cut between “blocks (scaled up pixels)”.

float scale = getWidth() / 100f;
for(int y = 0 ; y < getHeight() ; y++){
    for(int x = 0 ; x < getWidth() ; x++){
        buffer2.setPixel(x, y, buffer.getPixel((int)(x / scale), (int)(y / scale)));
    }
}

The code works quite well and did exactly what I want. But the performance is pretty bad(takes 300+ ms). So I am writing to ask if there is a better way out. Thank you.

  • 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-06-10T10:08:17+00:00Added an answer on June 10, 2026 at 10:08 am

    I would do a few things:

    1. Break your getHeight() and getWidth() into local variables so that it isn’t called every iteration of the loop. (e.g. int height = getHeight(); for(int y = 0; y < height; y++);)

    2. Use an intermediate array to store the pixels, then when the loop has completed, use setPixels() method instead of setPixel() to set the pixels all at once — it is significantly more efficient than setting the pixels one at a time.

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

Sidebar

Related Questions

I'm making an App that will have multiple, identical, objects and I need to
I am currently making an app that will have multiple timers, which are basically
I'm making an app that's based on question and answers, and the answers have
I am making an app that will have images. When the user hits the
I'm making an app that does some real time image processing using the camera.
i am making an app that will have a very large dictionary of words
i'm making app that the main page include TableView but i want when i
I am making app that takes a screenshot of a URL requested by the
Im making an app that should let the user see video from the camera
I am making an app that records a destination (a city, state, country, town,

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.