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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:41:58+00:00 2026-05-26T11:41:58+00:00

I develop tile based game to draw i use function canvas.drawBitmap() in each frame

  • 0

I develop tile based game to draw i use function canvas.drawBitmap() in each frame function drawBitmap using 400+ times when i use scroll (Gestures) performance is pretty bad.

Can anyone give me advice how to increase performance to make smooth animation.

public class DiamondIsometric implements Render{
    private int MapWidth;
    private int MapHeight;
    private Bitmap _surface;
    private Bitmap tempBitmap; 
    public DiamondIsometric(int MapWidth,int MapHeight,Bitmap _surface)
    {
        this.MapWidth=MapWidth;
        this.MapHeight=MapHeight;
        this._surface = _surface;
    }
    public MapObject[][] BuildMap()
    {
        int rx;
        int ry;
        MapObject[][] MapObjects = new MapObject[MapWidth][MapHeight];
        for(int x=0;x<MapHeight;x++)
            for(int y=0;y<MapWidth;y++)
            {
                rx=(x-y)*_surface.getWidth()/2;
                ry=(x+y)*_surface.getHeight()/2;
                MapObject temp = new MapObject(new Point(rx,ry),_surface);              
                MapObjects[x][y]=temp;              
            }
        return MapObjects;      
    }

    @Override
    public void Render(Canvas canvas) {     
    }
    @Override
    public void Render(Canvas canvas,MapObject[][] MapObjects)
    {
        Paint temp = new Paint();
        temp.setColor(Color.BLACK);
        canvas.drawPaint(temp);
        Bitmap toDraw = Bitmap.createBitmap(MapWidth*_surface.getWidth(), MapHeight*_surface.getHeight(), Config.RGB_565);
        int bitmapOffsetX,bitmapOffsetY;
        canvas.drawBitmap(this.Render2(canvas,MapObjects),0,0,null);

    }
    public Bitmap Render2(Canvas canvas, MapObject[][] MapObjects)
    {
        Paint temp = new Paint();
        temp.setColor(Color.BLACK); 
        tempBitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.RGB_565);
        Canvas wideBMPCanvas = new Canvas(tempBitmap);
        int bitmapOffsetX,bitmapOffsetY;
        for(int i=0;i<MapObjects.length;i++)
            for(int j=0;j<MapObjects[i].length;j++)
            {
                bitmapOffsetX=(IsometricView.globalAnchor.x % MapObjects[i][j]._bitmap.getWidth());
                bitmapOffsetY=(IsometricView.globalAnchor.y % MapObjects[i][j]._bitmap.getHeight());
                wideBMPCanvas.drawBitmap(MapObjects[i][j]._bitmap,MapObjects[i][j].coords.x-IsometricView.globalAnchor.x ,MapObjects[i][j].coords.y-IsometricView.globalAnchor.y , null);

            }
        return tempBitmap;
    }

}
  • 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-26T11:41:59+00:00Added an answer on May 26, 2026 at 11:41 am

    Use a game engine like andEngine or libgdx. They use OpenGL rendering which is usually much faster.

    Update: If you want not to use OpenGL/game engines you should try to combine tiles into a larger bitmap. Create a larger bitmap and create a new canvas (new Canvas(largeBitmap)) to draw the tile to it. Drawing one larger is faster than drawing multiple smaller ones. For my Game K’UMPA I used a similar approach, which is more complex in detail, because only a small part of the map is visible on the screen.

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

Sidebar

Related Questions

I develop Rails based website, enjoying using partials for some common components Recently, i
I develop a Webservice using Netbeans 6.9 and I use an embedded glassfish server
I am attempting to develop a game with canvas element. Right now, I am
I'm trying to develop an Android 2D game using OpenGL ES that uses a
I develop an application using the Play! Framework which makes heavy use of the
I develop a number of desktop Java applications using Swing, and while Swing is
I develop websites using PHP and MySQL. What resources would a seasoned web developer
I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity
I develop for clients who are still using Excel 2003 on Windows XP systems.
I develop using MAMP pro on my Mac. When I start MAMP it prompts

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.