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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:36:57+00:00 2026-05-31T11:36:57+00:00

The problem that I am facing is simple (and less abstract than the question

  • 0

The problem that I am facing is simple (and less abstract than the question itself). I am looking for a solution to highlight an area of an image (the selection) while the rest of the image is faded or grayed out. You can compare the effect with the interface you see in, for example, Photoshop when you crop an image. The image is grayed out and the the area that will be cropped is clear.

My initial idea was to use masking for this (hence the question), but I am not sure if this is a viable approach and, if it is, how to proceed.

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

    Not sure if this is the best way, but it should work.

    First, you create a screenshot of the view.

    UIGraphicsBeginImageContextWithOptions(captureView.bounds.size, view.opaque, 0.0);
    [captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

    This snippet is ‘stolen’ and slightly modified from here:
    Low quality of capture view context on iPad

    Then you could create a grayscale mask image of same dimensions as the original (screenshot).

    Follow the clear & simple instructions on How to Mask an Image.

    Then you create UIImageView, set the masked image as it’s image and add it on top of your original view. You also might want to set the backgroundColor of this UIImageView to your liking.

    EDIT:

    A simpler way would probably be using view.layer.mask, which is “an optional layer whose alpha channel is used as a mask to select between the layer’s background and the result of compositing the layer’s contents with its filtered background.” (from CALayer class reference)

    Some literature:

    UIView Class Reference

    CALayer Class Reference

    And a simple example how mask can be made with (possibly hidden) another UIView:

    Masking a UIView

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

Sidebar

Related Questions

I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map
I am facing the problem that I cannot properly map my foreign key table
I'm working with Eclipse and ClearCase and we're facing the problem that there's no
I'm facing a problem while unit testing my forms. The problem is that data
That was helpful kgiannakakis. I'm facing a problem as below: a = ['zbc','2.3'] for
I am new to Python and Numpy, and I am facing a problem, that
One problem that I come across regularly and yet don't have a solution to
I have a terrible problem that hopefully has a very simple answer. I am
I'm facing a simple problem I would like to get a local path from
I'm facing a wordpress / htaccess problem. This should be really simple, but it's

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.