feat: the in-app logo is the sphinx on black (giza-app-icon, Phase 2)
compose-multiplatform.xml, the mark in the middle of every QR code, is generated from the master: the same shape as before -- a background square, then the mark -- with the old #FF3A1A and black swapped for black and sand. AppLogoDrawableJvmTest samples it where the master is unambiguous, and fails against the drawable it replaces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0cbc9cc52c
commit
554c653d7b
3 files changed
+96
-7
No files matched your search
@@ -1,13 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by docs/scripts/app-icons.py from docs/brand/giza-sphinx.svg. Edit those. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="512dp"
|
||||
android:height="512dp"
|
||||
android:viewportWidth="512"
|
||||
android:viewportHeight="512">
|
||||
<path
|
||||
android:fillColor="#FF3A1A"
|
||||
android:pathData="M0,0 L512,0 L512,512 L0,512 Z"/>
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M246.31,26.00 C244.88,25.74 243.39,26.79 241.55,28.54 C239.71,30.29 236.15,33.14 235.20,36.48 C234.24,39.82 237.67,41.82 235.83,48.55 C233.99,55.29 227.25,68.63 224.08,76.83 C220.90,85.02 218.77,91.18 216.77,97.79 C214.77,104.40 213.21,110.56 212.00,116.54 C210.80,122.51 209.94,131.37 209.46,133.69 C208.99,136.01 209.62,131.47 209.15,130.51 C208.67,129.56 207.02,130.04 206.60,127.97 C206.19,125.91 206.38,121.30 206.60,118.12 C206.83,114.95 206.99,113.20 207.87,108.91 C208.76,104.62 209.37,99.95 212.00,92.39 C214.64,84.83 221.63,69.74 223.76,63.48 C225.89,57.22 224.97,57.29 224.71,54.91 C224.46,52.52 223.06,50.52 222.17,49.19 C221.28,47.85 220.36,47.50 219.31,46.96 C218.26,46.42 217.31,45.95 215.82,46.01 C214.32,46.07 211.91,46.33 210.42,47.28 C208.92,48.23 207.49,50.24 206.92,51.73 C206.35,53.22 206.70,55.16 206.92,56.18 C207.14,57.19 207.49,57.76 208.19,57.76 C208.89,57.76 210.42,55.86 211.05,56.18 C211.69,56.49 213.59,55.92 212.00,59.67 C210.42,63.42 204.63,72.54 201.52,78.73 C198.41,84.93 195.23,92.07 193.26,96.84 C191.29,101.60 191.04,102.33 189.77,107.32 C188.50,112.31 186.18,123.30 185.64,126.70 C185.10,130.10 184.11,127.43 186.59,127.65 C189.07,127.88 197.71,127.65 200.57,127.97 C203.43,128.29 202.57,128.67 203.74,129.56 C204.92,130.45 206.60,132.10 207.56,133.37 C208.51,134.64 209.78,136.14 209.46,137.18 C209.15,138.23 207.08,138.30 205.65,139.73 C204.22,141.16 213.12,143.70 200.89,145.76 C188.66,147.83 147.13,150.46 132.27,152.12 C117.40,153.77 99.16,154.43 111.62,155.61 C124.07,156.79 190.50,158.21 206.92,159.10 C223.35,159.99 208.29,160.37 210.10,161.01 C211.91,161.65 212.39,162.54 217.72,162.92 C223.06,163.30 237.26,162.82 242.18,163.23 C247.11,163.65 245.84,164.25 247.27,165.46 C248.70,166.67 250.28,168.89 250.76,170.54 C251.24,172.19 251.17,173.72 250.13,175.31 C249.08,176.89 246.16,179.05 244.41,180.07 C242.66,181.09 244.63,181.09 239.64,181.34 C234.66,181.60 219.79,181.28 214.55,181.66 C209.30,182.04 210.42,182.61 208.19,183.57 C205.97,184.52 203.49,185.69 201.20,187.38 C198.92,189.06 196.34,191.44 194.53,193.73 C192.72,196.02 191.36,198.88 190.40,201.04 C189.45,203.20 189.13,204.53 188.81,206.76 C188.50,208.98 188.27,211.84 188.50,214.38 C188.72,216.92 189.07,219.30 190.08,222.00 C191.10,224.71 190.50,225.56 194.53,230.58 C198.57,235.60 208.29,244.56 214.23,252.18 C220.17,259.81 224.97,269.50 230.11,276.33 C235.26,283.16 240.98,287.70 245.04,293.17 C249.11,298.63 249.87,302.38 254.57,309.05 C259.28,315.72 270.14,328.59 273.32,333.19 C276.49,337.80 273.86,334.40 273.63,336.69 C273.41,338.97 275.64,334.08 272.05,346.85 C268.46,359.62 257.05,397.14 252.03,413.25 C247.01,429.35 244.63,436.06 241.87,443.43 C239.10,450.80 237.20,454.45 235.51,457.41 C233.83,460.36 233.51,460.11 231.70,461.22 C229.89,462.33 227.09,463.54 224.71,464.08 C222.33,464.62 219.47,464.55 217.41,464.39 C215.34,464.24 214.13,463.35 212.32,463.12 C210.51,462.90 208.03,462.87 206.60,463.12 C205.17,463.38 204.48,464.08 203.74,464.71 C203.01,465.35 203.81,466.36 202.16,466.94 C200.50,467.51 196.03,467.19 193.90,468.21 C191.77,469.22 189.35,472.59 189.45,472.97 C189.54,473.35 193.10,470.84 194.53,470.43 C195.96,470.02 197.55,470.05 198.03,470.43 C198.50,470.81 197.33,472.11 197.39,472.65 C197.45,473.19 197.71,473.45 198.34,473.61 C198.98,473.77 200.41,473.83 201.20,473.61 C202.00,473.39 200.73,472.65 203.11,472.34 C205.49,472.02 213.97,471.07 215.50,471.70 C217.02,472.34 212.96,474.66 212.32,476.15 C211.69,477.64 210.99,480.69 211.69,480.60 C212.39,480.50 214.93,476.21 216.45,475.51 C217.98,474.81 219.79,476.63 220.90,476.47 C222.01,476.31 220.17,475.58 223.12,474.56 C226.08,473.54 233.45,470.91 238.69,470.43 C243.93,469.95 251.56,471.29 254.57,471.70 C257.59,472.11 256.00,472.75 256.80,472.97 C257.59,473.19 258.64,473.19 259.34,472.97 C260.04,472.75 260.67,472.18 260.93,471.70 C261.18,471.22 260.45,470.37 260.93,470.11 C261.40,469.86 262.67,469.64 263.79,470.11 C264.90,470.59 267.22,473.23 267.60,472.97 C267.98,472.72 266.71,469.64 266.01,468.52 C265.31,467.41 264.64,466.71 263.47,466.30 C262.29,465.89 259.97,466.24 259.02,465.98 C258.07,465.73 258.39,464.78 257.75,464.71 C257.12,464.65 256.54,465.67 255.21,465.67 C253.87,465.67 251.30,465.19 249.81,464.71 C248.32,464.24 247.20,463.60 246.31,462.81 C245.42,462.01 244.57,461.76 244.41,459.95 C244.25,458.14 243.84,457.88 245.36,452.01 C246.89,446.13 248.12,441.59 253.62,424.68 C259.12,407.78 273.54,364.71 278.40,350.67 C283.26,336.62 282.15,343.20 282.85,340.50 C283.55,337.80 283.07,336.31 282.53,334.46 C281.99,332.62 280.94,332.88 279.67,329.38 C278.40,325.89 276.72,317.56 274.91,313.50 C273.09,309.43 270.24,307.24 268.87,304.92 C267.50,302.60 264.10,297.04 266.65,299.52 C269.19,302.00 278.34,313.66 284.12,319.85 C289.90,326.05 298.35,332.81 301.27,336.69 C304.20,340.56 301.18,341.07 301.59,343.04 C302.00,345.01 302.64,342.79 303.81,348.44 C304.99,354.10 306.13,359.81 308.58,377.03 C311.03,394.25 317.06,437.77 318.43,451.69 C319.79,465.60 317.70,458.52 3Line truncated
|
||||
android:pathData="M0,0h1024v1024h-1024z"/>
|
||||
<path
|
||||
android:fillColor="#D2AB5E"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M461,859L460,894L511,939L516,936L563,894L562,859ZM463,800L461,849L561,849L562,848L560,800ZM464,741L463,790L560,790L559,741ZM149,736L146,742L169,762L225,838L269,895L247,803L191,763L151,736ZM874,735L815,774L774,803L753,895L755,894L822,806L856,759L864,753L876,741ZM821,620L664,620L607,908L608,908L662,813L722,712L863,712ZM202,620L160,712L301,712L415,908L415,903L412,893L412,888L384,751L384,746L382,741L364,648L357,620ZM688,457L684,513L679,541L680,543L785,543L782,534L746,457ZM277,457L241,534L238,543L341,543L340,541L341,524L338,505L335,458L334,457ZM381,459L353,512L355,514L356,518L382,569L383,578L387,591L387,595L400,649L464,721L559,721L623,649L641,569L670,511L642,459L514,412L504,414ZM649,423L539,381L536,381L516,393L512,394L508,393L490,383L487,383L399,414L396,416L382,420L375,423L382,442L510,395L511,396L514,395L642,442ZM512,212L464,248L496,369L511,377L515,376L530,367L559,249L558,247ZM167,295L155,320L145,345L138,366L130,397L124,433L123,453L122,454L122,500L123,501L124,522L128,548L138,589L153,630L171,666L262,466L269,453L274,440L332,317L335,322L362,410L398,398L370,342L370,340L365,332L350,299L448,249L447,248L448,242L453,236L506,196L512,194L518,196L570,236L575,242L576,245L575,249L673,299L673,301L636,374L626,397L660,410L661,409L689,318L690,317L692,319L781,510L785,521L837,632L852,666L871,628L887,583L895,549L899,522L900,500L901,499L900,442L899,441L898,424L895,406L886,369L870,324L856,295L839,266L816,234L797,212L762,179L739,161L699,136L666,120L622,104L584,95L549,90L538,90L537,89L473,90L439,95L398,105L364,117L324,136L305,147L267,174L244,194L226,212L207,234L179,274Z"/>
|
||||
</vector>
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package mobi.giza.compose.ui.composable.widgets
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toPixelMap
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.captureToImage
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.runDesktopComposeUiTest
|
||||
import androidx.compose.ui.unit.dp
|
||||
import mobi.giza.compose.resources.Res
|
||||
import mobi.giza.compose.resources.compose_multiplatform
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import kotlin.math.abs
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
/**
|
||||
* The in-app logo -- `compose-multiplatform.xml`, drawn in the middle of every QR code and as
|
||||
* the desktop window's icon -- is the sphinx from docs/brand/giza-sphinx.svg on black.
|
||||
*
|
||||
* The drawable is generated (docs/scripts/app-icons.py), and nothing else would notice it
|
||||
* going wrong: a QR code with the wrong mark in it still scans. So this samples it where the
|
||||
* master is unambiguous -- each point sits in the middle of an 11 px patch of one colour in
|
||||
* ImageMagick's 256 px render of the master -- and asks for the master's colour back:
|
||||
*
|
||||
* - sand in the face and in the disc, which a dropped or recoloured mark changes;
|
||||
* - black in a cutout inside the disc (the band between the left lappet's stripes), which a
|
||||
* master whose cutouts filled in changes. Today's master has no nested sub-paths, so its
|
||||
* fill rule does not matter; a redraw that nests them would, and this is where it shows;
|
||||
* - black in the corner, which a dropped background changes.
|
||||
*
|
||||
* The test density is 1, so 256.dp is 256 pixels and the points are the render's own.
|
||||
* See docs/giza-app-icon.md, Phase 2.
|
||||
*/
|
||||
@OptIn(ExperimentalTestApi::class)
|
||||
class AppLogoDrawableJvmTest {
|
||||
|
||||
// The brand's own two colours, which the drawable is checked against.
|
||||
private val sand = Color(0xFFD2AB5E)
|
||||
private val black = Color(0xFF000000)
|
||||
|
||||
private val expected = listOf(
|
||||
Triple("the face", Point(128, 140), sand),
|
||||
Triple("the disc", Point(62, 62), sand),
|
||||
Triple("a cutout inside the disc", Point(61, 146), black),
|
||||
Triple("the corner", Point(10, 10), black),
|
||||
)
|
||||
|
||||
@Test
|
||||
fun `the logo is the sphinx on black`() = runDesktopComposeUiTest(width = 256, height = 256) {
|
||||
setContent {
|
||||
Image(
|
||||
painter = painterResource(Res.drawable.compose_multiplatform),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(256.dp).testTag(Logo),
|
||||
)
|
||||
}
|
||||
|
||||
// A resource painter is empty until the file has been read, which happens off the
|
||||
// composition. Wait for the background to arrive rather than for idleness.
|
||||
waitUntil(timeoutMillis = 10_000) {
|
||||
onNodeWithTag(Logo).captureToImage().toPixelMap()[10, 10].alpha > 0.99f
|
||||
}
|
||||
|
||||
val pixels = onNodeWithTag(Logo).captureToImage().toPixelMap()
|
||||
expected.forEach { (where, at, colour) ->
|
||||
val seen = pixels[at.x, at.y]
|
||||
assertTrue(seen.near(colour), "$where at (${at.x}, ${at.y}): expected $colour, saw $seen")
|
||||
}
|
||||
}
|
||||
|
||||
private data class Point(val x: Int, val y: Int)
|
||||
|
||||
/** Within two 8-bit steps per channel, for antialiasing and colour-space rounding. */
|
||||
private fun Color.near(other: Color) =
|
||||
abs(red - other.red) < 2.5f / 255 &&
|
||||
abs(green - other.green) < 2.5f / 255 &&
|
||||
abs(blue - other.blue) < 2.5f / 255
|
||||
|
||||
private companion object {
|
||||
const val Logo = "logo"
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ dock and ⌘-Tab. `packageDeb` can be checked on this machine; the `.dmg` and `.
|
||||
|---|---|
|
||||
| 0 | done. `giza` merged in (`a4f54ad4`, Android's icon). The master is `docs/brand/giza-sphinx.svg`, the designer's *Transparent Cutouts* file unchanged; its path equals the `pathData` of both `ic_launcher_foreground.xml` and `ic_launcher_monochrome.xml`, 1,567 characters each. Baseline at `e00d0f80`: `jvmTest` 1,407 run, 0 failed, 0 skipped; `m3Audit` all budgets met, adaptive APIs 12 (floor 12), navigation components 2 (floor 2). Measuring the path also showed its thirteen sub-paths are disjoint, so the fill rule is not load-bearing; the facts above say so |
|
||||
| 1 | done. `docs/scripts/app-icons.py`, with `--only ios|desktop|xml`, `--root` (to write somewhere other than the tree) and `--sheet`. Run twice into two scratch roots it wrote byte-identical files. The light icon is RGB with no alpha, the dark RGBA, the tinted grayscale; the `.ico` holds eight entries, 256 as PNG; the `.icns` parses as eight PNG chunks, `ic07`–`ic14`, with the sizes the table names. The contact sheet left 0.68 and 0.80 as they were: the stripes stay apart down to 32 px and merge, as expected, at 16 |
|
||||
| 2 | not started |
|
||||
| 2 | built. `compose-multiplatform.xml` is generated (`--only xml`): a black square and the sand mark, with a comment naming the script and the master. `AppLogoDrawableJvmTest` passes, and fails at line 54 when the previous drawable is put back. **Not yet checked:** a phone camera reading a QR code with the new logo, in light and dark theme — the logo covers the same share of the code as before |
|
||||
| 3 | not started |
|
||||
| 4 | not started |
|
||||
| 5 | not started |
|
||||
Reference in new issue
Block a user