Skip to content

Apply a gradient to a UIImage seems broken #23

@carole-lavillonniere

Description

@carole-lavillonniere

When applying this gradient to UIImages:

image.apply(gradientColors: [UIColor.yellow, UIColor.red], locations: [1.0, 0.0])

I would expect the whole image to be covered by the gradient since the colors are completely opaque.

However, it does sometimes seem to apply a strange blend mode, although the blend mode is left to the default value (CGBlendMode.normal).

See on the following example: the gradient is wrong on the 1st image, but correct on the 2nd image.

screenshot 2016-10-10 16 40 23

Here is a second example with the following gradient:

image.apply(gradientColors: [UIColor.black, UIColor.black], locations: [1, 0])

The 1st image is correct but the 2nd seems to be a negative.

screenshot 2016-10-10 16 48 04

I am using ImageHelper.swift and ImageVIewExtension.swift from master (24581b1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions