1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.compose.ui.graphics 18 19 import androidx.compose.runtime.Immutable 20 21 /** Quality levels for image filters. See [Paint.filterQuality]. */ 22 @Immutable 23 @kotlin.jvm.JvmInline 24 value class FilterQuality internal constructor(val value: Int) { 25 26 companion object { 27 /** 28 * Fastest possible filtering, albeit also the lowest quality Typically this implies 29 * nearest-neighbour filtering. 30 */ 31 val None = FilterQuality(0) 32 33 /** 34 * Better quality than [None], faster than [Medium]. Typically this implies bilinear 35 * interpolation. 36 */ 37 val Low = FilterQuality(1) 38 39 /** 40 * Better quality than [Low], faster than [High]. 41 * 42 * Typically this implies a combination of bilinear interpolation and pyramidal parametric 43 * prefiltering (mipmaps). 44 */ 45 val Medium = FilterQuality(2) 46 47 /** 48 * Best possible quality filtering, albeit also the slowest. Typically this implies bicubic 49 * interpolation or better. 50 */ 51 val High = FilterQuality(3) 52 } 53 toStringnull54 override fun toString() = 55 when (this) { 56 None -> "None" 57 Low -> "Low" 58 Medium -> "Medium" 59 High -> "High" 60 else -> "Unknown" 61 } 62 } 63