mask

CAShapeLayer filling with another CAShapeLayer as a mask

女生的网名这么多〃 提交于 2019-12-03 22:28:50
My question is about filling animation one CAShapeLayer with another CAShapeLayer . So, I wrote some code that almost achieves my goal. I created a based layer and fill it with another. Code below: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _shapeLayer = [CAShapeLayer layer]; [self drawBackgroundLayer]; } // my main/backgound layer - (void)drawBackgroundLayer { _shapeLayer.frame = CGRectMake(0, 0, 250, 250); _shapeLayer.lineWidth = 3; _shapeLayer.strokeColor = [UIColor blackColor].CGColor; _shapeLayer.fillColor = UIColor

Actionscript3 alpha masking?

送分小仙女□ 提交于 2019-12-03 22:10:46
问题 I was trying to apply a spotlight effect on a google map application. Specifically, I draw a circle that follows the mouse and set it as a mask over the map. The problem is only the map area within the circle shows up, I know it's what mask is supposed to look like, but is there a way to make the area outside the circle some kind of semi-transparent so that the map under it can also see through? That way people can still see the rest of the map when they navigate just the area within the

CGPath from image

僤鯓⒐⒋嵵緔 提交于 2019-12-03 21:51:41
I need to create mask based on image (any possible shape). I need to: Create CALayer with CGPath as a proper mask Call [UIView.layer setMask: with layer above ] So main big question is how to set CGPath based on black-white image? Or is it possible to place mask directly from image? Thanks! Example image of a mask: You will need to create your image with an alpha channel. According to CALayer 's mask property documentation: 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

Reposition/resize UIBezierPath

对着背影说爱祢 提交于 2019-12-03 17:50:42
问题 I have a draggable view that has a mask layer on it. The mask layer has a UIBezierPath on it which makes an area on the view see-through/transparent(the effect that i want). My end goal is to change the position and size of the path(not the mask layer!) by passing a CGRect that is calculated based on the intersection of my view and another rectangle(Basically I want to hide the area that intersects). 1)How I create my mask and path(creates a see-through rectangle on my view): self.maskLayer =

How to draw CALayer border around its mask?

自闭症网瘾萝莉.ら 提交于 2019-12-03 16:23:13
问题 So, I have a CALayer , which has a mask & I want to add border around this layer's mask. For example, I have set triangle mask to the layer and I want to have border around that layer. Can anyone please help me to solve this problem? 回答1: Swift 4 class CustomView: UIView { override func draw(_ rect: CGRect) { super.draw(rect) self.backgroundColor = UIColor.black //setup path for mask and border let halfHeight = self.bounds.height * 0.5 let maskPath = UIBezierPath(roundedRect: self.bounds,

Swift Progress Indicator Image Mask

不想你离开。 提交于 2019-12-03 14:41:33
To start, this project has been built using Swift. I want to create a custom progress indicator that "fills up" as the script runs. The script will call a JSON feed that is pulled from the remote server. To better visualize what I'm after, I made this: My guess would be to have two PNG images; one white and one red, and then simply do some masking based on the progress amount. Any thoughts on this? Masking is probably overkill for this. Just redraw the image each time. When you do, you draw the red rectangle to fill the lower half of the drawing, to whatever height you want it; then you draw

Win Forms text box masks

笑着哭i 提交于 2019-12-03 14:27:55
How can I put mask on win form text box so that it allows only numbers? And how it works for another masks data, phone zip etc. I am using Visual Studio 2008 C# Thanks. Do you want to prevent input that isn't allowed or validate the input before it is possible to proceed? The former could confuse users when they press keys but nothing happens. It is usually better to show their keypresses but display a warning that the input is currently invalid. It's probably also quite complicated to set up for masking an email-address regular expression for example. Look at ErrorProvider to allow the user

Is there an inverse to the CSS “Clip” property; hide the clipped area?

孤人 提交于 2019-12-03 11:27:41
The CSS clip syntax gets you to define a rectangular area of a larger image that you wish to be visible. Is there a way to specify the inverse? Specify the rectangular area of the image that you wish to become invisible. Like punching a rectangular hole through the page to see what's underneath? Reason (if you have any other ideas): I want to create a 3 layer image in a CMS template. Layer 1 (at the bottom) is a background image. Layer 2 sits over a portion of layer 1 and is a rectangular screengrab image of an A4 document. Layer 3 (on the top) is a transparent PNG (in its centre and at its

How to draw CALayer border around its mask?

不想你离开。 提交于 2019-12-03 11:02:05
So, I have a CALayer , which has a mask & I want to add border around this layer's mask. For example, I have set triangle mask to the layer and I want to have border around that layer. Can anyone please help me to solve this problem? Swift 4 class CustomView: UIView { override func draw(_ rect: CGRect) { super.draw(rect) self.backgroundColor = UIColor.black //setup path for mask and border let halfHeight = self.bounds.height * 0.5 let maskPath = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: [.topLeft, .bottomRight], cornerRadii: CGSize(width: halfHeight, height: halfHeight)) /

How can I colorize a black/white UIImageView programmatically?

陌路散爱 提交于 2019-12-03 08:35:11
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 another solution. I tried overlaying a UIView with alpha 0.4 and setting it's background color to red, here