FourPatchFrameBuilder
@objc(IMGLYFourPatchFrameBuilder) open class FourPatchFrameBuilder: NSObject, FrameBuilder
Builds a four patch frame, by spiltting the frame asset in four pieces and
paint it onto the UIImage
. The pieces are cropped at the insides to match the
image ratio. The input image must have a ratio of 1:1. The algorithm to place and crop,
each piece, leaves the sides of the asset uncropped that touch the longer side of the image.
The other sides get cropped, starting from the middle, so that the corners of the asset,
is touching the corners of the composet image. One could say the asset that is used as base,
for the composition is pushed together along the x or y axis, depending on the ratio of,
the given size.
-
Builds a four patch frame, by spiltting the frame asset in four pieces and paint it onto the
UIImage
. The pieces are cropped at the insides to match the image ratio. The input image must have a ratio of 1:1. The algorithm to place and crop, each piece, leaves the sides of the asset uncropped that touch the longer side of the image. The other sides get cropped, starting from the middle, so that the corners of the asset, is touching the corners of the composet image. One could say the asset that is used as base, for the composition is pushed together along the x or y axis, depending on the ratio of, the given size.Declaration
Swift
public func build(size: CGSize, relativeScale: CGFloat) -> UIImage?
Parameters
size
Size of the targed
UIImage
.relativeScale
not implemented yet.
Return Value
Returns an
UIImage
containing the composed frame asset.