summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-10-23 21:59:37 -0700
committerElizabeth Hunt <me@liz.coffee>2025-10-24 20:00:58 -0700
commit64f825465de9fa30c4dfe2707067efdb96110db8 (patch)
tree5241385e316e2f4ceede5018603103d71be75202 /composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt
downloadabstraction-engine-kt-64f825465de9fa30c4dfe2707067efdb96110db8.tar.gz
abstraction-engine-kt-64f825465de9fa30c4dfe2707067efdb96110db8.zip
Init
Diffstat (limited to 'composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt')
-rw-r--r--composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/PCBBackground.kt85
1 files changed, 85 insertions, 0 deletions
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)
+ )
+ }
+ }
+}