|
| 1 | +package org.schabi.newpipe.util.image |
| 2 | + |
| 3 | +import androidx.compose.foundation.Image |
| 4 | +import androidx.compose.foundation.layout.Arrangement |
| 5 | +import androidx.compose.foundation.layout.Column |
| 6 | +import androidx.compose.foundation.layout.height |
| 7 | +import androidx.compose.foundation.layout.width |
| 8 | +import androidx.compose.runtime.Composable |
| 9 | +import androidx.compose.ui.Alignment |
| 10 | +import androidx.compose.ui.Modifier |
| 11 | +import androidx.compose.ui.graphics.Color |
| 12 | +import androidx.compose.ui.graphics.SolidColor |
| 13 | +import androidx.compose.ui.graphics.vector.ImageVector |
| 14 | +import androidx.compose.ui.graphics.vector.path |
| 15 | +import androidx.compose.ui.tooling.preview.Preview |
| 16 | +import androidx.compose.ui.unit.dp |
| 17 | + |
| 18 | +/** |
| 19 | + * Generated with https://github.com/rafaeltonholo/svg-to-compose/ |
| 20 | + * based on assets/newpipe_squircle.svg. |
| 21 | + */ |
| 22 | +val NewPipeSquircleIcon: ImageVector |
| 23 | + get() { |
| 24 | + val current = _newPipeIcon |
| 25 | + if (current != null) return current |
| 26 | + |
| 27 | + return ImageVector.Builder( |
| 28 | + name = "org.schabi.newpipe.ui.theme.AppTheme.NewPipeSquircleIcon", |
| 29 | + defaultWidth = 100.0.dp, |
| 30 | + defaultHeight = 100.0.dp, |
| 31 | + viewportWidth = 100.0f, |
| 32 | + viewportHeight = 100.0f, |
| 33 | + ).apply { |
| 34 | + // M0 50 C0 15 15 0 50 0 s50 15 50 50 -15 50 -50 50 S0 85 0 50 |
| 35 | + path( |
| 36 | + fill = SolidColor(Color(0xFFCD201F)), |
| 37 | + ) { |
| 38 | + // M 0 50 |
| 39 | + moveTo(x = 0.0f, y = 50.0f) |
| 40 | + // C 0 15 15 0 50 0 |
| 41 | + curveTo( |
| 42 | + x1 = 0.0f, |
| 43 | + y1 = 15.0f, |
| 44 | + x2 = 15.0f, |
| 45 | + y2 = 0.0f, |
| 46 | + x3 = 50.0f, |
| 47 | + y3 = 0.0f, |
| 48 | + ) |
| 49 | + // s 50 15 50 50 |
| 50 | + reflectiveCurveToRelative( |
| 51 | + dx1 = 50.0f, |
| 52 | + dy1 = 15.0f, |
| 53 | + dx2 = 50.0f, |
| 54 | + dy2 = 50.0f, |
| 55 | + ) |
| 56 | + // s -15 50 -50 50 |
| 57 | + reflectiveCurveToRelative( |
| 58 | + dx1 = -15.0f, |
| 59 | + dy1 = 50.0f, |
| 60 | + dx2 = -50.0f, |
| 61 | + dy2 = 50.0f, |
| 62 | + ) |
| 63 | + // S 0 85 0 50 |
| 64 | + reflectiveCurveTo( |
| 65 | + x1 = 0.0f, |
| 66 | + y1 = 85.0f, |
| 67 | + x2 = 0.0f, |
| 68 | + y2 = 50.0f, |
| 69 | + ) |
| 70 | + } |
| 71 | + // M31.7 19.2 v61.7 l9.7 -5.73 V36 l23.8 14 -17.6 10.35 V71.5 L84 50 |
| 72 | + path( |
| 73 | + fill = SolidColor(Color(0xFFFFFFFF)), |
| 74 | + ) { |
| 75 | + // M 31.7 19.2 |
| 76 | + moveTo(x = 31.7f, y = 19.2f) |
| 77 | + // v 61.7 |
| 78 | + verticalLineToRelative(dy = 61.7f) |
| 79 | + // l 9.7 -5.73 |
| 80 | + lineToRelative(dx = 9.7f, dy = -5.73f) |
| 81 | + // V 36 |
| 82 | + verticalLineTo(y = 36.0f) |
| 83 | + // l 23.8 14 |
| 84 | + lineToRelative(dx = 23.8f, dy = 14.0f) |
| 85 | + // l -17.6 10.35 |
| 86 | + lineToRelative(dx = -17.6f, dy = 10.35f) |
| 87 | + // V 71.5 |
| 88 | + verticalLineTo(y = 71.5f) |
| 89 | + // L 84 50 |
| 90 | + lineTo(x = 84.0f, y = 50.0f) |
| 91 | + } |
| 92 | + }.build().also { _newPipeIcon = it } |
| 93 | + } |
| 94 | + |
| 95 | +@Preview |
| 96 | +@Composable |
| 97 | +private fun IconPreview() { |
| 98 | + org.schabi.newpipe.ui.theme.AppTheme { |
| 99 | + Column( |
| 100 | + verticalArrangement = Arrangement.spacedBy(8.dp), |
| 101 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 102 | + ) { |
| 103 | + Image( |
| 104 | + imageVector = NewPipeSquircleIcon, |
| 105 | + contentDescription = null, |
| 106 | + modifier = Modifier |
| 107 | + .width((100.0).dp) |
| 108 | + .height((100.0).dp), |
| 109 | + ) |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +@Suppress("ObjectPropertyName") |
| 115 | +private var _newPipeIcon: ImageVector? = null |
0 commit comments