fun makeRenderTarget()

in skiko/src/commonMain/kotlin/org/jetbrains/skia/Surface.kt [485:519]


        fun makeRenderTarget(
            context: DirectContext,
            budgeted: Boolean,
            imageInfo: ImageInfo,
            sampleCount: Int,
            origin: SurfaceOrigin,
            surfaceProps: SurfaceProps?,
            shouldCreateWithMips: Boolean
        ): Surface {
            return try {
                Stats.onNativeCall()
                val ptr = interopScope {
                    _nMakeRenderTarget(
                        getPtr(context),
                        budgeted,
                        imageInfo.width,
                        imageInfo.height,
                        imageInfo.colorInfo.colorType.ordinal,
                        imageInfo.colorInfo.alphaType.ordinal,
                        getPtr(imageInfo.colorInfo.colorSpace),
                        sampleCount,
                        origin.ordinal,
                        toInterop(surfaceProps?.packToIntArray()),
                        shouldCreateWithMips
                    )
                }
                require(ptr != NullPointer) {
                    "Failed Surface.makeRenderTarget($context, $budgeted, $imageInfo, $sampleCount, $origin, $surfaceProps, $shouldCreateWithMips)"
                }
                Surface(ptr, context)
            } finally {
                reachabilityBarrier(context)
                reachabilityBarrier(imageInfo.colorInfo.colorSpace)
            }
        }