diff --git a/README.md b/README.md index a5a93f4..1359275 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A patchable is simply a Composable function annotated with @Patch that ZePatch c - The build’s KSP processor discovers it and adds it to a registry. - The app can render it to a bitmap and the converter turns that into a stitch format (e.g., PES) for embroidery. -See [examples](app/src/main/java/de/berlindroid/zepatch/patchable/Demo.kt) +See [examples](app/src/main/java/de/berlindroid/zepatch/patchable) In its simplest form, a patchable looks like this: ```kotlin diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/AndroidLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/AndroidLogo.kt new file mode 100644 index 0000000..906ccd9 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/AndroidLogo.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("Android") +@Composable +fun AndroidLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.andriod), + contentDescription = null + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/Andy.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/Andy.kt new file mode 100644 index 0000000..61a1eac --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/Andy.kt @@ -0,0 +1,132 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.graphics.Shadow +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@Patch("AndyA") +@Composable +fun AndyA( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + var name by remember { mutableStateOf("Andy") } + Column { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Column( + modifier = Modifier + .size(200.dp) + .background( + brush = Brush.linearGradient( + colors = listOf( + Color.Red, + Color.Yellow, + Color.Green, + Color.Blue, + Color.Cyan + ) + ), + shape = RoundedCornerShape( + topStartPercent = 50, + topEndPercent = 50, + bottomStartPercent = 50, + bottomEndPercent = 0 + ) + ), + ) { + Spacer(modifier = Modifier.weight(1f)) + Text( + modifier = Modifier.fillMaxWidth(), + fontFamily = FontFamily.Cursive, + textAlign = TextAlign.Center, + fontStyle = FontStyle.Italic, + fontWeight = FontWeight.ExtraBold, + fontSize = 70.sp, + text = name, + ) + Spacer(modifier = Modifier.weight(1f)) + } + } + TextField(value = name, onValueChange = { name = it }) + } +} + +@Patch("AndyB") +@Composable +fun AndyB( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Column( + modifier = Modifier + .size(200.dp) + .background( + color = Color.White, + shape = RoundedCornerShape( + topStartPercent = 0, + topEndPercent = 50, + bottomStartPercent = 50, + bottomEndPercent = 0 + ) + ), + ) { + Spacer(modifier = Modifier.weight(1f)) + Text( + modifier = Modifier.fillMaxWidth(), + fontFamily = FontFamily.Cursive, + textAlign = TextAlign.Center, + fontWeight = FontWeight.ExtraBold, + fontSize = 64.sp, + style = TextStyle.Default.copy(shadow = Shadow(blurRadius = 12f)), + color = Color.Black, + text = "AndyB", + letterSpacing = (-1).sp + ) + Spacer(modifier = Modifier.weight(1f)) + } + } +} + +@Preview +@Composable +fun PreviewAndyA() { + AndyA() +} + +@Preview +@Composable +fun PreviewAndyB() { + AndyB() +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/AppLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/AppLogo.kt new file mode 100644 index 0000000..9c1acc0 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/AppLogo.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("AppLogo") +@Composable +fun AppLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.ai_logo), + contentDescription = null + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/BerlindroidLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/BerlindroidLogo.kt new file mode 100644 index 0000000..b1cf2dc --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/BerlindroidLogo.kt @@ -0,0 +1,39 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("BerlindroidLogo") +@Composable +fun BerlindroidLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.voltron_nosign), + contentDescription = null + ) + } +} + +@Preview +@Composable +fun PreviewBerlindroid() { + BerlindroidLogo() +} diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/ComposableSheep.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/ComposableSheep.kt new file mode 100644 index 0000000..1d0f522 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/ComposableSheep.kt @@ -0,0 +1,31 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea +import dev.nstv.composablesheep.library.ComposableSheep +import dev.nstv.composablesheep.library.model.Sheep +import dev.nstv.composablesheep.library.util.SheepColor + +@Preview +@Patch("Composable Sheep") +@Composable +fun ComposableSheepPatchable( + shouldCapture: Boolean = false, // used to activate the convert to bitmap + onBitmap: (ImageBitmap) -> Unit = {}, // used to return the bitmap from the SafeArea +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + ComposableSheep( + sheep = Sheep(fluffColor = SheepColor.Green), + modifier = Modifier.size(300.dp), + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/Demo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/Demo.kt deleted file mode 100644 index 27067de..0000000 --- a/app/src/main/java/de/berlindroid/zepatch/patchable/Demo.kt +++ /dev/null @@ -1,335 +0,0 @@ -package de.berlindroid.zepatch.patchable - -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Text -import androidx.compose.material3.TextField -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Brush -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ImageBitmap -import androidx.compose.ui.graphics.Shadow -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontStyle -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import de.berlindroid.zepatch.R -import de.berlindroid.zepatch.annotations.Patch -import de.berlindroid.zepatch.ui.SafeArea -import dev.nstv.composablesheep.library.ComposableSheep -import dev.nstv.composablesheep.library.model.Sheep -import dev.nstv.composablesheep.library.util.SheepColor - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("AppLogo") -@Composable -fun AppLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.ai_logo), - contentDescription = null - ) - } -} - - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("BerlindroidLogo") -@Composable -fun BerlindroidLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.voltron_nosign), - contentDescription = null - ) - } -} - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("FourOfThem") -@Composable -fun FourOfThemLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.four_of_them), - contentDescription = null - ) - } -} - - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("GoogleLogo") -@Composable -fun GoogleLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.g), - contentDescription = null - ) - } -} - - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("YubicoLogo") -@Composable -fun YubicoLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.yubico), - contentDescription = null - ) - } -} - - -@OptIn(ExperimentalMaterial3Api::class) -@Patch("Android") -@Composable -fun AndroidLogo( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.andriod), - contentDescription = null - ) - } -} - - -@Patch("AndyA") -@Composable -fun AndyA( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - var name by remember { mutableStateOf("Andy") } - Column { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Column( - modifier = Modifier - .size(200.dp) - .background( - brush = Brush.linearGradient( - colors = listOf( - Color.Red, - Color.Yellow, - Color.Green, - Color.Blue, - Color.Cyan - ) - ), - shape = RoundedCornerShape( - topStartPercent = 50, - topEndPercent = 50, - bottomStartPercent = 50, - bottomEndPercent = 0 - ) - ), - ) { - Spacer(modifier = Modifier.weight(1f)) - Text( - modifier = Modifier.fillMaxWidth(), - fontFamily = FontFamily.Cursive, - textAlign = TextAlign.Center, - fontStyle = FontStyle.Italic, - fontWeight = FontWeight.ExtraBold, - fontSize = 70.sp, - text = name, - ) - Spacer(modifier = Modifier.weight(1f)) - } - } - TextField(value = name, onValueChange = { name = it }) - } -} - -@Patch("AndyB") -@Composable -fun AndyB( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Column( - modifier = Modifier - .size(200.dp) - .background( - color = Color.White, - shape = RoundedCornerShape( - topStartPercent = 0, - topEndPercent = 50, - bottomStartPercent = 50, - bottomEndPercent = 0 - ) - ), - ) { - Spacer(modifier = Modifier.weight(1f)) - Text( - modifier = Modifier.fillMaxWidth(), - fontFamily = FontFamily.Cursive, - textAlign = TextAlign.Center, - fontWeight = FontWeight.ExtraBold, - fontSize = 64.sp, - style = TextStyle.Default.copy(shadow = Shadow(blurRadius = 12f)), - color = Color.Black, - text = "AndyB", - letterSpacing = (-1).sp - ) - Spacer(modifier = Modifier.weight(1f)) - } - } -} - -@Patch("flex") -@Composable -fun Emoji( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Text("💪", fontSize = 180.sp) - } -} - -@Patch("ROBOT") -@Composable -fun Emoji2( - shouldCapture: Boolean = false, - onBitmap: (ImageBitmap) -> Unit = {}, -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Text("🦾🤖\nHereWeGo", fontSize = 34.sp) - } -} - -@Preview -@Composable -fun PreviewAndyA() { - AndyA() -} - -@Preview -@Composable -fun PreviewAndyB() { - AndyB() -} - -@Preview -@Composable -fun PreviewFlex() { - Emoji() -} - -@Preview -@Composable -fun PreviewBerlindroid() { - BerlindroidLogo() -} - -@Preview -@Patch("Composable Sheep") -@Composable -fun ComposableSheepPatchable( - shouldCapture: Boolean = false, // used to activate the convert to bitmap - onBitmap: (ImageBitmap) -> Unit = {}, // used to return the bitmap from the SafeArea -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - ComposableSheep( - sheep = Sheep(fluffColor = SheepColor.Green), - modifier = Modifier.size(300.dp), - ) - } -} - -@Preview -@Patch("ZeWednesday") -@Composable -fun ZeWednesday( - shouldCapture: Boolean = false, // used to activate the convert to bitmap - onBitmap: (ImageBitmap) -> Unit = {}, // used to return the bitmap from the SafeArea -) { - SafeArea( - shouldCapture = shouldCapture, - onBitmap = onBitmap, - ) { - Image( - modifier = Modifier.size(200.dp), - painter = painterResource(R.drawable.ze_frog), - contentDescription = null - ) - } -} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/Emoji.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/Emoji.kt new file mode 100644 index 0000000..0667ddf --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/Emoji.kt @@ -0,0 +1,43 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.sp +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@Patch("flex") +@Composable +fun Emoji( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Text("💪", fontSize = 180.sp) + } +} + +@Patch("ROBOT") +@Composable +fun Emoji2( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Text("🦾🤖\nHereWeGo", fontSize = 34.sp) + } +} + +@Preview +@Composable +fun PreviewFlex() { + Emoji() +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/FourOfThemLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/FourOfThemLogo.kt new file mode 100644 index 0000000..dfbb100 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/FourOfThemLogo.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("FourOfThem") +@Composable +fun FourOfThemLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.four_of_them), + contentDescription = null + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/GoogleLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/GoogleLogo.kt new file mode 100644 index 0000000..ad9a344 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/GoogleLogo.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("GoogleLogo") +@Composable +fun GoogleLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.g), + contentDescription = null + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/YubicoLogo.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/YubicoLogo.kt new file mode 100644 index 0000000..8221d04 --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/YubicoLogo.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@OptIn(ExperimentalMaterial3Api::class) +@Patch("YubicoLogo") +@Composable +fun YubicoLogo( + shouldCapture: Boolean = false, + onBitmap: (ImageBitmap) -> Unit = {}, +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.yubico), + contentDescription = null + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/de/berlindroid/zepatch/patchable/ZeWednesday.kt b/app/src/main/java/de/berlindroid/zepatch/patchable/ZeWednesday.kt new file mode 100644 index 0000000..26a4c5e --- /dev/null +++ b/app/src/main/java/de/berlindroid/zepatch/patchable/ZeWednesday.kt @@ -0,0 +1,32 @@ +package de.berlindroid.zepatch.patchable + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import de.berlindroid.zepatch.R +import de.berlindroid.zepatch.annotations.Patch +import de.berlindroid.zepatch.ui.SafeArea + +@Preview +@Patch("ZeWednesday") +@Composable +fun ZeWednesday( + shouldCapture: Boolean = false, // used to activate the convert to bitmap + onBitmap: (ImageBitmap) -> Unit = {}, // used to return the bitmap from the SafeArea +) { + SafeArea( + shouldCapture = shouldCapture, + onBitmap = onBitmap, + ) { + Image( + modifier = Modifier.size(200.dp), + painter = painterResource(R.drawable.ze_frog), + contentDescription = null + ) + } +} \ No newline at end of file