Kingfisher Documentation

Structure Round​Corner​Image​Processor

public struct RoundCornerImageProcessor: ImageProcessor  

Processor for making round corner images. Only CG-based images are supported in macOS, if a non-CG image passed in, the processor will do nothing.

You could use FormatIndicatedCacheSerializer.png to force Kingfisher to serialize the image to PNG format in this case.

%219 RoundCornerImageProcessor RoundCornerImageProcessor ImageProcessor ImageProcessor RoundCornerImageProcessor->ImageProcessor

Nested Types

RoundCornerImageProcessor.Radius

Represents a radius specified in a RoundCornerImageProcessor.

Conforms To

ImageProcessor

An ImageProcessor would be used to convert some downloaded data to an image.

Initializers

init(corner​Radius:​target​Size:​rounding​Corners:​background​Color:​)

public init(
        cornerRadius: CGFloat,
        targetSize: CGSize? = nil,
        roundingCorners corners: RectCorner = .all,
        backgroundColor: KFCrossPlatformColor? = nil
    ) 

Creates a RoundCornerImageProcessor.

This initializer accepts a concrete point value for cornerRadius. If you do not know the image size, but still want to apply a full round-corner (making the final image a round one), or specify the corner radius as a fraction of one dimension of the target image, use the Radius version instead.

Parameters

corner​Radius CGFloat

Corner radius in point will be applied in processing.

target​Size CGSize?

Target size of output image should be. If nil, the image will keep its original size after processing. Default is nil.

corners Rect​Corner

The target corners which will be applied rounding. Default is .all.

background​Color KFCross​Platform​Color?

Background color to apply for the output image. Default is nil.

init(radius:​target​Size:​rounding​Corners:​background​Color:​)

public init(
        radius: Radius,
        targetSize: CGSize? = nil,
        roundingCorners corners: RectCorner = .all,
        backgroundColor: KFCrossPlatformColor? = nil
    ) 

Creates a RoundCornerImageProcessor.

Parameters

radius Radius

The radius will be applied in processing.

target​Size CGSize?

Target size of output image should be. If nil, the image will keep its original size after processing. Default is nil.

corners Rect​Corner

The target corners which will be applied rounding. Default is .all.

background​Color KFCross​Platform​Color?

Background color to apply for the output image. Default is nil.

Properties

identifier

public let identifier: String

Identifier of the processor.

radius

public let radius: Radius

The radius will be applied in processing. Specify a certain point value with .point, or a fraction of the target image with .widthFraction. or .heightFraction. For example, given a square image with width and height equals, .widthFraction(0.5) means use half of the length of size and makes the final image a round one.

rounding​Corners

public let roundingCorners: RectCorner

The target corners which will be applied rounding.

target​Size

public let targetSize: CGSize? 

Target size of output image should be. If nil, the image will keep its original size after processing.

background​Color

public let backgroundColor: KFCrossPlatformColor? 

Background color of the output image. If nil, it will use a transparent background.

Methods

process(item:​options:​)

public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?  

Processes the input ImageProcessItem with this processor.

Parameters

item Image​Process​Item

Input item which will be processed by self.

options Kingfisher​Parsed​Options​Info

Options when processing the item.

Returns

The processed image.