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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:34:02+00:00 2026-06-15T00:34:02+00:00

I have a Canvas and a Bitmap .I have to draw bitmap twice on

  • 0

I have a Canvas and a Bitmap.I have to draw bitmap twice on canvas and rotate them.This is my code:

Bitmap bitmap = ... ;
Matrix matrix = new Matrix();
Camera camera = new Camera();
camera.save();

// First drawing:
camera.rotateX(x_rotate_angle);
camera.rotateY(y_rotate_angle);
camera.getMatrix(matrix);
matrix.postTranslate(0, 0);
matrix.postScale(3, 3);
canvas.drawBitmap(bitmap, matrix, null);
camera.restore();

// Second drawing:
camera.rotateX(x_rotate_angle);
camera.rotateY(y_rotate_angle);
camera.getMatrix(matrix);
matrix.postTranslate(10, 10 + bitmap.getHeight());
matrix.postScale(3, 3);
canvas.drawBitmap(bitmap, matrix, null);

Result before rotation:

enter image description here

When bitmaps rotate only axis X,all things are fine.In this case result looks like this:

enter image description here

In both above images you can see that all edges are parallel.But when bitmaps rotate axis Y,edges will not be parallel(bottom edge of top bitmap crosses top edge of bottom bitmap):

enter image description here

Did I do any thing wrong?

  • 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-15T00:34:03+00:00Added an answer on June 15, 2026 at 12:34 am

    You’re not doing anything wrong, it’s just that you haven’t understood the results you were going to get from your code. The camera you’re using is a 3D camera and you’re seeing the results of moving the camera in 3D space. When you rotate a camera, parallel lines do not in general remain parallel. You noticed the artifact when rotating about the y-axis, but it’s also present in your illustration for the x-axis rotation. Notice that for the x-axis, the left and right sides are not parallel; the left side is closer to vertical than the right.

    The Android canvas object has scale, skew, translate, and rotate operations. If it’s 2D operations that you need, you can ditch the camera object entirely.

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

Sidebar

Related Questions

I have a Canvas I draw on, I'm trying to take the bitmap out,
I am currently drawing a Bitmap to a SurfaceView using Canvas.drawBitmap() . This seems
I have to draw a String on a transparent bitmap at first, then draw
I have created a canvas and draw a bitmap on it, and animate it
I have a Canvas that i draw text on. (this is quite advanced i
I have a canvas-based drawing app that when zoomed in, I draw a miniature
I am drawing bitmaps on the canvas using bitmap factory(see P.S.). I also have
I have a android.graphics.Bitmap object that I draw on my canvas, what I am
Possible Duplicate: Android: How to overlay-a-bitmap/draw-over a bitmap? I have implement the android Camera
I have a bitmap and I draw it like this : bit = BitmapFactory.decodeResource(getResources(),

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.