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) ) } } }