[go: nahoru, domu]

blob: 83e14f8b1ecf5157af1beae3da2016f80af53c0e [file] [log] [blame]
/*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.ui.graphics
/**
* Creates a color filter that applies the blend mode given as the second
* argument. The source color is the one given as the first argument, and the
* destination color is the one from the layer being composited.
*
* The output of this filter is then composited into the background according
* to the [Paint.blendMode], using the output of this filter as the source
* and the background as the destination.
*/
data class ColorFilter(
val color: Color,
val blendMode: BlendMode
) {
companion object {
/**
* Helper method to create a [ColorFilter] that tints contents to the specified color
*/
fun tint(color: Color): ColorFilter = ColorFilter(color, BlendMode.srcIn)
}
}