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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:51:24+00:00 2026-05-26T14:51:24+00:00

I have an isometric map which I draw to the canvas. When I try

  • 0

I have an isometric map which I draw to the canvas. When I try and move the map around, these black lines flicker in between some of the tiles making the whole thing look rather shoddy.

Here is the relevant code from my updating thread

public void run() {
    Canvas c;
    while (isRunning){
        c = null;
        try {
            c = cellMap.getHolder().lockCanvas(null);
            synchronized (cellMap.getHolder()) {
                cellMap.onDraw(c);
            }
        } finally {
            if( c != null){
                cellMap.getHolder().unlockCanvasAndPost(c);
            }
        }
    }
}

and from my CellMap class (which extends SurfaceView):

    public void onDraw(Canvas canvas){
    canvas.drawColor(Color.BLACK);
    int x = 0;
    int y = 0;

    for(int i = 0; i < mapSize; i++){
        for(int j = 0; j < mapSize; j++){
            x = (i-j) * 30 + xOffset;
            y = (i+j) * 15 + yOffset;
            mapCells[i][j].draw(canvas, paint, x, y);
        }
    }

mapCells[][] is an array of objects which contain the Bitmap image that needs to be drawn. The draw() function is only 1 line canvas.drawBitmap(bitmapImage, x, y, null)

I have discovered that removing the line Canvas.draw(Color.black) gets rid of the flicker. However, when I move the map the canvas is not cleared so I still see the image from the previous frames. I’d imagine it is because it is taking too long to draw the bitmaps? but the map is only very small at the moment.

  • 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-26T14:51:25+00:00Added an answer on May 26, 2026 at 2:51 pm

    I found the problem. When moving the map, the offset values were being changed. This lead to sections of the map being drawn temporarily with different offset values – creating the tearing. duh!

    I solved this by copying the xOffset and yOffset values at the start of the onDraw() method, and using those values for the update.

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

Sidebar

Related Questions

Yo everyone! I have been working on an Isometric Tile Game Engine in HTML5/Canvas
Is there a simple way to have isometric projection? I mean the true isometric
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I really have an issue with mouseclicks in an isometric view. Simply i have
I have a singleton object called PoolManager that loads and saves some data in
I'm building an isometric map like the one done by Christian Weber . I've
I am trying to do a isometric map for a game on Java, but
Say you've got a tile image that you use to build an isometric map.
Why oh why is this so slow? I have made an isometric grid of
Have jUnit test, which initializes my bean: ShowProducts sp = new ShowProducts(); got NullPointerException

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.