Questions tagged [mask]

An image mask is a bitmap that specifies an area to paint, but not the color. In effect, an image mask acts as a stencil to specify where to place color on the page. Quartz uses the current fill color to paint an image mask.

A mask is a format expression mainly used in formatting user input in forms.

Common examples of this are date input fields that accepts only numbers and format the typed input with the needed characters:

User enters      Field contents
1                1
12               12
123              12/3
1231             12/31
...              ...
12312012         12/31/2012
2841 questions
12
votes
1 answer

Invert CALayer mask that is based on a stroke (no fill)

Dear stack overflow community, I have a problem concerning the mask property of a CAShapeLayer in iOS (Swift). What I am trying to achieve is an eraser that erases parts of a image-layer by masking it. The problem comes in, when I try to invert…
Lars Petersen
  • 602
  • 9
  • 21
12
votes
1 answer

UIView Layer Mask Animate

I am trying to animate the mask layer on a UIView. Basically this code displays the image below: let bounds: CGRect = self.manualWBMaskView!.bounds let maskLayer: CAShapeLayer = CAShapeLayer() maskLayer.frame = bounds maskLayer.fillColor =…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
12
votes
3 answers

Add blur mask on top and bottom of the screen in Objective-C

I need to add mask on top and buttom of the screen like this. How can I achieve this ?
SandeepM
  • 2,601
  • 1
  • 22
  • 32
12
votes
4 answers

masking a UIImage

I'm working on an app that can change the borders or a rectangular UIImage. The borders will vary, but will look like the UIImage was cut out with scissors, or something to that affect. What is the best way to do this? My first thought is to prep a…
Steven Baughman
  • 1,076
  • 2
  • 13
  • 22
12
votes
2 answers

Android - Creating a circular mask on video

I'm relatively new to Android development, and I was wondering if it's possible to mask a VideoView into a shape. This is what I have so far: Expected Result My XML for video view and layout:
jamesbar
  • 147
  • 1
  • 2
  • 11
12
votes
4 answers

How to apply inverse text mask with CSS

I'll try to explain my question with images. Here we go. 1 - This image shows the text masking an image, so far so good, I can do with the following code: font-size: 120px; background: url(image-to-be-masked.jpg) repeat 0 0,…
12
votes
2 answers

Mask does not work when capturing a uiview to a uiimage

I have a UIView which I want to save as a UIImage. I do this using UIGraphicsBeginImageContext, and it works OK. But when I apply mask to the images in the (view/layer.mask), the image that I capture through UIGraphicsBeginImageContext is wrong (the…
12
votes
4 answers

Precise OpacityMask

Suppose I need to set an opacity mask on a WPF control that highlights a portion of it in precise position (suppose a 50x50 square at (50;50) position). To do that I create a DrawingGroup containing 2 GeometryDrawing objects: 1 semi-transparent…
Alan Mendelevich
  • 3,591
  • 4
  • 32
  • 50
11
votes
4 answers

Optional character in input mask

How do I specify an optional character in an input mask? I found this masked input plugin http://digitalbush.com/projects/masked-input-plugin/ and these mask definitions. $.mask.definitions['g']="[…
user823527
  • 3,644
  • 17
  • 66
  • 110
11
votes
1 answer

How to mask numpy structured array on multiple columns?

I have a numpy structured array with a dtype such as: A = numpy.empty(10, dtype=([('segment', '
jlconlin
  • 14,206
  • 22
  • 72
  • 105
11
votes
3 answers

Mask rectangle with a text in SwiftUI

I want to achieve following using SwiftUI: This is what I have tried: Text("test").mask(Rectangle().frame(width: 200, height: 100).foregroundColor(.white)) Also the other way around: Rectangle().frame(width: 200, height:…
ph1psG
  • 568
  • 5
  • 24
11
votes
1 answer

Extracting boundary of a numpy array

Let A be a numpy array representing a mask. I would like to extract the boundary corresponding to this mask i.e, make everything zero except for the boundary. eg: In [22]: A array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0,…
user5806421
11
votes
2 answers

Translate Python function to apply mask to image into Java

I'm trying to translate the following Python function, that applies a mask to an image, into Java: # Applies an image mask. def region_of_interest(img, vertices): #defining a blank mask to start with mask = np.zeros_like(img) …
zugaldia
  • 702
  • 3
  • 8
11
votes
1 answer

How do I use rasterio/python to mask a raster using a shapefile, to set the raster pixels inside the polygons to zero?

I am trying to create a land mask to apply to satellite imagery, that will set the pixels in a raster intersecting with a land mass to 0. After experimenting with gdal, skimage, pyplot etc. I've found the method given in the rasterio cookbook to be…
Cate
  • 431
  • 1
  • 7
  • 22
11
votes
2 answers

What do I need for masking a UIImageView and how do I do it in Swift 3?

I was wondering what I would need if I wanted to use a mask image to get my UIImageView in a specific shape. From what I understand, to create a mask, I need to have an image with the shape of the mask all black on top of a white background.…
Freddy Benson
  • 735
  • 4
  • 11
  • 30