From 64f825465de9fa30c4dfe2707067efdb96110db8 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 23 Oct 2025 21:59:37 -0700 Subject: Init --- .../liz/abstractionengine/ui/PCBBackground.kt | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt (limited to 'composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt') diff --git a/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt b/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt new file mode 100644 index 0000000..be35a1a --- /dev/null +++ b/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt @@ -0,0 +1,85 @@ +package coffee.liz.abstractionengine.ui + +import androidx.compose.foundation.Canvas +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathEffect + +@Composable +fun PCBBackground(modifier: Modifier = Modifier) { + val pcbGreen = Color(0xFF0D5F0D) + val traceColor = Color(0xFF1A7F1A) + val padColor = Color(0xFFD4AF37) + + Canvas(modifier = modifier.fillMaxSize().background(pcbGreen)) { + val width = size.width + val height = size.height + + // Draw circuit traces (horizontal and vertical lines) + val pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 5f), 0f) + + // Horizontal traces + for (i in 0..15) { + val y = (i * height / 15) + drawLine( + color = traceColor, + start = Offset(0f, y), + end = Offset(width, y), + strokeWidth = 2f, + pathEffect = pathEffect + ) + } + + // Vertical traces + for (i in 0..10) { + val x = (i * width / 10) + drawLine( + color = traceColor, + start = Offset(x, 0f), + end = Offset(x, height), + strokeWidth = 2f, + pathEffect = pathEffect + ) + } + + // Draw pads/components (small circles at intersections) + for (i in 0..10 step 2) { + for (j in 0..15 step 3) { + val x = i * width / 10 + val y = j * height / 15 + drawCircle( + color = padColor, + radius = 4f, + center = Offset(x, y) + ) + } + } + + // Draw some resistor-like rectangles + for (i in 1..9 step 4) { + val x = i * width / 10 + val y = height / 2 + drawRect( + color = Color(0xFF2A4A2A), + topLeft = Offset(x - 15f, y - 8f), + size = androidx.compose.ui.geometry.Size(30f, 16f) + ) + // Resistor contacts + drawCircle( + color = padColor, + radius = 3f, + center = Offset(x - 15f, y) + ) + drawCircle( + color = padColor, + radius = 3f, + center = Offset(x + 15f, y) + ) + } + } +} -- cgit v1.2.3-70-g09d2