UIImage with Gradient iOS - ios

Is it possible apply a gradient like this for iOS?
The gradient is applied to the image and it should lose focus. I can get the result for the background with CAGradientLayer but the image always has the same focus.

Maybe you can find useful applying some technics for image resizing in order to achieve the focus you want.
http://nshipster.com/image-resizing/

Related

How do you create a 'blurred text' image effect in iOS?

I want to create a text shaped blur effect to an image as shown below:
Another example:
I have found an answer on blurring a UILabel answer: How to blur UILabel text.
But the effect is not correct.
So, How can I create a blurred text image effect that I can render into an image as a watermark in Swift?
Somebody help me! Thanks very much!
By the way, the answers about UIVisualEffectView is not correct.
The effect using UIVisualEffectView is like:
Besides, I also want to apply this kind of blur effect into photo's watermark.
So, any help?
You're going to need a two stage approach to get the desired effect:
Generate a black and white image of the text (black background, white text). The standard string in Swift has a Draw method. There's another Answer that has more detail on this.
Pass this 'text' image and your source image into the CIMaskedVariableBlur filter from CoreImage.
Basically, your 'text' image will act as the mask for the blur filter. Where the mask is lighter, the blur is stronger, and where the mask is black, no blur is applied.

Mask/crop an image

What is the best approach to display a cropped/masked image in Flutter?
Lets say I have one image with a mask (eg. an irregular star shape with transparent background) and the other image which I want to mask with this star, so that only the part inside the star of original image would be rendered.
I'm aiming for something like PorterDuffXfermode on Android (similar question here - Android how to apply mask on ImageView?).
In case of simple mask shapes is going the RenderClipOval way a good approach?
I would just paint it using a CustomPainter, setting the Paint.BlendMode on the Paint you pass to the method when you paint the image.
See https://docs.flutter.io/flutter/dart-ui/Canvas/drawImageRect.html and https://docs.flutter.io/flutter/dart-ui/Paint/blendMode.html and https://docs.flutter.io/flutter/widgets/CustomPaint-class.html.

Objective-c how to create lens flare effect in iOS

I would like to create the same effect that you can see on the picture attached.
I would like to have that kind of effect over my barcode scanner, which scan barcode with phone camera.
Any idea how can I do this?
I already tried with shadows but that was not the effect I want.
Thank you.
It looks like the
CILenticularHaloGenerator core image filter simulates lens flare, although the appearance is different than what you show.
Your image looks more like a radial gradient in red drawn over your image. You could use the Core Image CIRadialGradient filter, or overlay a partly transparent gradient on top of your image using CGGradient and CGContextDrawRadialGradient.

In Swift, is there a way to set a UIView's background to accomplish an overlay effect like Photoshop?

The designer used lots of overlay and multiply blend modes in his Photoshop design. Is there a simple way to set a UIView's background (or draw something to the CALayer) that will do the same thing as Photoshop's overlay (as well as multiply) filter? The goal is to blend the UIView's background with whatever appears behind it. This ideally would auto update if I animate the UIView's position as well.

iOS Glint Effect Text

How would one implement a text glint effect similar to the Slide to Unlock image, or in the Paypal app?
Is it possible to have transparent text and animate some sort of white shape moving behind it?
Please refer to MTAnimatedLabel which does the exact same thing.
He uses a CATextLayer to mask a CAGradientLayer and then he animates the gradient layer for the required effect.
You can find the usage details in the link. You can even change the tint color.

Resources