Skip to content

1.6.10-dev1599

Pre-release
Pre-release
Compare
Choose a tag to compare
@jb-compose-bot jb-compose-bot released this 23 Apr 21:48
afe548b
[resources] Add functions to retrieve bytes from drawable or font res…

…ources. (#4651)

Implemented two new experimental functions:
```kotlin
/**
 * Retrieves the byte array of the drawable resource.
 *
 * @param environment The resource environment, which can be obtained from [rememberResourceEnvironment] or [getSystemResourceEnvironment].
 * @param resource The drawable resource.
 * @return The byte array representing the drawable resource.
 */
@ExperimentalResourceApi
suspend fun getDrawableResourceBytes(
    environment: ResourceEnvironment,
    resource: DrawableResource
): ByteArray {...}

/**
 * Retrieves the byte array of the font resource.
 *
 * @param environment The resource environment, which can be obtained from [rememberResourceEnvironment] or [getSystemResourceEnvironment].
 * @param resource The font resource.
 * @return The byte array representing the font resource.
 */
@ExperimentalResourceApi
suspend fun getFontResourceBytes(
    environment: ResourceEnvironment,
    resource: FontResource
): ByteArray {...}
```

fixes https://github.com/JetBrains/compose-multiplatform/issues/4360