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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:51:04+00:00 2026-06-13T19:51:04+00:00

I know this a stupid question to ask, but I was going through a

  • 0

I know this a stupid question to ask, but I was going through a tutorial and I just dont seem to understand the below lines of code…Have pulled my hair understanding the geometrical algorithm behind this, but…..Oh!!! This is very simple but I just dont seem to get it. Please help….I am a beginner…

  private void drawPict(Canvas canvas, int x, int y, int w, int h,
                              float sx, float sy) {
            canvas.save();
            canvas.translate(x, y);
            canvas.clipRect(0, 0, w, h);
            canvas.scale(0.5f, 0.5f);
            canvas.scale(sx, sy, w, h);
            canvas.drawPicture(mPicture);
            canvas.restore();
        }
        @SuppressWarnings("unused")
            @Override
        protected void dispatchDraw(Canvas canvas) {
            super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
            mPicture.endRecording();
            int x = getWidth()/2;
            int y = getHeight()/2;
            if (false) {
                canvas.drawPicture(mPicture);
            } else {
                drawPict(canvas, 0, 0, x, y,  1,  1);
                drawPict(canvas, x, 0, x, y, -1,  1);
                drawPict(canvas, 0, y, x, y,  1, -1);
                drawPict(canvas, x, y, x, y, -1, -1);
            }
        }

I have looked into this again…and understand that canvas.scale has 4 parameters, being the co-ordinates of the points I assume…but I cannot still understand the float sx, float sy…

sx=-1 and sy=1…it will scale, agreed…but is not there a better way?

  • 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-13T19:51:06+00:00Added an answer on June 13, 2026 at 7:51 pm

    Scaling by a factor of +1 gives an identity transformation along an axis, and scaling by a factor of -1 gives a reflection across an axis. In the present example, you have each of the four possible combinations of reflection/no-reflection across each of the axes. Scaling both coordinates by +1 is the identity transformation. Scaling x-coordinates by -1 and y-coordinates by +1 gives a reflection across a vertical line, that is, a left-right reflection. Vice-versa for scaling x by +1 and y by -1, which is an up-down reflection. Scaling both coordinates by -1 gives a double reflection, which is identical to a rotation by 180 degrees.

    The Canvas class does not have a separate call for reflections, so scaling is used instead.

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

Sidebar

Related Questions

This may be a stupid question to ask, but still I need to know
I know this is a stupid question. But just out of curiosity, is there
I know this maybe a stupid question but maybe I'm just confused with the
I know this may be a stupid question to ask but I have really
This might be a stupid question but i failed to do through tutorial found
I know this is a very stupid question to ask but i have a
I know this may be a stupid question to ask but I want to
I know this will look like a stupid simple question to ask but I
I know this is a stupid question, but I just can't find where I
i know this is a stupid question but i d'ont know how to do

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.