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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:01:17+00:00 2026-06-12T00:01:17+00:00

Having a rich UI application in which I want to show image with complex

  • 0

Having a rich UI application in which I want to show image with complex shape like this

enter image description here

Now what I want is to crop my image as per Mask image, Actually image is coming dynamic and can be imported from Camera or Gallery(square or rectangle shape) and I want that image to fit in my layout frame like above

So just wondering that how do I have achieve this? Any idea /hint welcome

Background frame
enter image description here
Mask
enter image description here

Like this

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

    Finally got the solution while changing mask image and using of Xfermode with Bitmap

    Mask

    enter image description here

     ImageView mImageView= (ImageView)findViewById(R.id.imageview_id);
     Bitmap original = BitmapFactory.decodeResource(getResources(),R.drawable.content_image);
     Bitmap mask = BitmapFactory.decodeResource(getResources(),R.drawable.mask);
     Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Config.ARGB_8888);
     Canvas mCanvas = new Canvas(result);
     Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
     paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
     mCanvas.drawBitmap(original, 0, 0, null);
     mCanvas.drawBitmap(mask, 0, 0, paint);
     paint.setXfermode(null);
     mImageView.setImageBitmap(result);
     mImageView.setScaleType(ScaleType.CENTER);
     mImageView.setBackgroundResource(R.drawable.background_frame);
    

    see output

    enter image description here

    Source can be found here

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

Sidebar

Related Questions

I'm working with Vaadin, a GWT like framework for developing rich web applications. Now
I am currently having problems with attempting to style the HTML rich text editor
I'm having some trouble doing a very simple task. I have a rich textbox
Having used storyboards for a while now I have found them extremely useful however,
Having just added a new button in my web application, I get an error
One of our products uses a Javascript Rich text editor, which has the ability
I'm building a Zend-based Web app that will permit third-party extensions. Essentially, this application's
So I have been battling this issue for awhile now and tried many different
I am currently having issues redirecting both STDError and STDOutput. What I want to
An interesting thread came up when I typed in this question just now. I

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.