fun makeLinearGradient()

in skiko/src/commonMain/kotlin/org/jetbrains/skia/Shader.kt [80:113]


        fun makeLinearGradient(
            x0: Float,
            y0: Float,
            x1: Float,
            y1: Float,
            colors: Array<Color4f>,
            cs: ColorSpace?,
            positions: FloatArray?,
            style: GradientStyle
        ): Shader {
            return try {
                require(positions == null || colors.size == positions.size) { "colors.length " + colors.size + "!= positions.length " + positions!!.size }
                Stats.onNativeCall()
                Shader(
                    interopScope {
                        _nMakeLinearGradientCS(
                            x0,
                            y0,
                            x1,
                            y1,
                            toInterop(Color4f.flattenArray(colors)),
                            getPtr(cs),
                            toInterop(positions),
                            colors.size,
                            style.tileMode.ordinal,
                            style._getFlags(),
                            toInterop(style._getMatrixArray())
                        )
                    }
                )
            } finally {
                reachabilityBarrier(cs)
            }
        }