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 /** 22 * Determines the winding rule that decides how the interior of a [Path] is calculated. 23 * 24 * This enum is used by the [Path.fillType] property. 25 */ 26 @Immutable 27 @kotlin.jvm.JvmInline 28 value class PathFillType internal constructor(@Suppress("unused") private val value: Int) { 29 companion object { 30 /** 31 * The interior is defined by a non-zero sum of signed edge crossings. 32 * 33 * For a given point, the point is considered to be on the inside of the path if a line 34 * drawn from the point to infinity crosses lines going clockwise around the point a 35 * different number of times than it crosses lines going counter-clockwise around that 36 * point. 37 * 38 * See: <https://en.wikipedia.org/wiki/Nonzero-rule> 39 */ 40 val NonZero = PathFillType(0) 41 42 /** 43 * The interior is defined by an odd number of edge crossings. 44 * 45 * For a given point, the point is considered to be on the inside of the path if a line 46 * drawn from the point to infinity crosses an odd number of lines. 47 * 48 * See: <https://en.wikipedia.org/wiki/Even-odd_rule> 49 */ 50 val EvenOdd = PathFillType(1) 51 } 52 toStringnull53 override fun toString() = 54 when (this) { 55 NonZero -> "NonZero" 56 EvenOdd -> "EvenOdd" 57 else -> "Unknown" 58 } 59 } 60