### Styled QR Code with DSL Source: https://context7.com/alexzhirkevich/qrose/llms.txt Customize QR code elements like pixel shape, colors, logo, and background using the `QrOptions { }` DSL builder. This example demonstrates per-element shape and color customizations. ```kotlin import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import io.github.alexzhirkevich.qrose.rememberQrCodePainter import io.github.alexzhirkevich.qrose.options.* @Composable fun StyledQrCode(logoPainter: Painter) { val painter = rememberQrCodePainter("https://example.com") { shapes { ball = QrBallShape.circle() darkPixel = QrPixelShape.roundCorners(radius = 0.5f) frame = QrFrameShape.roundCorners(corner = 0.25f) pattern = QrCodeShape.circle() // circular overall shape } colors { dark = QrBrush.brush { Brush.linearGradient( 0f to Color.Red, 1f to Color.Blue, end = Offset(it, it) ) } frame = QrBrush.solid(Color.Black) light = QrBrush.Unspecified // transparent background pixels } logo { painter = logoPainter size = 0.2f // 20% of QR code size padding = QrLogoPadding.Natural(0.1f) // naturally clears pixels under logo shape = QrLogoShape.circle() } errorCorrectionLevel = QrErrorCorrectionLevel.High // ~30% damage tolerance scale = 0.9f // adds visual padding } Image(painter = painter, contentDescription = null, modifier = Modifier.size(300.dp)) } ``` -------------------------------- ### Supported 1D Barcode Formats Enum Source: https://context7.com/alexzhirkevich/qrose/llms.txt Enum listing all nine barcode formats available in the qrose-oned artifact, each backed by a dedicated encoder. Example: choose type at runtime. ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodeType BarcodeType.Codabar // alphanumeric; used in libraries and blood banks BarcodeType.Code39 // uppercase letters + digits; logistics BarcodeType.Code93 // full ASCII, more compact than Code 39 BarcodeType.Code128 // full ASCII, high-density; widely used in shipping BarcodeType.EAN8 // 7-digit + check; small product packaging BarcodeType.EAN13 // 12-digit + check; standard retail BarcodeType.ITF // interleaved 2-of-5; cartons and pallets BarcodeType.UPCA // 11-digit + check; North American retail BarcodeType.UPCE // compressed 6-digit UPC; small packages // Example: choose type at runtime fun barcodeForProduct(data: String, format: BarcodeType) = BarcodePainter(data, format) ``` -------------------------------- ### Configure QR Code Styling with QrOptions Source: https://context7.com/alexzhirkevich/qrose/llms.txt Use QrOptions to group visual configurations. Construct it via DSL or directly. Pass it to painters for reuse and caching. ```kotlin import io.github.alexzhirkevich.qrose.options.QrOptions import io.github.alexzhirkevich.qrose.options.QrShapes import io.github.alexzhirkevich.qrose.options.QrColors import io.github.alexzhirkevich.qrose.options.QrBrush import androidx.compose.ui.graphics.Color // Construct via DSL val options = QrOptions { shapes { darkPixel = QrPixelShape.circle() } colors { dark = QrBrush.solid(Color(0xFF1565C0)) } errorCorrectionLevel = QrErrorCorrectionLevel.Medium } // Construct directly val options2 = QrOptions( shapes = QrShapes(darkPixel = QrPixelShape.roundCorners()), colors = QrColors(dark = QrBrush.solid(Color.DarkGray)), errorCorrectionLevel = QrErrorCorrectionLevel.Auto, fourEyed = false, scale = 1f ) // Reuse across multiple painters val painterA = QrCodePainter("https://example.com", options) val painterB = QrCodePainter("https://other.com", options) ``` -------------------------------- ### Customize QR Code Appearance with DSL Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Utilize a Domain Specific Language (DSL) constructor for a more readable way to customize QR code elements, including logo, shapes, and colors. ```kotlin val logoPainter : Painter = painterResource("logo.png") val qrcodePainter : Painter = rememberQrCodePainter("https://example.com") { logo { painter = logoPainter padding = QrLogoPadding.Natural(.1f) shape = QrLogoShape.circle() size = 0.2f } shapes { ball = QrBallShape.circle() darkPixel = QrPixelShape.roundCorners() frame = QrFrameShape.roundCorners(.25f) } colors { dark = QrBrush.brush { Brush.linearGradient( 0f to Color.Red, 1f to Color.Blue, end = Offset(it, it) ) } frame = QrBrush.solid(Color.Black) } } ``` -------------------------------- ### Create 1D Barcode Painter Imperatively Source: https://context7.com/alexzhirkevich/qrose/llms.txt Creates a 1D barcode painter imperatively. Supports a custom BarcodePathBuilder lambda for non-standard bar rendering (e.g., rounded bars, custom aspect ratios). ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodePainter import io.github.alexzhirkevich.qrose.oned.BarcodeType import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Path // Default painter val painter = BarcodePainter("A23342453D", BarcodeType.Codabar) // Custom path builder: bars with rounded tops val customPainter = BarcodePainter( data = "TEST", type = BarcodeType.Code39, builder = { size, code -> Path().apply { val barWidth = size.width / code.size code.forEachIndexed { i, filled -> if (filled) { addRoundRect( androidx.compose.ui.geometry.RoundRect( Rect(i * barWidth, 0f, (i + 1) * barWidth, size.height), radiusX = barWidth / 2, radiusY = barWidth / 2 ) ) } } } } ) ``` -------------------------------- ### Basic QR Code in Compose Composition Source: https://context7.com/alexzhirkevich/qrose/llms.txt Use `rememberQrCodePainter` to create a QR code painter that is tied to the Compose lifecycle. The painter recomputes only when data or styling options change. ```kotlin import androidx.compose.foundation.Image import io.github.alexzhirkevich.qrose.rememberQrCodePainter @Composable fun BasicQrCode() { Image( painter = rememberQrCodePainter("https://example.com"), contentDescription = "QR code for example.com", modifier = Modifier.size(256.dp) ) } ``` -------------------------------- ### rememberQrCodePainter with DSL - Styled QR Code Source: https://context7.com/alexzhirkevich/qrose/llms.txt Applies per-element shape and color customizations using the QrOptions DSL builder for advanced styling. ```APIDOC ## rememberQrCodePainter with DSL - Styled QR Code ### Description Applies per-element shape and color customizations using the `QrOptions { }` DSL builder. The `shapes { }`, `colors { }`, `logo { }`, and `background { }` sub-scopes configure each visual layer independently. ### Usage ```kotlin import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import io.github.alexzhirkevich.qrose.rememberQrCodePainter import io.github.alexzhirkevich.qrose.options.* @Composable fun StyledQrCode(logoPainter: Painter) { val painter = rememberQrCodePainter("https://example.com") { shapes { ball = QrBallShape.circle() darkPixel = QrPixelShape.roundCorners(radius = 0.5f) frame = QrFrameShape.roundCorners(corner = 0.25f) pattern = QrCodeShape.circle() // circular overall shape } colors { dark = QrBrush.brush { Brush.linearGradient( 0f to Color.Red, 1f to Color.Blue, end = Offset(it, it) ) } frame = QrBrush.solid(Color.Black) light = QrBrush.Unspecified // transparent background pixels } logo { painter = logoPainter size = 0.2f // 20% of QR code size padding = QrLogoPadding.Natural(0.1f) // naturally clears pixels under logo shape = QrLogoShape.circle() } errorCorrectionLevel = QrErrorCorrectionLevel.High // ~30% damage tolerance scale = 0.9f // adds visual padding } Image(painter = painter, contentDescription = null, modifier = Modifier.size(300.dp)) } ``` ``` -------------------------------- ### rememberQrCodePainter - Basic QR Code Source: https://context7.com/alexzhirkevich/qrose/llms.txt Creates and remembers a QrCodePainter tied to the Compose lifecycle for basic QR code generation. ```APIDOC ## rememberQrCodePainter - Basic QR Code ### Description Creates and remembers a `QrCodePainter` tied to the Compose lifecycle. The painter recomputes only when `data` or styling options change. ### Usage ```kotlin import androidx.compose.foundation.Image import io.github.alexzhirkevich.qrose.rememberQrCodePainter @Composable fun BasicQrCode() { Image( painter = rememberQrCodePainter("https://example.com"), contentDescription = "QR code for example.com", modifier = Modifier.size(256.dp) ) } ``` ``` -------------------------------- ### Add QRose Dependencies to Gradle Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Include the QRose library for QR codes or the qrose-oned module for single-dimension barcodes in your project's dependencies. ```gradle dependencies { // For QR codes implementation("io.github.alexzhirkevich:qrose:") // For single-dimension barcodes (UPC,EAN, Code128, ...) implementation("io.github.alexzhirkevich:qrose-oned:") } ``` -------------------------------- ### Customize QR Code Background Source: https://context7.com/alexzhirkevich/qrose/llms.txt Set a background behind the QR code pattern using `QrBackground`. Supports solid/gradient fills, `Painter` images, or Compose `Shape` clips. Use `QrBrush.Unspecified` for transparent light pixels to reveal the background. ```kotlin import androidx.compose.foundation.shape.CircleShape import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import io.github.alexzhirkevich.qrose.options.QrBackground val painter = rememberQrCodePainter("https://example.com") { background { fill = Brush.radialGradient( listOf(Color(0xFFFFF9C4), Color(0xFFFFECB3)) ) shape = CircleShape // clip background to circle; code remains square } colors { light = QrBrush.Unspecified // transparent light pixels to show background } } ``` -------------------------------- ### Add QRose to Gradle Dependencies Source: https://context7.com/alexzhirkevich/qrose/llms.txt Include the qrose artifact for QR codes or qrose-oned for 1D barcodes in your project's build.gradle.kts file. ```kotlin // build.gradle.kts dependencies { // QR codes implementation("io.github.alexzhirkevich:qrose:1.1.2") // 1D barcodes (UPC, EAN, Code 128/93/39, Codabar, ITF) implementation("io.github.alexzhirkevich:qrose-oned:1.1.2") } ``` -------------------------------- ### Generate Basic QR Code and Barcode in Compose Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Use `rememberQrCodePainter` or `rememberBarcodePainter` within your Compose UI to render QR codes and barcodes. These functions can also be used outside of Compose with `QrCodePainter` and `BarcodePainter`. ```kotlin Image( painter = rememberQrCodePainter("https://example.com"), contentDescription = "QR code referring to the example.com website" ) Image( painter = rememberBarcodePainter("9780201379624", BarcodeType.EAN13), contentDescription = "EAN barcode for some product" ) ``` -------------------------------- ### Export QR Code to Image Bytes or Bitmap Source: https://context7.com/alexzhirkevich/qrose/llms.txt Renders the QR code off-screen to a ByteArray (PNG, JPEG, or WEBP) or ImageBitmap at a given pixel size. Useful for saving, sharing, or uploading the code. ```kotlin import io.github.alexzhirkevich.qrose.QrCodePainter import io.github.alexzhirkevich.qrose.toByteArray import io.github.alexzhirkevich.qrose.toImageBitmap val painter = QrCodePainter( data = "https://example.com", options = QrOptions { shapes { darkPixel = QrPixelShape.roundCorners() } } ) // Export as PNG bytes (1024×1024 px) val pngBytes: ByteArray = painter.toByteArray(width = 1024, height = 1024, format = ImageFormat.PNG) // Export as JPEG val jpegBytes: ByteArray = painter.toByteArray(width = 512, height = 512, format = ImageFormat.JPEG) // Export as ImageBitmap for further Compose usage val bitmap = painter.toImageBitmap(width = 512, height = 512) ``` -------------------------------- ### Export QR Code to Image Bytes Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Export generated QR codes to `PNG`, `JPEG`, or `WEBP` formats by calling the `toByteArray` function on a `QrCodePainter` instance, specifying desired dimensions and format. ```kotlin val painter : Painter = QrCodePainter( data = "https://example.com", options = QrOptions { colors { //... } } ) val bytes : ByteArray = painter.toByteArray(1024, 1024, ImageFormat.PNG) ``` -------------------------------- ### QR Code Outside Compose Composition Source: https://context7.com/alexzhirkevich/qrose/llms.txt Instantiate `QrCodePainter` imperatively for use in ViewModels or background tasks. Accepts `QrOptions` for full styling control. ```kotlin import io.github.alexzhirkevich.qrose.QrCodePainter import io.github.alexzhirkevich.qrose.options.QrOptions val painter = QrCodePainter( data = "https://example.com", options = QrOptions() // default styling ) // Use in any Image composable: Image(painter = painter, contentDescription = null) ``` -------------------------------- ### QrCodePainter - QR Code Outside Composition Source: https://context7.com/alexzhirkevich/qrose/llms.txt Instantiates a QrCodePainter imperatively for use outside of the Compose composition. ```APIDOC ## QrCodePainter - QR Code Outside Composition ### Description Instantiates a `QrCodePainter` imperatively (e.g., in a ViewModel or background task). Accepts a `QrOptions` object for full styling control. ### Usage ```kotlin import io.github.alexzhirkevich.qrose.QrCodePainter import io.github.alexzhirkevich.qrose.options.QrOptions val painter = QrCodePainter( data = "https://example.com", options = QrOptions() // default styling ) // Use in any Image composable: Image(painter = painter, contentDescription = null) ``` ``` -------------------------------- ### `toByteArray` / `toImageBitmap` — Export to Image Source: https://context7.com/alexzhirkevich/qrose/llms.txt Renders the QR code off-screen to a ByteArray (PNG, JPEG, or WEBP) or ImageBitmap at a given pixel size. Useful for saving, sharing, or uploading the code. ```APIDOC ## `toByteArray` / `toImageBitmap` — Export to Image Renders the QR code off-screen to a `ByteArray` (PNG, JPEG, or WEBP) or `ImageBitmap` at a given pixel size. Useful for saving, sharing, or uploading the code. ```kotlin import io.github.alexzhirkevich.qrose.QrCodePainter import io.github.alexzhirkevich.qrose.toByteArray import io.github.alexzhirkevich.qrose.toImageBitmap val painter = QrCodePainter( data = "https://example.com", options = QrOptions { shapes { darkPixel = QrPixelShape.roundCorners() } } ) // Export as PNG bytes (1024×1024 px) val pngBytes: ByteArray = painter.toByteArray(width = 1024, height = 1024, format = ImageFormat.PNG) // Export as JPEG val jpegBytes: ByteArray = painter.toByteArray(width = 512, height = 512, format = ImageFormat.JPEG) // Export as ImageBitmap for further Compose usage val bitmap = painter.toImageBitmap(width = 512, height = 512) ``` ``` -------------------------------- ### Define QR Code Colors and Gradients with QrBrush Source: https://context7.com/alexzhirkevich/qrose/llms.txt QrBrush provides factories for solid colors, gradients, and random colors per pixel. Use it to customize QR code element colors. ```kotlin import io.github.alexzhirkevich.qrose.options.QrBrush import io.github.alexzhirkevich.qrose.options.QrBrushMode import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.geometry.Offset // 1. Solid color val solidBlue = QrBrush.solid(Color.Blue) // 2. Gradient or any arbitrary Compose Brush val gradient = QrBrush.brush { Brush.radialGradient(listOf(Color.Cyan, Color.Magenta)) } // 3. Gradient applied per pixel instead of across the whole pattern (Separate mode) val perPixelGradient = QrBrush.brush(mode = QrBrushMode.Separate) { Brush.linearGradient( 0f to Color.Yellow, 1f to Color.Red, end = Offset(it, it) ) } // 4. Random color per pixel val randomColors = QrBrush.random( 0.05f to Color.Red, // 5% chance red 1.00f to Color.Black // 95% chance black ) // 5. Image/shader brush (fills the pattern with a painter image) val imageBrush = QrBrush.image(painter = someImagePainter, alpha = 0.9f) // Usage val painter = rememberQrCodePainter("https://example.com") { colors { dark = gradient frame = solidBlue } } ``` -------------------------------- ### Remember 1D Barcode Painter in Compose Source: https://context7.com/alexzhirkevich/qrose/llms.txt Creates and remembers a BarcodePainter for any of the nine supported 1D barcode formats. Invalid input data causes the onError callback to be invoked (defaults to re-throwing). ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodeType import io.github.alexzhirkevich.qrose.oned.rememberBarcodePainter @Composable fun BarcodeShowcase() { Column { // EAN-13 product barcode Image( painter = rememberBarcodePainter("9780201379624", BarcodeType.EAN13), contentDescription = "EAN-13", modifier = Modifier.width(300.dp).height(100.dp) ) // UPC-A Image( painter = rememberBarcodePainter("123456789012", BarcodeType.UPCA), contentDescription = "UPC-A", modifier = Modifier.width(300.dp).height(100.dp) ) // Code 128 — arbitrary text Image( painter = rememberBarcodePainter("HELLO-WORLD", BarcodeType.Code128, brush = SolidColor(Color(0xFF1B5E20)), onError = { /* log or show error */ throw it } ), contentDescription = "Code 128", modifier = Modifier.width(300.dp).height(100.dp) ) } } ``` -------------------------------- ### Customize QR Code Appearance Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Customize the appearance of QR codes using parameters like `ballShape`, `darkPixelShape`, `frameShape`, `darkBrush`, `frameBrush`, `logoPainter`, `logoPadding`, `logoShape`, and `logoSize`. ```kotlin val qrcodePainter = rememberQrCodePainter( data = "https://example.com", ballShape = QrBallShape.circle(), darkPixelShape = QrPixelShape.roundCorners(), frameShape = QrFrameShape.roundCorners(.25f), darkBrush = QrBrush.brush { Brush.linearGradient( 0f to Color.Red, 1f to Color.Blue, end = Offset(it, it) ) }, frameBrush = QrBrush.solid(Color.Black), logoPainter = rememberQrCodePainter("123"), logoPadding = QrLogoPadding.Natural(.1f), logoShape = QrLogoShape.circle(), logoSize = 0.2f, ) ``` -------------------------------- ### `BarcodePainter` — 1D Barcode Outside Composition Source: https://context7.com/alexzhirkevich/qrose/llms.txt Creates a 1D barcode painter imperatively. Supports a custom `BarcodePathBuilder` lambda for non-standard bar rendering (e.g., rounded bars, custom aspect ratios). ```APIDOC ## `BarcodePainter` — 1D Barcode Outside Composition Creates a 1D barcode painter imperatively. Supports a custom `BarcodePathBuilder` lambda for non-standard bar rendering (e.g., rounded bars, custom aspect ratios). ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodePainter import io.github.alexzhirkevich.qrose.oned.BarcodeType import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Path // Default painter val painter = BarcodePainter("A23342453D", BarcodeType.Codabar) // Custom path builder: bars with rounded tops val customPainter = BarcodePainter( data = "TEST", type = BarcodeType.Code39, builder = { size, code -> Path().apply { val barWidth = size.width / code.size code.forEachIndexed { i, filled -> if (filled) { addRoundRect( androidx.compose.ui.geometry.RoundRect( Rect(i * barWidth, 0f, (i + 1) * barWidth, size.height), radiusX = barWidth / 2, radiusY = barWidth / 2 ) ) } } } } ) ``` ``` -------------------------------- ### Create Custom QR Code Ball Shape Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Define custom shapes for QR code parts by extending `QrBallShape` and implementing the `path` function to draw the desired shape using `Path`. ```kotlin class MyCircleBallShape : QrBallShape { override fun Path.path(size: Float, neighbors: Neighbors): Path = apply { addOval(Rect(0f,0f, size, size)) } } ``` -------------------------------- ### `BarcodeType` — Supported 1D Barcode Formats Source: https://context7.com/alexzhirkevich/qrose/llms.txt Enum listing all nine barcode formats available in the `qrose-oned` artifact, each backed by a dedicated encoder. ```APIDOC ## `BarcodeType` — Supported 1D Barcode Formats Enum listing all nine barcode formats available in the `qrose-oned` artifact, each backed by a dedicated encoder. ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodeType BarcodeType.Codabar // alphanumeric; used in libraries and blood banks BarcodeType.Code39 // uppercase letters + digits; logistics BarcodeType.Code93 // full ASCII, more compact than Code 39 BarcodeType.Code128 // full ASCII, high-density; widely used in shipping BarcodeType.EAN8 // 7-digit + check; small product packaging BarcodeType.EAN13 // 12-digit + check; standard retail BarcodeType.ITF // interleaved 2-of-5; cartons and pallets BarcodeType.UPCA // 11-digit + check; North American retail BarcodeType.UPCE // compressed 6-digit UPC; small packages // Example: choose type at runtime fun barcodeForProduct(data: String, format: BarcodeType) = BarcodePainter(data, format) ``` ``` -------------------------------- ### `rememberBarcodePainter` — 1D Barcode in Composition Source: https://context7.com/alexzhirkevich/qrose/llms.txt Creates and remembers a `BarcodePainter` for any of the nine supported 1D barcode formats. Invalid input data causes the `onError` callback to be invoked (defaults to re-throwing). ```APIDOC ## `rememberBarcodePainter` — 1D Barcode in Composition Creates and remembers a `BarcodePainter` for any of the nine supported 1D barcode formats. Invalid input data causes the `onError` callback to be invoked (defaults to re-throwing). ```kotlin import io.github.alexzhirkevich.qrose.oned.BarcodeType import io.github.alexzhirkevich.qrose.oned.rememberBarcodePainter @Composable fun BarcodeShowcase() { Column { // EAN-13 product barcode Image( painter = rememberBarcodePainter("9780201379624", BarcodeType.EAN13), contentDescription = "EAN-13", modifier = Modifier.width(300.dp).height(100.dp) ) // UPC-A Image( painter = rememberBarcodePainter("123456789012", BarcodeType.UPCA), contentDescription = "UPC-A", modifier = Modifier.width(300.dp).height(100.dp) ) // Code 128 — arbitrary text Image( painter = rememberBarcodePainter("HELLO-WORLD", BarcodeType.Code128, brush = SolidColor(Color(0xFF1B5E20)), onError = { /* log or show error */ throw it } ), contentDescription = "Code 128", modifier = Modifier.width(300.dp).height(100.dp) ) } } ``` ``` -------------------------------- ### Configure QR Code Error Correction Level Source: https://context7.com/alexzhirkevich/qrose/llms.txt Set the error tolerance for QR codes using `QrErrorCorrectionLevel`. Options range from `Low` (~7%) to `High` (~30%), affecting QR code size and resilience to damage. `Auto` selects the minimum level needed for a logo. ```kotlin import io.github.alexzhirkevich.qrose.options.QrErrorCorrectionLevel // Auto: minimum needed based on logo size (default) QrErrorCorrectionLevel.Auto // Manual levels: QrErrorCorrectionLevel.Low // ~7% — smallest QR code, best for no logo QrErrorCorrectionLevel.Medium // ~15% QrErrorCorrectionLevel.MediumHigh // ~25% QrErrorCorrectionLevel.High // ~30% — largest QR code, best for big logos val painter = rememberQrCodePainter("https://example.com") { logo { painter = logoPainter size = 0.25f padding = QrLogoPadding.Accurate(0.1f) } errorCorrectionLevel = QrErrorCorrectionLevel.High } ``` -------------------------------- ### Encode Structured Payload Data Source: https://context7.com/alexzhirkevich/qrose/llms.txt Utilize `QrData` extension functions to generate correctly formatted QR payload strings for various data types like Wi-Fi, email, vCard, and geo-location. This ensures proper encoding for specific applications. ```kotlin import io.github.alexzhirkevich.qrose.QrData import io.github.alexzhirkevich.qrose.wifi import io.github.alexzhirkevich.qrose.email import io.github.alexzhirkevich.qrose.vCard import io.github.alexzhirkevich.qrose.location // Wi-Fi network val wifiPayload = QrData.wifi(ssid = "MyNetwork", psk = "s3cr3t", authentication = "WPA") Image(painter = rememberQrCodePainter(wifiPayload), contentDescription = "Wi-Fi QR") // Email with subject and body val emailPayload = QrData.email( email = "hello@example.com", subject = "Meeting request", body = "Hi, let's meet tomorrow." ) // vCard contact val vcard = QrData.vCard( name = "Jane Doe", company = "Acme Corp", phoneNumber = "+1-555-0100", email = "jane@acme.com", website = "https://acme.com" ) // Geographic location val geo = QrData.location(lat = 48.8566f, lon = 2.3522f) // Calendar event val event = QrData.event( uid = "event-001", start = "20240901T090000Z", end = "20240901T100000Z", summary = "Quarterly Review" ) ``` -------------------------------- ### Encode QR Code Data Types Source: https://github.com/alexzhirkevich/qrose/blob/main/README.md Use the `QrData` object to encode various payload types such as Text, Wi-Fi credentials, E-mail addresses, and vCards into QR codes. ```kotlin val wifiData : String = QrData.wifi(ssid = "My Network", psk = "12345678") val wifiCode = rememberQrCodePainter(wifiData) ``` -------------------------------- ### Customize Overall QR Code Pattern Shape Source: https://context7.com/alexzhirkevich/qrose/llms.txt Transform the entire QR matrix to fit non-rectangular containers like circles or hexagons using `QrCodeShape`. Fills corners with border pixels. Adjust padding and rotation as needed. ```kotlin import io.github.alexzhirkevich.qrose.options.QrCodeShape // Circular QR code val painter = rememberQrCodePainter("https://example.com") { shapes { pattern = QrCodeShape.circle(padding = 1.1f, precise = true) } } ``` ```kotlin // Hexagonal QR code val painter2 = rememberQrCodePainter("https://example.com") { shapes { pattern = QrCodeShape.hexagon(rotation = 30f) } errorCorrectionLevel = QrErrorCorrectionLevel.High } ``` -------------------------------- ### Customize QR Code Pixel Shapes with QrPixelShape Source: https://context7.com/alexzhirkevich/qrose/llms.txt QrPixelShape defines the shape of individual QR code pixels. Use built-in shapes or create custom ones by implementing the QrPixelShape interface. ```kotlin import io.github.alexzhirkevich.qrose.options.QrPixelShape import io.github.alexzhirkevich.qrose.options.Neighbors import androidx.compose.ui.graphics.Path // Built-in shapes QrPixelShape.Default // square (same as square()) QrPixelShape.square(size = 0.9f) QrPixelShape.circle(size = 1f) QrPixelShape.roundCorners(radius = 0.5f) QrPixelShape.verticalLines(width = 0.7f) QrPixelShape.horizontalLines(width = 0.7f) // Custom pixel shape class DiamondPixelShape : QrPixelShape { override fun Path.path(size: Float, neighbors: Neighbors): Path = apply { moveTo(size / 2f, 0f) lineTo(size, size / 2f) lineTo(size / 2f, size) lineTo(0f, size / 2f) close() } } val painter = rememberQrCodePainter("https://example.com") { shapes { darkPixel = QrPixelShape.roundCorners() lightPixel = QrPixelShape.circle(size = 0.3f) // visible dot in light pixels } } ``` -------------------------------- ### Customize QR Code Eye Element Shapes Source: https://context7.com/alexzhirkevich/qrose/llms.txt Control the shape of the finder-pattern eyes using QrBallShape and QrFrameShape. Supports default square, circles, rounded corners, and matching data pixel shapes. Requires `DelicateQRoseApi` for four-eyed QR codes. ```kotlin import io.github.alexzhirkevich.qrose.options.QrBallShape import io.github.alexzhirkevich.qrose.options.QrFrameShape // Ball shapes QrBallShape.Default // square QrBallShape.circle() QrBallShape.roundCorners(radius = 0.25f, bottomRight = false) QrBallShape.asPixel(QrPixelShape.roundCorners()) // matches data pixel shape // Frame shapes QrFrameShape.Default // square QrFrameShape.circle() QrFrameShape.roundCorners(corner = 0.25f, topLeft = true, bottomLeft = true, topRight = true, bottomRight = false) QrFrameShape.asPixel(QrPixelShape.roundCorners()) ``` ```kotlin // Four-eyed QR code with custom eye styling @OptIn(DelicateQRoseApi::class) val painter = rememberQrCodePainter("https://example.com") { fourEyed = true shapes { ball = QrBallShape.roundCorners(0.25f, bottomRight = false) frame = QrFrameShape.roundCorners(0.25f, bottomRight = false) } colors { ball = QrBrush.solid(Color.Red) frame = QrBrush.solid(Color.DarkGray) } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.