Update watch face: modular refactor + OWM/Solar/background + codegen tools
- Split render into FieldTable/Fields/Icons/Layout/Settings modules - Add Fenix8V3Background, Owm (weather), Solar modules - Add tools/ generators (gen_fields/gen_icons/gen_themes/gen_preview_svg) - Tune README/manifest/strings/settings
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rasterise the design's icon paths into tintable bitmap resources.
|
||||
"""把设计稿的图标路径光栅化成可染色的位图资源。
|
||||
|
||||
The sunrise and weather icons in design/*.svg are traced outlines whose finest
|
||||
features are two or three design pixels across. Redrawing them from circles
|
||||
and lines works at 454 px and falls apart at 280 px, where those features land
|
||||
under one device pixel. Rendering the real paths once per screen size and
|
||||
blitting them with drawBitmap2(:tintColor) keeps them exact everywhere.
|
||||
design/*.svg 里的日出和天气图标是描边出来的轮廓,最细的特征只有 2–3 个设计
|
||||
像素宽。用圆和线段去重画它们在 454px 上还行,到 280px 就彻底糊掉 —— 那个尺寸
|
||||
下这些细节不足一个物理像素。
|
||||
|
||||
所以改成:把真实路径按每种屏宽各渲染一次,运行时用
|
||||
drawBitmap2(:tintColor) 染上主题色。这样每台设备拿到的都是为它的像素网格
|
||||
专门渲染的图。
|
||||
|
||||
python3 tools/gen_icons.py
|
||||
|
||||
Writes resources-icons-<W>/drawables/{sunrise,sunset,weather}.png plus the
|
||||
matching drawables.xml. White pixels, alpha coverage; the theme's accent
|
||||
colour is applied at draw time via :tintColor.
|
||||
产出 resources-icons-<屏宽>/drawables/{sunrise,sunset,weather}.png 以及配套的
|
||||
drawables.xml;另外产出 resources-launcher-<尺寸>/ 下各机型要求尺寸的启动图标。
|
||||
|
||||
MIP devices have no alpha blending, so for those widths the coverage mask is
|
||||
thresholded to hard edges rather than left antialiased -- a soft edge there
|
||||
would be quantised to something muddier than a clean one.
|
||||
⚠️ 两个要点:
|
||||
1. drawables.xml 里必须写 packingFormat="png"。否则资源编译器会把图片压成
|
||||
调色板格式,而 :tintColor 拒绝调色板化的源,运行时直接抛异常。
|
||||
2. MIP 屏没有 alpha 混合,所以那几个尺寸的覆盖率蒙版会被阈值化成硬边 ——
|
||||
软边在 64 色调色板下反而更脏。
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
Reference in New Issue
Block a user