ComposableIconUtils

Utility functions for rendering Composable icons to image files for use in system tray.

Functions

Link copied to clipboard
fun calculateContentHash(iconRenderProperties: IconRenderProperties, content: () -> Unit): Long

Calculates a hash value for the rendered composable content. This can be used to detect changes in the composable content without requiring an explicit key.

Link copied to clipboard
fun renderComposableToIcoBytes(iconRenderProperties: IconRenderProperties, content: () -> Unit): ByteArray

Renders a Composable to ICO format bytes. Since ICO format is not directly supported by the encoding library, this method first renders to PNG and then creates a simple ICO wrapper.

Link copied to clipboard
fun renderComposableToIcoFile(iconRenderProperties: IconRenderProperties, content: () -> Unit): String

Renders a Composable to an ICO file and returns the path to the file.

Link copied to clipboard
fun renderComposableToPngBytes(iconRenderProperties: IconRenderProperties, content: () -> Unit): ByteArray

Renders a Composable to a PNG image and returns the result as a byte array. This function creates an ImageComposeScene based on the provided IconRenderProperties, renders the Composable content, and encodes the output into PNG format. If scaling is required based on the IconRenderProperties, the rendered content is scaled before encoding.

Link copied to clipboard
fun renderComposableToPngFile(iconRenderProperties: IconRenderProperties, content: () -> Unit): String

Renders a Composable to a PNG file and returns the path to the file.