mask

kineticjs - mask/contain images so no overlap

吃可爱长大的小学妹 提交于 2019-12-23 03:00:25
问题 i have 2 images on my stage underneath an overlay image of 2 frames. The user can drag each image as if they were positioninng each image inside a photo frame. The problem i have is the yoda image in this example can overlap and appear inside the darth vader frame on the left (and vice-versa), as shown here: jsfiddle here: http://jsfiddle.net/vTLkn/ Is there a way of placing the images inside some form of container or rectangle to stop this so they cannot appear inside another 'frame'? The

How to mask out a simple region when painting in Android?

我的梦境 提交于 2019-12-22 08:14:42
问题 Here is a simplified description: Imagine that I'm given a View class that draws a picture of a wall and I want to draw it with a window cut out. Assume that I extend that View class and override its dispatchDraw() method to do the following. First draw the background if any to be seen through the window. Next I want to mask out the rectangular window region somehow and then call super.dispatchDraw(). Finally I want to remove the mask and draw a person standing at the window so that they are

Mask a 3d array with a 2d mask in numpy

你离开我真会死。 提交于 2019-12-22 03:55:11
问题 I have a 3-dimensional array that I want to mask using a 2-dimensional array that has the same dimensions as the two rightmost of the 3-dimensional array. Is there a way to do this without writing the following loop? import numpy as np nx = 2 nt = 4 field3d = np.random.rand(nt, nx, nx) field2d = np.random.rand(nx, nx) field3d_mask = np.zeros(field3d.shape, dtype=bool) for t in range(nt): field3d_mask[t,:,:] = field2d > 0.3 field3d = np.ma.array(field3d, mask=field3d_mask) print field2d print

Mask specific columns of a numpy array

只愿长相守 提交于 2019-12-21 14:58:43
问题 I have a 2D numpy array A of (60,1000) dimensions. Say, I have a variable idx=array([3,72,403, 512, 698]) . Now, I want to mask all the elements in the columns specified in idx . The values in these columns might appear in other columns but they shouldn't be masked. Any help would be appriciated. 回答1: In [22]: A = np.random.rand(5, 10) In [23]: idx = np.array([1, 3, 5]) In [24]: m = np.zeros_like(A) In [25]: m[:,idx] = 1 In [26]: Am = np.ma.masked_array(A, m) In [27]: Am Out[27]: masked_array

Reverse a CALayer mask

…衆ロ難τιáo~ 提交于 2019-12-21 12:08:07
问题 I am trying to use a CALayer with an image as contents for masking a UIView. For the mask I have complex png image. If I apply the image as a view.layer.mask I get the opposite behaviour of what I want. Is there a way to reverse the CAlayer? Here is my code: layerMask = CALayer() guard let layerMask = layerMask else { return } layerMask.contents = #imageLiteral(resourceName: "mask").cgImage view.layer.mask = layerMask // What I would like to to is view.layer.mask = layerMask.inverse. // <---

Mask image with a triangle at the bottom

北城以北 提交于 2019-12-21 05:47:15
问题 I'm trying to figure out how to best mask a div with an angular shape like so--if the top div in this case will be a background image, and both divs would be 100% width: I've seen lots of tutorials out there on how to mask an image with a circle shape, but none on how you would mask the border of a div like the red area. I know there must be a better way than doing this with bitmaps, but am at a loss. Would it be best to do this with clip-path or SVG? I'm not all that concerned about older

How can I colorize a black/white UIImageView programmatically?

十年热恋 提交于 2019-12-21 02:44:09
问题 I have a set of black and white images, like below. If I remember correctly, there's some way to set the blending or masking property of a UIImage to blend it with the background UIView. In this case, I want to change the color of this image to red to signify hit points. How can I programmatically change the color of this UIImage? I know about the use of image filters, in particular hue shift, but they are really resource intensive, plus they don't work on white image, so I'm looking for

How can I colorize a black/white UIImageView programmatically?

两盒软妹~` 提交于 2019-12-21 02:44:07
问题 I have a set of black and white images, like below. If I remember correctly, there's some way to set the blending or masking property of a UIImage to blend it with the background UIView. In this case, I want to change the color of this image to red to signify hit points. How can I programmatically change the color of this UIImage? I know about the use of image filters, in particular hue shift, but they are really resource intensive, plus they don't work on white image, so I'm looking for

how to color mask in c

喜夏-厌秋 提交于 2019-12-20 06:11:03
问题 how do you color mask a 32 bit unsigned integer for the red, green, and blue values is it like this? (color_to_be_masked>>8) 回答1: This should get you the result you want: short red = (color >> 16) & 0xFF; short green = (color >> 8) & 0xFF; short blue = (color) & 0xFF; 回答2: "It depends", namely on which bits are which color. Often they're mapped "backwards", so that Red is in the lower-most bits, green in the "middle", and blue on top (sometimes followed by alpha, if that is being used).

CAShapeLayer mask view

纵然是瞬间 提交于 2019-12-20 04:30:10
问题 I have one problem. I look for the answers on the net and I don't understand why is not working. I must do some stupid mistake which I can't figure it out. if I make : - (void)viewDidLoad { [super viewDidLoad]; UIView * view = [[UIView alloc]initWithFrame:CGRectMake(10, 10, 300, 400)]; view.backgroundColor = [UIColor blueColor]; [self.view addSubview:view]; } it create blue view on the screen, but if I make - (void)viewDidLoad { [super viewDidLoad]; UIView * view = [[UIView alloc