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
14
votes
1 answer

bitwise mask vs IN() efficiency in sqlite?

I have two ways to select a set of entries from the database: SELECT ... WHERE `level` IN (1,2,4,8) LIMIT ...; or SELECT ... WHERE `level` & mask LIMIT ...; There are 4 'levels' total, numbered 1,2,4,8 (for reasons of ability to use the same…
SF.
  • 13,549
  • 14
  • 71
  • 107
14
votes
5 answers

Android Mask bitmap on canvas gen a black space

I have a mask bitmap with a half is red color and ones is transparent like this https://www.dropbox.com/s/931ixef6myzusi0/s_2.png I want to use mask bitmap to draw content on canvas only visible in red area, code like this: Paint paint = new…
Thomc
  • 202
  • 1
  • 4
  • 10
13
votes
2 answers

Is mask working differently using inplace?

I've just found out about this strange behaviour of mask, could someone explain this to me? A) [input] df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['A', 'B']) df['C'] ='hi' df.mask(df[['A', 'B']]<3,…
JeB
  • 147
  • 10
13
votes
3 answers

mask a 2D numpy array based on values in one column

Suppose I have the following numpy array: a = [[1, 5, 6], [2, 4, 1], [3, 1, 5]] I want to mask all the rows which have 1 in the first column. That is, I want [[--, --, --], [2, 4, 1], [3, 1, 5]] Is this possible to do using…
Curious2learn
  • 31,692
  • 43
  • 108
  • 125
13
votes
4 answers

Set value of first item in slice in python pandas

So I would like make a slice of a dataframe and then set the value of the first item in that slice without copying the dataframe. For example: df = pandas.DataFrame(numpy.random.rand(3,1)) df[df[0]>0][0] = 0 The slice here is irrelevant and just…
RexFuzzle
  • 1,412
  • 2
  • 17
  • 30
13
votes
2 answers

Masking UIView/UIImageView to cutout transparent text

How can I mask an UIView or UIImageView so that a text is cutout from it? I googled a lot and it seems that many people struggled the same. Most irritating I always tried to invert the alpha of a snapshotted view to get the result. What I want looks…
denbec
  • 1,321
  • 18
  • 25
13
votes
3 answers

Animate circular mask of UIImageView in iOS

I am wondering how to animate the scale of a mask on a uiimageview. Example images attached. The gray boxes are the image background of my uiviewcontroller and is not part of the issue. I assume creation of a uiview subclass that I pass an image, a…
malaki1974
  • 1,605
  • 3
  • 16
  • 32
13
votes
3 answers

How to "zero" everything within a masked part of an image in OpenCV

If I have an image (IplImage 8-bit) and a binary mask (which is also an 8-bit IplImage of the same size, where every pixel has a value of either 0 or 255), how can I make every pixel in the image that corresponds with a pixel in the mask with a…
Jackson Dean Goodwin
  • 617
  • 3
  • 11
  • 20
12
votes
4 answers

Auto-Resize UITableView Headers on Rotate (Mostly on iPad)

I feel like this is going to be a simple answer revolving around AutoResizingMasks, but I can't seem to wrap my head around this topic. I've got an iPad app that shows 2 UITableViews side-by-side. When I rotate from Portrait to Landscape and back,…
mbm29414
  • 11,558
  • 6
  • 56
  • 87
12
votes
1 answer

Applying loadMask() to a single element in extjs?

How to apply loadMask to only one element, and not the whole browser width-height?default here, only one element is masked, and a messageBox is in center, inside this element and not the whole display... any ideas? EDIT: @Molecule , thanks,…
Davor Zubak
  • 4,726
  • 13
  • 59
  • 94
12
votes
1 answer

How can i get ngx-mask masked value?

I'm trying to create simple field for phone number with help of ngx-mask module like this:
Kngh2
  • 387
  • 2
  • 4
  • 10
12
votes
2 answers

How to format a Label to have a Display Format String?

I have a Label: It is bound to a DateTime value. How can i change the label to display the value to this:…
Willem
  • 9,166
  • 17
  • 68
  • 92
12
votes
2 answers

( Autoresizing mask ) flexible width of an image with fixed height

I have been playing around with iPhone interface building using only code and not using IB. Now I'm facing the following problem: How can I set an image to have a width based on the main view it is located on and to let it have a margin of for…
Jasper
  • 175
  • 1
  • 1
  • 7
12
votes
1 answer

OpenCV: How to create a mask in the shape of a polygon?

I have a list of points which are the vertices of a polygon, like this: std::vector polygonPoints; I need to create a mask for the goodFeaturesToTrack function in openCV. For a rectangle, the easiest way to fill the desired area with…
Abs
  • 1,726
  • 2
  • 17
  • 28
12
votes
1 answer

Efficient way to set elements to zero where mask is True on scipy sparse matrix

I have two scipy_sparse_csr_matrix 'a' and scipy_sparse_csr_matrix(boolean) 'mask', and I want to set elements of 'a' to zero where element of mask is True. for example >>>a <3x3 sparse matrix of type '' with 4 stored…
hiroto1228
  • 121
  • 1
  • 4