Claude paints with code: a Claude Code skill for procedural illustration in 83 styles, from ink wash (水墨), watercolour and ukiyo-e to stained glass, Roman mosaic, Art Deco, shadow puppets, pastel UI, sketchbook doodles, spot illustrations, grainy picture books, dreamy hills, sunlit greenery. No image model: numpy + Pillow on a CPU, draw-on GIFs.
Python agent-skillsanimechinese-paintingclaudeclaude-codeclaude-skillscolored-pencilcreative-codingcross-stitcheditorial-illustrationgenerative-artink-wash-paintingoil-paintingpaper-collagepixel-artprocedural-generationrisographshanshuiukiyo-ewatercolor
Add warm pencil storybook style (74 total): a giant tortoise crossing the stream
cloveric24418f3f6196
diff --git a/README.md b/README.mdindex c8fb52e..05361bc 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@# Claude Drawing · Claude 绘图-**Claude paints with code — no image model.** Seventy-three styles, from ink wash and impasto oil to clay, cyanotype, stained glass, a Roman mosaic, Delft tiles, a cyberpunk street, a ray-traced ball pit, low-poly 3D, a thermal camera, an X-ray, a VHS tape, a synthwave sunset, a pastel product-film UI, an answer sheet marked in red, a lamp-lit shadow-puppet play, pen-and-wash sketch cards, retro gouache picture-book portraits, a soft-blue picture-book spread, a Jiangnan water garden in spring, a dry-brushed mid-century poster, a dusk picture-book page where the sky turns to stars, a hatched night print of lava meeting the sea, a dark note-taking app rendering its diagram, an infinite canvas of cards and a five-diagram sheet on warm Flexoki paper.-**不用生图模型,Claude 用代码一笔一笔作画。** 七十三种画风,从水墨、油画到黏土、蓝晒、彩色玻璃花窗、罗马马赛克、代尔夫特蓝瓷砖、赛博朋克、光线追踪的小球海、低多边形 3D、热成像、X 光片、VHS 录像带、Synthwave 落日、产品发布片式的粉彩界面、红笔批改的答题卡、油灯下的皮影戏、钢笔淡彩的速写小卡、复古水粉的绘本大头像、蓝调绘本的雨天跨页、江南园林的春水园景、干刷色块的 mid-century 海报、暮色微缩绘本里转入星空的黄昏、排线夜景里流进海里的熔岩、深色笔记应用里渲染出的流程图、卡片铺开的无限白板和 Flexoki 暖纸上的五图图解。+**Claude paints with code — no image model.** Seventy-four styles, from ink wash and impasto oil to clay, cyanotype, stained glass, a Roman mosaic, Delft tiles, a cyberpunk street, a ray-traced ball pit, low-poly 3D, a thermal camera, an X-ray, a VHS tape, a synthwave sunset, a pastel product-film UI, an answer sheet marked in red, a lamp-lit shadow-puppet play, pen-and-wash sketch cards, retro gouache picture-book portraits, a soft-blue picture-book spread, a Jiangnan water garden in spring, a dry-brushed mid-century poster, a dusk picture-book page where the sky turns to stars, a hatched night print of lava meeting the sea, a dark note-taking app rendering its diagram, an infinite canvas of cards, a five-diagram sheet on warm Flexoki paper and a warm coloured-pencil storybook spread.+**不用生图模型,Claude 用代码一笔一笔作画。** 七十四种画风,从水墨、油画到黏土、蓝晒、彩色玻璃花窗、罗马马赛克、代尔夫特蓝瓷砖、赛博朋克、光线追踪的小球海、低多边形 3D、热成像、X 光片、VHS 录像带、Synthwave 落日、产品发布片式的粉彩界面、红笔批改的答题卡、油灯下的皮影戏、钢笔淡彩的速写小卡、复古水粉的绘本大头像、蓝调绘本的雨天跨页、江南园林的春水园景、干刷色块的 mid-century 海报、暮色微缩绘本里转入星空的黄昏、排线夜景里流进海里的熔岩、深色笔记应用里渲染出的流程图、卡片铺开的无限白板、Flexoki 暖纸上的五图图解和暖调彩铅叠出来的绘本跨页。[English](#english) · [中文](#中文)@@ -56,6 +56,8 @@|  |  |  || **Obsidian UI · 笔记应用界面** | **Canvas board · 白板卡片** | **Flexoki paper · Flexoki 纸面** ||  |  |  |+| **Warm pencil storybook · 暖调彩铅绘本** | **Ink wash · 水墨(月印万川)** | **Watercolour · 水彩(底纹)** |+|  |  |  |### Gallery · 画廊@@ -63,78 +65,80 @@|---|---|| **八万四千法门** · *Many Paths, One Summit*<br><sub>Ink wash · 水墨</sub> | **月印万川** · *One Moon in Ten Thousand Rivers*<br><sub>Ink wash · 水墨</sub> || <img src="examples/bawansiqian.jpg" width="100%"> | <img src="examples/moon_river.jpg" width="100%"> |-| **秋日湖畔** · *Autumn Lake*<br><sub>Watercolour · 水彩</sub> | **热气球小镇** · *Balloon Day*<br><sub>Paper collage · 剪纸拼贴</sub> |-| <img src="examples/watercolor_autumn.jpg" width="100%"> | <img src="examples/papercut_balloons.jpg" width="100%"> |-| **午后甜点** · *Afternoon Dessert*<br><sub>Coloured pencil · 韩国彩铅</sub> | **夏空** · *Summer Sky*<br><sub>Anime · 日本动漫</sub> |-| <img src="examples/colorpencil_dessert.jpg" width="100%"> | <img src="examples/anime_summer.jpg" width="100%"> |-| **灵感生长** · *Growing Ideas*<br><sub>Editorial · 编辑风手绘</sub> | **麦田星空** · *Swirling Sky over the Wheat Field*<br><sub>Impasto oil · 油画厚涂</sub> |-| <img src="examples/editorial_ideas.jpg" width="100%"> | <img src="examples/oil_wheatfield.jpg" width="100%"> |-| **富士曙** · *Fuji at Dawn*<br><sub>Ukiyo-e · 浮世绘</sub> | **雨夜咖啡店** · *Rainy Night Cafe*<br><sub>Pixel art · 像素风</sub> |-| <img src="examples/ukiyoe_fuji.jpg" width="100%"> | <img src="examples/pixel_rainy_cafe.png" width="100%"> |-| **灯塔岛** · *Lighthouse Island*<br><sub>Stop-motion clay · 黏土定格</sub> | **蓝晒植物** · *Sun-Print Botanicals*<br><sub>Cyanotype · 蓝晒</sub> |-| <img src="examples/clay_lighthouse.jpg" width="100%"> | <img src="examples/cyanotype_botanicals.jpg" width="100%"> |-| **家** · *Home Sampler*<br><sub>Cross-stitch · 十字绣</sub> | **Aurora 64 收音机** · *Aurora 64 Radio*<br><sub>Vintage instrument panel · 复古仪器面板</sub> |-| <img src="examples/stitch_sampler.jpg" width="100%"> | <img src="examples/panel_radio.jpg" width="100%"> |-| **周末市集** · *Weekend Market*<br><sub>Sticker collage × receipt · 贴纸拼贴 · 小票</sub> | **咖啡萃取实验** · *Coffee Brewing Experiment*<br><sub>Lab notebook × stickers · 实验笔记本 · 贴纸</sub> |-| <img src="examples/sticker_market.jpg" width="100%"> | <img src="examples/notebook_brewing.jpg" width="100%"> |-| **为什么天空是蓝的** · *Why Is the Sky Blue?*<br><sub>Chalkboard · 黑板板书</sub> | **霓虹不夜城** · *Neon District*<br><sub>Cyberpunk · 赛博朋克</sub> |-| <img src="examples/chalk_lesson.jpg" width="100%"> | <img src="examples/cyberpunk_neon_street.jpg" width="100%"> |-| **早安吐司** · *Good Morning, Toast*<br><sub>Hand-drawn cartoon · 卡通手绘</sub> | **岛上的气象站** · *Island Weather Station*<br><sub>Isometric 2.5D · 等轴 2.5D</sub> |-| <img src="examples/cartoon_toaster.jpg" width="100%"> | <img src="examples/isometric_weather_island.jpg" width="100%"> |-| **从这扇窗到那扇窗** · *From Window to Window*<br><sub>Continuous line art · 单线画</sub> | **浮出** · *Rise*<br><sub>Soft 3D · 柔光 3D</sub> |-| <img src="examples/lineart_paper_plane.jpg" width="100%"> | <img src="examples/soft3d_rise.jpg" width="100%"> |-| **一滴水的旅程** · *A Drop's Round Trip*<br><sub>Shape morph · 形变动画</sub> | **好奇心周刊 · 拆开看看** · *Curiosity Weekly · Take It Apart*<br><sub>Newspaper collage · 报刊拼贴</sub> |-| <img src="examples/morph_water_cycle.jpg" width="100%"> | <img src="examples/newscollage_curiosity.jpg" width="100%"> |-| **晨间计划** · *Morning Plan*<br><sub>Aurora glassmorphism · 弥散玻璃</sub> | **形与色** · *Form & Colour*<br><sub>Bauhaus geometric · 包豪斯几何</sub> |-| <img src="examples/aurora_morning.jpg" width="100%"> | <img src="examples/bauhaus_form_colour.jpg" width="100%"> |-| **海岸线 1987** · *Coastline 1987*<br><sub>Retro synthwave · 复古 Synthwave</sub> | **草莓杯垫** · *Strawberry Coaster*<br><sub>Perler beads · 拼豆</sub> |-| <img src="examples/synthwave_coastline.jpg" width="100%"> | <img src="examples/perler_strawberry_coaster.jpg" width="100%"> |-| **迁徙季** · *Migration Season*<br><sub>Petroglyph · 岩画</sub> | **尼罗河丰收** · *Harvest on the Nile*<br><sub>Egyptian tomb painting · 古埃及墓室壁画</sub> |-| <img src="examples/petroglyph_migration.jpg" width="100%"> | <img src="examples/tomb_harvest.jpg" width="100%"> |-| **港口渔获** · *The Day's Catch*<br><sub>Roman mosaic · 罗马马赛克</sub> | **四季之窗** · *Window of the Seasons*<br><sub>Stained glass · 彩色玻璃花窗</sub> |-| <img src="examples/mosaic_harbor.jpg" width="100%"> | <img src="examples/stainedglass_seasons.jpg" width="100%"> |-| **星辰之书** · *Liber Stellarum*<br><sub>Illuminated manuscript · 泥金手抄本</sub> | **扑翼机** · *The Ornithopter*<br><sub>Leonardo codex · 达·芬奇手稿</sub> |-| <img src="examples/illuminated_starchart.jpg" width="100%"> | <img src="examples/codex_ornithopter.jpg" width="100%"> |-| **剪影小像** · *Shades of the Wren Household*<br><sub>Silhouette · 剪影</sub> | **马戏团来了** · *The Circus Is Coming*<br><sub>Letterpress poster · 凸版印刷海报</sub> |-| <img src="examples/silhouette_family.jpg" width="100%"> | <img src="examples/letterpress_circus.jpg" width="100%"> |-| **无线电** · *Radio*<br><sub>Soviet constructivism · 苏联构成主义</sub> | **夜行快车** · *Night Express*<br><sub>Art Deco · 装饰艺术</sub> |-| <img src="examples/constructivism_radio.jpg" width="100%"> | <img src="examples/artdeco_express.jpg" width="100%"> |-| **火箭小队** · *Rocket Squad*<br><sub>Golden-age comic · 黄金时代漫画</sub> | **猫的六种心情** · *Six Moods of a Cat*<br><sub>Pop silkscreen · 波普丝网</sub> |-| <img src="examples/comic_rocket.jpg" width="100%"> | <img src="examples/popart_cat_moods.jpg" width="100%"> |-| **发射记录** · *Liftoff Trace*<br><sub>ASCII art (line printer) · ASCII 字符画(行式打印机)</sub> | **峡谷飞行** · *Canyon Run*<br><sub>Low poly · 低多边形</sub> |-| <img src="examples/lineprinter_launch.jpg" width="100%"> | <img src="examples/lowpoly_canyon.jpg" width="100%"> |-| **放风筝** · *Hold On*<br><sub>Stencil graffiti · 喷漆模板涂鸦</sub> | **三晚露营** · *Three Nights Out*<br><sub>Embroidered patches · 刺绣徽章</sub> |-| <img src="examples/stencil_kite.jpg" width="100%"> | <img src="examples/patch_camping.jpg" width="100%"> |-| **灯塔剖面** · *Halvard Rock Light*<br><sub>Blueprint · 蓝图工程图</sub> | **我的周末** · *My Weekend*<br><sub>Children's crayon · 儿童蜡笔画</sub> |-| <img src="examples/blueprint_lighthouse.jpg" width="100%"> | <img src="examples/crayon_picnic.jpg" width="100%"> |-| **今天带伞吗** · *Bring an Umbrella?*<br><sub>Green-screen CRT terminal · 绿屏终端(荧光字符画)</sub> | **厨房里的温度** · *Kitchen Heat Map*<br><sub>Thermal camera · 热成像</sub> |-| <img src="examples/crt_weather.jpg" width="100%"> | <img src="examples/thermal_kitchen.jpg" width="100%"> |-| **一阵风** · *The Gust*<br><sub>Delft tiles · 代尔夫特蓝瓷砖</sub> | **篝火旁的岩洞** · *The Hunt by the Fire*<br><sub>Cave painting · 洞穴壁画</sub> |-| <img src="examples/delft_canal.jpg" width="100%"> | <img src="examples/cave_hunt.jpg" width="100%"> |-| **窗台花园** · *Windowsill Garden*<br><sub>1-bit paint program · 1-bit 早期画图软件</sub> | **赛跑与赛车** · *Games on a Vase*<br><sub>Greek black-figure vase · 古希腊黑绘陶瓶</sub> |-| <img src="examples/macpaint_garden.jpg" width="100%"> | <img src="examples/blackfigure_games.jpg" width="100%"> |-| **老街角的自行车** · *The Bread Run*<br><sub>Graphite pencil · 铅笔素描</sub> | **行李安检** · *Security Check*<br><sub>X-ray · X 光片</sub> |-| <img src="examples/graphite_bicycle.jpg" width="100%"> | <img src="examples/xray_luggage.jpg" width="100%"> |-| **早晨的闹钟** · *Seven O'Clock*<br><sub>1930s rubber hose · 1930 年代黑白橡皮管动画</sub> | **雪夜归途** · *Homeward, First Snow*<br><sub>Linocut · 黑白麻胶版画</sub> |-| <img src="examples/rubberhose_morning.jpg" width="100%"> | <img src="examples/linocut_snowy_village.jpg" width="100%"> |-| **吹蜡烛** · *Blow Out the Candles*<br><sub>VHS home video · VHS 家庭录像</sub> | **山间夜营** · *Night Camp*<br><sub>Flat vector · 扁平矢量</sub> |-| <img src="examples/vhs_birthday.jpg" width="100%"> | <img src="examples/flatvector_night_camp.jpg" width="100%"> |-| **小橡果的秋天** · *An Acorn's Autumn*<br><sub>Storybook animation · 绘本角色动画</sub> | **蛇梯棋大冒险** · *Snakes & Ladders, Round 7*<br><sub>Ballpoint doodle · 圆珠笔涂鸦</sub> |-| <img src="examples/storybook_acorn.jpg" width="100%"> | <img src="examples/ballpoint_board_game.jpg" width="100%"> |-| **海港步行图** · *Larkhaven on Foot*<br><sub>Overlay sheets · 描图纸叠层</sub> | **出发前,再查一遍行李** · *Pack Check*<br><sub>Pastel UI · 粉彩界面</sub> |-| <img src="examples/overlay_city_map.jpg" width="100%"> | <img src="examples/pastelui_packing.jpg" width="100%"> |-| **数学单元测验** · *Unit Test, Graded*<br><sub>Exam grading · 阅卷批改</sub> | **蹴鞠** · *Cuju by Lamplight*<br><sub>Shadow puppetry · 皮影戏</sub> |-| <img src="examples/grading_math_quiz.jpg" width="100%"> | <img src="examples/shadowpuppet_cuju.jpg" width="100%"> |-| **街角速写** · *Sketchbook Neighbours*<br><sub>Pen & wash · 钢笔淡彩</sub> | **雨天三人像** · *Rainy-Day Portraits*<br><sub>Retro gouache · 复古水粉</sub> |-| <img src="examples/penwash_neighbours.jpg" width="100%"> | <img src="examples/gouache_rainy_day.jpg" width="100%"> |-| **借伞** · *The Shared Umbrella*<br><sub>Blue picture book · 蓝调绘本</sub> | **春水园林** · *Spring Water Garden*<br><sub>Jiangnan garden · 江南园林</sub> |-| <img src="examples/bluebook_shared_umbrella.jpg" width="100%"> | <img src="examples/jiangnan_spring_water.jpg" width="100%"> |-| **面馆** · *Noodle Counter*<br><sub>Dry-brush blocks · 干刷色块</sub> | **夜的边上** · *The Kite at the Edge of Night*<br><sub>Twilight storybook · 暮色微缩绘本</sub> |-| <img src="examples/drybrush_noodle_counter.jpg" width="100%"> | <img src="examples/twilight_paper_kite.jpg" width="100%"> |-| **熔岩入海** · *Lava Meets the Sea*<br><sub>Hatched nocturne · 排线夜景</sub> | **小王子 · 读书笔记** · *Reading Notes*<br><sub>Obsidian UI · 笔记应用界面</sub> |-| <img src="examples/nocturne_lava_sea.jpg" width="100%"> | <img src="examples/obsidianui_reading_notes.jpg" width="100%"> |-| **搬家计划** · *Moving Plan*<br><sub>Canvas board · 白板卡片</sub> | **一杯手冲咖啡** · *Pour-over, in Five Diagrams*<br><sub>Flexoki paper · Flexoki 纸面</sub> |-| <img src="examples/canvasboard_moving_plan.jpg" width="100%"> | <img src="examples/flexoki_pour_over.jpg" width="100%"> |+| **秋日湖畔** · *Autumn Lake*<br><sub>Watercolour · 水彩</sub> | **水彩底纹** · *Watercolour Washes*<br><sub>Watercolour · 水彩 — a background for explainer videos · 讲解视频的背景</sub> |+| <img src="examples/watercolor_autumn.jpg" width="100%"> | <img src="examples/watercolor_washes.jpg" width="100%"> |+| **热气球小镇** · *Balloon Day*<br><sub>Paper collage · 剪纸拼贴</sub> | **午后甜点** · *Afternoon Dessert*<br><sub>Coloured pencil · 韩国彩铅</sub> |+| <img src="examples/papercut_balloons.jpg" width="100%"> | <img src="examples/colorpencil_dessert.jpg" width="100%"> |+| **夏空** · *Summer Sky*<br><sub>Anime · 日本动漫</sub> | **灵感生长** · *Growing Ideas*<br><sub>Editorial · 编辑风手绘</sub> |+| <img src="examples/anime_summer.jpg" width="100%"> | <img src="examples/editorial_ideas.jpg" width="100%"> |+| **麦田星空** · *Swirling Sky over the Wheat Field*<br><sub>Impasto oil · 油画厚涂</sub> | **富士曙** · *Fuji at Dawn*<br><sub>Ukiyo-e · 浮世绘</sub> |+| <img src="examples/oil_wheatfield.jpg" width="100%"> | <img src="examples/ukiyoe_fuji.jpg" width="100%"> |+| **雨夜咖啡店** · *Rainy Night Cafe*<br><sub>Pixel art · 像素风</sub> | **灯塔岛** · *Lighthouse Island*<br><sub>Stop-motion clay · 黏土定格</sub> |+| <img src="examples/pixel_rainy_cafe.png" width="100%"> | <img src="examples/clay_lighthouse.jpg" width="100%"> |+| **蓝晒植物** · *Sun-Print Botanicals*<br><sub>Cyanotype · 蓝晒</sub> | **家** · *Home Sampler*<br><sub>Cross-stitch · 十字绣</sub> |+| <img src="examples/cyanotype_botanicals.jpg" width="100%"> | <img src="examples/stitch_sampler.jpg" width="100%"> |+| **Aurora 64 收音机** · *Aurora 64 Radio*<br><sub>Vintage instrument panel · 复古仪器面板</sub> | **周末市集** · *Weekend Market*<br><sub>Sticker collage × receipt · 贴纸拼贴 · 小票</sub> |+| <img src="examples/panel_radio.jpg" width="100%"> | <img src="examples/sticker_market.jpg" width="100%"> |+| **咖啡萃取实验** · *Coffee Brewing Experiment*<br><sub>Lab notebook × stickers · 实验笔记本 · 贴纸</sub> | **为什么天空是蓝的** · *Why Is the Sky Blue?*<br><sub>Chalkboard · 黑板板书</sub> |+| <img src="examples/notebook_brewing.jpg" width="100%"> | <img src="examples/chalk_lesson.jpg" width="100%"> |+| **霓虹不夜城** · *Neon District*<br><sub>Cyberpunk · 赛博朋克</sub> | **早安吐司** · *Good Morning, Toast*<br><sub>Hand-drawn cartoon · 卡通手绘</sub> |+| <img src="examples/cyberpunk_neon_street.jpg" width="100%"> | <img src="examples/cartoon_toaster.jpg" width="100%"> |+| **岛上的气象站** · *Island Weather Station*<br><sub>Isometric 2.5D · 等轴 2.5D</sub> | **从这扇窗到那扇窗** · *From Window to Window*<br><sub>Continuous line art · 单线画</sub> |+| <img src="examples/isometric_weather_island.jpg" width="100%"> | <img src="examples/lineart_paper_plane.jpg" width="100%"> |+| **浮出** · *Rise*<br><sub>Soft 3D · 柔光 3D</sub> | **一滴水的旅程** · *A Drop's Round Trip*<br><sub>Shape morph · 形变动画</sub> |+| <img src="examples/soft3d_rise.jpg" width="100%"> | <img src="examples/morph_water_cycle.jpg" width="100%"> |+| **好奇心周刊 · 拆开看看** · *Curiosity Weekly · Take It Apart*<br><sub>Newspaper collage · 报刊拼贴</sub> | **晨间计划** · *Morning Plan*<br><sub>Aurora glassmorphism · 弥散玻璃</sub> |+| <img src="examples/newscollage_curiosity.jpg" width="100%"> | <img src="examples/aurora_morning.jpg" width="100%"> |+| **形与色** · *Form & Colour*<br><sub>Bauhaus geometric · 包豪斯几何</sub> | **海岸线 1987** · *Coastline 1987*<br><sub>Retro synthwave · 复古 Synthwave</sub> |+| <img src="examples/bauhaus_form_colour.jpg" width="100%"> | <img src="examples/synthwave_coastline.jpg" width="100%"> |+| **草莓杯垫** · *Strawberry Coaster*<br><sub>Perler beads · 拼豆</sub> | **迁徙季** · *Migration Season*<br><sub>Petroglyph · 岩画</sub> |+| <img src="examples/perler_strawberry_coaster.jpg" width="100%"> | <img src="examples/petroglyph_migration.jpg" width="100%"> |+| **尼罗河丰收** · *Harvest on the Nile*<br><sub>Egyptian tomb painting · 古埃及墓室壁画</sub> | **港口渔获** · *The Day's Catch*<br><sub>Roman mosaic · 罗马马赛克</sub> |+| <img src="examples/tomb_harvest.jpg" width="100%"> | <img src="examples/mosaic_harbor.jpg" width="100%"> |+| **四季之窗** · *Window of the Seasons*<br><sub>Stained glass · 彩色玻璃花窗</sub> | **星辰之书** · *Liber Stellarum*<br><sub>Illuminated manuscript · 泥金手抄本</sub> |+| <img src="examples/stainedglass_seasons.jpg" width="100%"> | <img src="examples/illuminated_starchart.jpg" width="100%"> |+| **扑翼机** · *The Ornithopter*<br><sub>Leonardo codex · 达·芬奇手稿</sub> | **剪影小像** · *Shades of the Wren Household*<br><sub>Silhouette · 剪影</sub> |+| <img src="examples/codex_ornithopter.jpg" width="100%"> | <img src="examples/silhouette_family.jpg" width="100%"> |+| **马戏团来了** · *The Circus Is Coming*<br><sub>Letterpress poster · 凸版印刷海报</sub> | **无线电** · *Radio*<br><sub>Soviet constructivism · 苏联构成主义</sub> |+| <img src="examples/letterpress_circus.jpg" width="100%"> | <img src="examples/constructivism_radio.jpg" width="100%"> |+| **夜行快车** · *Night Express*<br><sub>Art Deco · 装饰艺术</sub> | **火箭小队** · *Rocket Squad*<br><sub>Golden-age comic · 黄金时代漫画</sub> |+| <img src="examples/artdeco_express.jpg" width="100%"> | <img src="examples/comic_rocket.jpg" width="100%"> |+| **猫的六种心情** · *Six Moods of a Cat*<br><sub>Pop silkscreen · 波普丝网</sub> | **发射记录** · *Liftoff Trace*<br><sub>ASCII art (line printer) · ASCII 字符画(行式打印机)</sub> |+| <img src="examples/popart_cat_moods.jpg" width="100%"> | <img src="examples/lineprinter_launch.jpg" width="100%"> |+| **峡谷飞行** · *Canyon Run*<br><sub>Low poly · 低多边形</sub> | **放风筝** · *Hold On*<br><sub>Stencil graffiti · 喷漆模板涂鸦</sub> |+| <img src="examples/lowpoly_canyon.jpg" width="100%"> | <img src="examples/stencil_kite.jpg" width="100%"> |+| **三晚露营** · *Three Nights Out*<br><sub>Embroidered patches · 刺绣徽章</sub> | **灯塔剖面** · *Halvard Rock Light*<br><sub>Blueprint · 蓝图工程图</sub> |+| <img src="examples/patch_camping.jpg" width="100%"> | <img src="examples/blueprint_lighthouse.jpg" width="100%"> |+| **我的周末** · *My Weekend*<br><sub>Children's crayon · 儿童蜡笔画</sub> | **今天带伞吗** · *Bring an Umbrella?*<br><sub>Green-screen CRT terminal · 绿屏终端(荧光字符画)</sub> |+| <img src="examples/crayon_picnic.jpg" width="100%"> | <img src="examples/crt_weather.jpg" width="100%"> |+| **厨房里的温度** · *Kitchen Heat Map*<br><sub>Thermal camera · 热成像</sub> | **一阵风** · *The Gust*<br><sub>Delft tiles · 代尔夫特蓝瓷砖</sub> |+| <img src="examples/thermal_kitchen.jpg" width="100%"> | <img src="examples/delft_canal.jpg" width="100%"> |+| **篝火旁的岩洞** · *The Hunt by the Fire*<br><sub>Cave painting · 洞穴壁画</sub> | **窗台花园** · *Windowsill Garden*<br><sub>1-bit paint program · 1-bit 早期画图软件</sub> |+| <img src="examples/cave_hunt.jpg" width="100%"> | <img src="examples/macpaint_garden.jpg" width="100%"> |+| **赛跑与赛车** · *Games on a Vase*<br><sub>Greek black-figure vase · 古希腊黑绘陶瓶</sub> | **老街角的自行车** · *The Bread Run*<br><sub>Graphite pencil · 铅笔素描</sub> |+| <img src="examples/blackfigure_games.jpg" width="100%"> | <img src="examples/graphite_bicycle.jpg" width="100%"> |+| **行李安检** · *Security Check*<br><sub>X-ray · X 光片</sub> | **早晨的闹钟** · *Seven O'Clock*<br><sub>1930s rubber hose · 1930 年代黑白橡皮管动画</sub> |+| <img src="examples/xray_luggage.jpg" width="100%"> | <img src="examples/rubberhose_morning.jpg" width="100%"> |+| **雪夜归途** · *Homeward, First Snow*<br><sub>Linocut · 黑白麻胶版画</sub> | **吹蜡烛** · *Blow Out the Candles*<br><sub>VHS home video · VHS 家庭录像</sub> |+| <img src="examples/linocut_snowy_village.jpg" width="100%"> | <img src="examples/vhs_birthday.jpg" width="100%"> |+| **山间夜营** · *Night Camp*<br><sub>Flat vector · 扁平矢量</sub> | **小橡果的秋天** · *An Acorn's Autumn*<br><sub>Storybook animation · 绘本角色动画</sub> |+| <img src="examples/flatvector_night_camp.jpg" width="100%"> | <img src="examples/storybook_acorn.jpg" width="100%"> |+| **蛇梯棋大冒险** · *Snakes & Ladders, Round 7*<br><sub>Ballpoint doodle · 圆珠笔涂鸦</sub> | **海港步行图** · *Larkhaven on Foot*<br><sub>Overlay sheets · 描图纸叠层</sub> |+| <img src="examples/ballpoint_board_game.jpg" width="100%"> | <img src="examples/overlay_city_map.jpg" width="100%"> |+| **出发前,再查一遍行李** · *Pack Check*<br><sub>Pastel UI · 粉彩界面</sub> | **数学单元测验** · *Unit Test, Graded*<br><sub>Exam grading · 阅卷批改</sub> |+| <img src="examples/pastelui_packing.jpg" width="100%"> | <img src="examples/grading_math_quiz.jpg" width="100%"> |+| **蹴鞠** · *Cuju by Lamplight*<br><sub>Shadow puppetry · 皮影戏</sub> | **街角速写** · *Sketchbook Neighbours*<br><sub>Pen & wash · 钢笔淡彩</sub> |+| <img src="examples/shadowpuppet_cuju.jpg" width="100%"> | <img src="examples/penwash_neighbours.jpg" width="100%"> |+| **雨天三人像** · *Rainy-Day Portraits*<br><sub>Retro gouache · 复古水粉</sub> | **借伞** · *The Shared Umbrella*<br><sub>Blue picture book · 蓝调绘本</sub> |+| <img src="examples/gouache_rainy_day.jpg" width="100%"> | <img src="examples/bluebook_shared_umbrella.jpg" width="100%"> |+| **春水园林** · *Spring Water Garden*<br><sub>Jiangnan garden · 江南园林</sub> | **面馆** · *Noodle Counter*<br><sub>Dry-brush blocks · 干刷色块</sub> |+| <img src="examples/jiangnan_spring_water.jpg" width="100%"> | <img src="examples/drybrush_noodle_counter.jpg" width="100%"> |+| **夜的边上** · *The Kite at the Edge of Night*<br><sub>Twilight storybook · 暮色微缩绘本</sub> | **熔岩入海** · *Lava Meets the Sea*<br><sub>Hatched nocturne · 排线夜景</sub> |+| <img src="examples/twilight_paper_kite.jpg" width="100%"> | <img src="examples/nocturne_lava_sea.jpg" width="100%"> |+| **小王子 · 读书笔记** · *Reading Notes*<br><sub>Obsidian UI · 笔记应用界面</sub> | **搬家计划** · *Moving Plan*<br><sub>Canvas board · 白板卡片</sub> |+| <img src="examples/obsidianui_reading_notes.jpg" width="100%"> | <img src="examples/canvasboard_moving_plan.jpg" width="100%"> |+| **一杯手冲咖啡** · *Pour-over, in Five Diagrams*<br><sub>Flexoki paper · Flexoki 纸面</sub> | **大龟过河** · *The Tortoise Crossing*<br><sub>Warm pencil storybook · 暖调彩铅绘本</sub> |+| <img src="examples/flexoki_pour_over.jpg" width="100%"> | <img src="examples/pencilbook_tortoise_crossing.jpg" width="100%"> |Every mark above is computed: paper fibres, ink washes and mist, dry-brush strokes, pigment granulation and blooms, torn-paper edges, pencil wax on paper tooth, cel-shaded clouds, risograph grain and halftones, lit impasto relief, woodblock grain and bokashi, dithered pixels, plasticine lit like a film set, sunlight through leaves on Prussian blue, twisted thread on Aida cloth, machined knobs behind a backlit dial, die-cut vinyl with a laminate gloss, streaky thermal print, graphite catching the tooth of graph paper, highlighter pooling at the start of a swipe, chalk dust settling under half-erased lessons, rain-lit neon glass mirrored in a wet street, a blue-pencil rough under boiling brush ink, an island ray-traced under one soft sun, a single unbroken gold line, candy balls with softbox glints, one outline morphing through six shapes, halftone photos cut out with scissors, frosted glass blurring the real pixels behind it, screen-printed primaries out of register, a slit sun sinking behind a neon grid played off tape, hollow fuse beads on a pegboard melting together under an iron, pits knocked through desert varnish, a red grid showing through flaking plaster, stones laid row by row along an outline, daylight through leaded glass, burnished gold that mirrors the room, left-handed hatching in iron-gall ink, black paper cut with scissors, wood type printed a hair out of register, red and black plates slipping apart, airbrush fades inside knife-cut friskets, Ben-Day dots on yellowed newsprint, one photo key pulled across hand-painted colour, characters struck through a fading ribbon, flat-shaded triangles dithered to 15 bits, spray drifting past cut card, satin stitches catching the light by their angle, ink lines printed white on Prussian blue, wax scribbles skipping the paper's pits, phosphor glowing behind curved glass, heat leaking out of a kitchen, cobalt fired into tin glaze tile by tile, ochre blown onto rock lit by a fire, 1-bit patterns in an old paint program, slip silhouettes incised to the clay, graphite that never quite reaches black, X-rays adding up through a suitcase, grey cels shot on scratched film, gouge marks in a rolled-up block, a birthday smeared onto tape, seven flat colours lifting off each other, an acorn squashing and stretching through a world drawn as it goes, ballpoint ink blobbing at every corner of a hand-drawn game, inks multiplying through tracing paper on a light box, window cards floating on a pastel field over shadows tinted by it, a vermilion stamp running dry at one end, red ink pooling where the pen slowed down, dyed donkey hide glowing on a lamp-lit screen, gouache scumbled dry over a toned board, knit stitch by stitch, dry pastel blue under a scratchy brush line, with chalk rain on top, a spring garden built leaf by leaf, its tiled roofs and willows mirrored in a jade lake, a roller and a dry brush running out across cream paper, a dusk sky going over to stars above thousands of tiny wildflowers, and a night sea laid stroke by stroke under the one warm light of lava meeting the water. No diffusion model, no API, no stock art. It is just Python with **numpy + Pillow** on a CPU: from 0.1 s (pixel art) to about 45 s (the soft 3D ray tracer) per 1920×1080 image.@@ -144,7 +148,7 @@ Every mark above is computed: paper fibres, ink washes and mist, dry-brush strok### What it is-A [Claude Code](https://claude.com/claude-code) skill and a small painting library with seventy-three styles:+A [Claude Code](https://claude.com/claude-code) skill and a small painting library with seventy-four styles:| Style | Module | What makes it read as the real medium ||---|---|---|@@ -221,6 +225,7 @@ A [Claude Code](https://claude.com/claude-code) skill and a small painting libra| **Obsidian UI (笔记应用界面)** | `lib/obsidianui.py` · `ObsidianUI` | a dark note-taking app the way an explainer film shows it: a near-black page with a soft violet glow and the app window on it — a tab bar with the traffic lights (the active tab open at the bottom so it runs into the note), a slim icon ribbon, a file explorer with folders, indent guides and the open note highlighted, a breadcrumb, a source / reading switch, a right sidebar and a floating status bar. In the note: a heavy H1 with a short glowing violet bar, a properties block with #tags, body lines laid out from runs (bold, internal links in violet, inline code on a dark chip, highlights), a dark code block in SF Mono with syntax colours and a block caret, a quote callout with a violet edge, task checkboxes; the reading view's flowchart as flat dark nodes with 2 px grey borders, thin edges with small filled arrowheads and an edge-label chip, one node lit violet inside a focus ring; and the graph view — grey nodes and links, the notes linked to this one lit violet with a soft radial glow, labels outlined in the pane colour so links stop short of the words. One accent (violet by default, switchable), everything else greys; every shape is a signed-distance field with analytic 1 px anti-aliasing, shadows and glows follow CSS box-shadow, and everything is drawn into named layers with a pose (offset, scale, opacity, a reveal left to right, top down or as a circle growing from a point), so the same drawing raises the window, types a code line with the caret riding its end, flips the switch, pops the flowchart node by node and grows the graph out of the current note || **Canvas board (白板卡片)** | `lib/canvasboard.py` · `CanvasBoard` | the canvas view of a dark note-taking app, as a product film shows it: a dark page with a faint violet glow, the app window (traffic lights and a `.canvas` tab in the tab bar, a ribbon of line icons, the zoom buttons top right) and in it an infinite board of grey dots seen through a camera. Nothing is rasterised when you draw: every shape is recorded in board coordinates into a named node — a group, a card, an edge — and `render()` draws every node again through the camera, so the board can be panned and zoomed with crisp edges and type at any scale; the dot grid lives on the board and moves with it, the chrome does not. Rounded rectangles, discs, rings and strokes are signed-distance fields with 1 px analytic anti-aliasing, polylines are measured segment by segment inside their own bounds (a 64-segment edge or a sketch of hundreds of segments stays cheap), arrowheads and the pointer are 4× supersampled polygons, shadows follow CSS box-shadow. Groups are rounded frames with their labels floating above; cards have a 2 px border in one of six card colours with a 5 % tint of it, a soft shadow, a file-name label, a violet halo when selected and a big shadow when lifted. Cards hold inline Markdown laid out again at every zoom — headings, ==violet highlights==, `mono code`, bold — task lists that tick (the box pops violet, the check draws on, a strike runs through, the text greys), quotes with a violet bar, tag pills, colour chips and progress bars; image cards hold a picture drawn in hand-drawn strokes (each segment slightly bowed and overshooting, drawn twice) with notes in a handwriting face. Edges are cubics that leave and enter along the sides' normals, with an arrowhead and a label on a board-coloured pill. Every node has a pose (offset, scale, opacity) and named progress vars that its shapes read — fade, draw, reveal or pop — and `tween()` writes the in-between stages: cards dropping in with a little bounce, edges drawing on, the camera panning and zooming, a sketch drawn stroke by stroke, the pointer clicking "fit". One accent: violet || **Flexoki paper (Flexoki 纸面)** | `lib/flexoki.py` · `FlexokiPaper` | an explainer sheet the way a docs site themed with the Flexoki palette shows its diagrams: warm paper #FFFCF0, ink-black type, a ladder of warm greys (surface, track, hairline, border, faint and muted text) and eight accents in two shades. Light-grey rounded panels with no border and no shadow carry a heavy CJK title, a grey English tag and a mono index; inside them the diagrams are drawn the way a lightweight Mermaid-style renderer draws them — boxes one step off their ground with a 2 px grey border (rect, round, stadium, exact rhombus, cylinder, circle), 2.4 px ink lines ending in small filled triangular heads, plain semibold labels on a patch of ground colour, dashed lifelines, activation bars, replies and notes, pies with paper-coloured gaps, bar charts on hairline grids, tables with a tinted header and accent dots — plus an orange focus ring, ink chips, step chips and big tight-tracked numbers. Every shape is a signed-distance field with 1 px analytic anti-aliasing; polylines carry their arc length, so an edge can be drawn on to any fraction (the cut end keeps its round cap), dashed along its length and trimmed under its head; a node (fill, border, label) is composited as one group, so it pops in and fades as a whole. Layers with poses, plus `layer(name, fresh=True)` to redraw a progress state, make the draw-on animation: panels rise dim and light up one by one, edges draw on one by one and land their heads, messages fly, a timer and the bar values roll, the pie sweeps, table rows slide in |+| **Warm pencil storybook (暖调彩铅绘本)** | `lib/pencilbook.py` · `PencilStorybook` | a children's-storybook page in soft, layered coloured pencil on warm, toothy paper — a giant gentle creature and a small child at dusk. The sheet has an equalised tooth that is mostly a one-pixel grain; wax catches where the tooth is above one minus the pressure, a little still settles in the pits, and a fill buffer lets later layers reach deeper, so the same pits show through every layer as fine, increasingly tinted specks and only close up where the work is heavy. A stroke is a centreline integrated through an orientation field (angles mod π) with a slight wrist arc; tens of thousands are drawn at once as polylines with their own ids into a 2× supersampled integer map, and for each covered sub-pixel only numpy looks up that stroke's colour, start, direction, length, pressure and taper, recovers how far along it the pixel lies (pressed at the start, lifting off at the end), lays wax where that pressure reaches the tooth dragged along the stroke's own direction, and sums back to pixels with bincount. Strokes are seeded on a jittered grid, and the region is both where they land and, pixel by pixel, how hard the pencil presses, so a shadow is a smooth gradation rather than scattered dark dashes; `avoid` leaves the shapes that come later blank, the way an illustrator keeps the sky off the creature. Wax is semi-transparent (target = old × colour / paper, mixed toward the colour by its opacity): yellow over blue goes green, a colour over itself deepens, light pencils over dark need pressure. `form()` models a shape as a pencil artist does — light under-layer, local colour, the shadow of the same family, the deepest tone in the core, a warm glaze on the lit side and a cool one in the shade — each layer crossing by a few degrees round the form's own direction: along the iso-lines of a dome, round each scute of a shell, across the folds of a neck, down the folds of a coat. Fur is laid in locks whose strands spread at the root and converge at the tip, curling together, the flank away from the light a little darker; grass fans the other way; tree crowns are clumps of curved leaf strokes, each lit on its own. Warm light is layered orange-yellow strokes that follow the surface over a lift of the paper — never rays, never a smooth halo — and reflections are horizontal strokes sampling the mirrored picture. Storybook parts come with it (trees, cottages with lit windows, stones, scales, wildflowers, a paper lantern, a small child in a raincoat with a bob, a dot eye and a rosy cheek), and a finish of slight softness, fine grain and a faint warm vignette. No ink line, no black |Ask Claude to *"draw it yourself"*, *"paint this with code"*, or *"claude绘图"*, and name a style if you like. Claude then:@@ -389,6 +394,14 @@ Every style has a complete example: `python3 examples/<name>.py out.png --stages- the faintest grey (#B7B5AC) on information — keep it for index numbers and axis ticks;- a mono face for values with units ("30 g") — mono is for ids, times on an axis and code.For the draw-on GIF, redraw progress states (`fresh=True`) and cut them as real motion; never cross-fade a line that is drawing on.+- **Warm pencil storybook**: everything is strokes — no flat fill anywhere — and every area has its own direction: the sky in long horizontals, hills along their slopes, a shell round each plate, a neck across its folds, a coat down its folds, hair and moss in locks. Build tone the way a pencil artist does, in several light layers rather than one hard one: under-layer, local colour, the same family darker in the shadow, then a warm glaze in the light and a cool one in the shade. Let the tooth show as fine specks — mostly a one-pixel grain, with a little wax left in the pits so they read as tinted, not as holes. Colour round what comes later: semi-transparent wax laid over the sky turns a shell green. Keep it warm, medium-saturated and without black, and the light gentle — lanterns and windows as layered orange-yellow strokes, a warm rim from a low sun. Watch for accidental reads:+ - a shadow built only from where strokes land is a shower of dark dashes — ease the pressure off pixel by pixel instead;+ - straight columns under a big body are table legs — bend them into a stride, tuck the far legs behind, put the water under the belly in shadow;+ - a mossy cap of scattered cushions is mould and a flat cap with a toothed edge is a lawn — overlap the cushions into one lumpy band;+ - glow strokes that radiate are a starburst;+ - cross-hatching on a thin stick is candy stripes — run its strokes along it;+ - a lit rim drawn round a whole silhouette shows through whatever sits on top of it.+ Keep the child small against the creature with a simple face (a dot eye, a cheek, a nose bump), and the creature's eye gentle — a soft lid, not a brow.### Roadmap@@ -400,7 +413,7 @@ Every style has a complete example: `python3 examples/<name>.py out.png --stages### 这是什么-一个 [Claude Code](https://claude.com/claude-code) skill,加上一个小巧的绘图库,内置七十三种画风:+一个 [Claude Code](https://claude.com/claude-code) skill,加上一个小巧的绘图库,内置七十四种画风:| 画风 | 模块 | 为什么看起来像真的 ||---|---|---|@@ -477,6 +490,7 @@ Every style has a complete example: `python3 examples/<name>.py out.png --stages| **笔记应用界面** | `lib/obsidianui.py` · `ObsidianUI` | 讲解片里的一个深色笔记应用:近黑页面上一团淡紫光晕,上面是应用窗口——标签栏和红黄绿三点(当前标签底边打开,和笔记连成一片)、细长的图标栏、带文件夹和缩进线的文件列表(打开的笔记高亮)、面包屑、源码 / 阅读开关、右侧边栏和右下角浮着的状态栏;笔记里是粗黑 H1 和一道带辉光的紫色短条、带 #标签的属性块、按片段排出来的正文(加粗、紫色的内部链接、压在深色小底上的行内代码、高亮)、SF Mono 写的深色代码块(语法色、块状光标)、紫色左边的引用标注、任务勾选框;阅读视图里的流程图是扁平深色节点、2 px 灰边、细线加小实心三角箭头和边上的小标签,其中一个节点亮成紫色、套一圈外环;关系图谱是灰点灰线,这篇笔记链接到的几篇亮成紫色、带柔和的径向光,标签描一圈栏底色,连线到字前就断开。只有一个强调色(默认紫,可换),其余全是灰;所有形状都是有符号距离场、1 px 解析抗锯齿,阴影和辉光按 CSS box-shadow 算;一切画进带姿态(位移、缩放、不透明度、从左往右 / 从上往下 / 从一点往外长成圆的揭开)的图层,同一套画面既能让窗口升起、逐行敲代码而光标跟着行尾走、点开关切到阅读,也能让流程图一个节点一个节点弹出、关系图谱从当前笔记往外长出来 || **白板卡片** | `lib/canvasboard.py` · `CanvasBoard` | 深色笔记应用的白板视图,像产品片里拍的那样:深色页面左上一片淡紫光,一扇应用窗口(标签栏上红黄绿三点和「.canvas」标签页、左边一列线性图标、右上角缩放按钮),里面是一块透过镜头看的灰点阵无限白板。画的时候什么都不栅格化:每个形状都按白板坐标记进一个有名字的节点(分组、卡片、连线),`render()` 按镜头把所有节点重画一遍,所以白板可以任意平移缩放,边和字始终锐利;点阵长在白板上跟着动,窗口不动。圆角矩形、圆、环和线条是有符号距离场、1 px 解析抗锯齿,折线逐段只在自己的包围盒里算(64 段的连线、几百段的草图都很快),箭头和指针是 4 倍超采样多边形,阴影按 CSS box-shadow 算。分组是圆角框,组名浮在框上方;卡片是 2 px 的卡片色边(六种卡片色)加 5 % 同色底、软阴影、上方的文件名,选中时一圈淡紫光,举起时一层大阴影。卡片里是每次缩放都重新排版的行内 Markdown——标题、紫色高亮、等宽行内代码、粗体——会打勾的清单(紫色方框弹出、对勾画出、删除线划过、文字变灰)、紫色竖条的引用、标签胶囊、颜色胶囊和进度条;图片卡片里是手绘笔触画的图(每段略弯、两头出头、画两遍)和手写体批注。连线是沿两条边的法线出入的三次曲线,末端箭头,中间一块白板底色的标签。每个节点有位姿(位移、缩放、不透明度)和有名字的进度变量,形状按 淡入 / 画出 / 揭开 / 弹出 读它;`tween()` 写出中间阶段:卡片掉落、回弹落定,连线画出来,镜头平移缩放,草图一笔笔画,指针点「适合窗口」。只有一个强调色:紫 || **Flexoki 纸面** | `lib/flexoki.py` · `FlexokiPaper` | 照用 Flexoki 配色的文档站那样摆一页图解:暖白纸 #FFFCF0、墨黑字、一串暖灰(卡片底、轨道、细线、边框、最淡和次要的字),八种强调色各两档。不描边、不投影的浅灰圆角卡片,粗黑中文标题、灰色英文、等宽编号;卡片里的图照轻量的 Mermaid 式渲染器画——比底色差一级的框和 2 px 灰边(直角、圆角、胶囊、精确菱形、圆柱、圆),2.4 px 墨线末端一个小的实心三角箭头,普通半粗体标签垫一块底色,虚线生命线、激活条、回复和便签,带纸色缝的饼图,细网格上的柱状图,表头着色、带强调色小圆点的表格;还有橙色聚焦框、黑底胶囊、步骤胶囊和字距收紧的大数字。所有形状都是有符号距离场、1 px 解析抗锯齿;折线带弧长,一条边能画到任意几成(切口仍是圆头)、沿弧长画虚线、在箭头下面截短;一个框(底、边、字)先合成一组再放下,所以弹出和淡入是整个一起的。带姿态的图层加上 `layer(name, fresh=True)` 按进度重画,就是逐边画出的动图:卡片暗着升起、一张张亮起,线一条条画过去再落下箭头,消息飞过去,计时器和柱顶数字滚动,饼图扫开,表格一行行滑进来 |+| **暖调彩铅绘本** | `lib/pencilbook.py` · `PencilStorybook` | 暖白、有齿纹的纸上一层层叠涂的彩色铅笔童书页:黄昏里一只大而温柔的生物和一个小小的孩子。纸纹直方图均衡过、以 1 px 细颗粒为主;蜡挂在纸纹高于 1 − 压力的地方,纸坑里也留一点,蜡层缓冲让后面的笔越叠越能压进纸坑——所以同一批纸坑一层层都透出细白点(越来越带色),只有压得重、叠得多的地方才合上。一笔是在方向场里积分出来的中心线(方向按 mod π 处理),带一点手腕的弧度;几万笔一次画完:每一笔当折线按序号画进 2 倍超采样的整数 id 图,numpy 只对被盖住的子像素查回这一笔的颜色、起点、方向、长度、压力和收笔,算出像素在笔上的位置(落笔重、收笔挑),蜡只落在压力够得着、沿这一笔方向拖开的纸纹上,再用 bincount 汇回像素。落笔位置用抖动网格,区域既是落笔概率也是逐像素的压力,所以暗部是平滑过渡而不是散落的深色短线;`avoid` 把后面要画的东西先留白,像画家铺天空时把主体空出来。蜡是半透明的(目标 = 旧 × 颜色 / 纸色,再按 opacity 往颜色靠):黄盖在蓝上变绿,同色越叠越深,浅色盖深色要压光。`form()` 照彩铅画家的方式塑形——浅色底层、固有色、同色系的暗部、核心最深处,再在受光一侧罩暖色、阴影里罩冷色——每层绕着形体自己的方向错开几度:沿着穹顶的等值线、绕着龟壳每块盾片、横过脖子的褶、顺着雨衣的衣褶。毛一绺一绺地画:根部散开、尖端聚拢、一起微弯,背光一侧暗一点;草反过来往上散开;树冠是一团团分别打光的短弯叶片笔触。暖光是顺着表面的一层层橙黄笔触加一层纸面提亮——不放射、也不是平滑光晕;倒影是取水线以上镜像颜色的横排线。附带绘本部件(树、亮灯的小房子、石头、鳞片、野花、纸灯笼、穿雨衣的波波头小孩,点点眼和腮红),收尾是轻微柔化、细颗粒和很淡的暖色暗角。没有墨线,没有黑色 |对 Claude 说「claude绘图」「你自己画」「用代码画」,也可以指定画风。它会:1. **先定构图**:层次、焦点、留白,而且画面要图解内容本身;@@ -579,6 +593,7 @@ python3 examples/nocturne_lava_sea.py out.jpg --stages stages/ # 排线夜景python3 examples/obsidianui_reading_notes.py out.jpg --stages stages/ # 笔记应用界面:小王子读书笔记python3 examples/canvasboard_moving_plan.py out.jpg --stages stages/ # 白板卡片:搬家计划python3 examples/flexoki_pour_over.py out.jpg --stages stages/ # Flexoki 纸面:一杯手冲咖啡+python3 examples/pencilbook_tortoise_crossing.py out.jpg --stages stages/ # 暖调彩铅绘本:大龟过河```### 作画要点(Claude 交图前逐条自查)@@ -696,6 +711,14 @@ python3 examples/flexoki_pour_over.py out.jpg --stages stages/ # Flexoki 纸- 最淡的灰(#B7B5AC)用在信息上——它只给编号和坐标刻度;- 带单位的数值用等宽字(「30 g」)——等宽只给编号、坐标上的时间和代码。做动图时按进度重画(`fresh=True`),当成真的运动硬切,线画出来的过程不要叠化。+- **暖调彩铅绘本**:一切都是笔触——任何地方都不要平涂——而且每片区域都有自己的方向:天空横向长排线、山坡顺着坡势、龟壳绕着每块盾片、脖子横过褶皱、雨衣顺着衣褶、头发和苔藓一绺一绺。照彩铅画家的方式一层层轻轻叠出明暗,不要一层重压到底:浅色底层、固有色、背光处同色系的深色,再在受光处罩暖色、阴影里罩冷色。纸齿要透出细白点——以 1 px 细颗粒为主,纸坑里也留一点蜡,白点才是带色的,不是一个个洞。后画的东西先留白:半透明的蜡盖在天空上,龟壳就发绿了。颜色暖、饱和度中等、不用黑,光要温柔——灯笼和窗灯是一层层橙黄的笔触,落日给受光一侧一道暖边。小心看错:+ - 只靠落笔多少做出的暗部是一阵深色短线的雨——改成逐像素地减轻压力;+ - 大身体下面的直柱子是桌腿——弯成迈步的样子,远侧的腿躲到后面,肚子底下的水压进阴影;+ - 散开的苔藓圆垫是霉斑,平平的、下沿一排齿的苔藓是草坪——圆垫要叠成一整条疙疙瘩瘩的带子;+ - 放射的光笔触是星芒;+ - 细杆上交叉排线是拐杖糖——笔触顺着杆走;+ - 围着整个轮廓画的边光,会从盖在上面的东西里透出来。+ 小孩要比那只生物小得多、脸要简单(点点眼、腮红、一个小鼻头),生物的眼睛要温和——一道软软的眼皮,不要眉毛。### 计划diff --git a/SKILL.md b/SKILL.mdindex d512d3c..e42ebc6 100644--- a/SKILL.md+++ b/SKILL.md@@ -1,6 +1,6 @@---name: claude绘图-description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型,由 Claude 用代码一笔一笔「画」出图片(程序化绘画)。内置七十三种画风:中国水墨、水彩、剪纸拼贴、韩国彩铅、日本动漫、编辑风手绘(Riso)、油画厚涂(梵高式流向笔触+颜料浮雕打光)、浮世绘木版画(晕色、木纹、墨线主版、青海波)、像素风(低分辨率+Bayer 抖动+像素字体)、黏土定格(高度图捏出的彩泥+影棚打光)、蓝晒(普鲁士蓝日光晒图,植物剪影透光)、十字绣(Aida 布十字绣+回针绣+缎面绣+法式结)、复古仪器面板(60 年代收音机/仪器正面:柚木、拉丝铝、旋钮、刻度窗、指示灯)、贴纸拼贴·小票(模切乙烯贴纸、热敏小票、和纸胶带、吊牌、橡皮章)、实验笔记本·贴纸(线圈方格本、铅笔图表、荧光笔、红笔圈、便利贴)、黑板板书(墨绿石板、粉笔颗粒、板擦残影、示意图与公式)、赛博朋克(雨夜霓虹街道、玻璃管霓虹招牌、全息广告、湿路面倒影)、卡通手绘(蓝铅笔稿、毛笔线、错位平涂、赛璐璐阴影、逐帧抖线)、等轴 2.5D(正等轴微缩模型、一个太阳照出三面明暗、悬浮数据卡)、单线画(一根不断开的线一笔画完、唯一点睛色)、柔光 3D(光线追踪的糖果色小球海和鼓鼓的软字、景深)、形变动画(一条轮廓依次变形、洋葱皮残影、缓动曲线)、报刊拼贴(牛皮纸、手撕旧报纸、网点老照片、勒索信拼贴字)、弥散玻璃(弥散渐变、磨砂玻璃卡片界面)、包豪斯几何(三原色几何、丝网印刷海报)、复古 Synthwave(切口落日、霓虹网格、镀铬字、录像带质感)、拼豆(钉板上的熔珠小管、熨烫熔合)、岩画(沙漠漆上凿出的凹坑图形、新旧凿痕、剥落)、古埃及墓室壁画(灰泥墙、红格起稿、分栏叙事、象形文字、剥落)、罗马马赛克(石子与玻璃沿轮廓一排排铺、灰缝、燕尾铭牌)、彩色玻璃花窗(哥特尖拱窗、通体着色玻璃、grisaille 彩绘与银染、铅条、透光)、泥金手抄本(羊皮纸、鹅毛笔哥特体、朱红标题、打磨金箔首字母)、达·芬奇手稿(铁胆墨水、左手排线、红粉笔、镜像手写、机械分解图)、剪影(黑纸剪出的侧影小像、薄金粉、椭圆金框)、凸版印刷海报(木活字、红黑双色错版、木刻插图)、苏联构成主义(红黑两版、斜条与楔形、西里尔大字、网点照片拼贴)、装饰艺术 Art Deco(1930 年代喷枪流线型海报、交替射线、阶梯高楼、金色 Deco 字)、黄金时代漫画(毛笔墨线、Ben-Day 网点、四色错版、新闻纸)、波普丝网(多格撞色平涂 + 错位的照相黑版)、ASCII 字符画(行式打印机、绿条连续纸、叠打)、低多边形(1999 年代 3D:平面着色、仿射贴图、逐顶点雾、15 位色抖动)、喷漆模板涂鸦(混凝土墙上多层卡纸模板喷绘、雾化与滴痕)、刺绣徽章(牛仔布上的机绣徽章:填充绣、缎面绣、锁边)、蓝图工程图(描图墨线晒成蓝底白线)、儿童蜡笔画(小孩在糙纸上的蜡笔涂抹)、绿屏终端 CRT(荧光字符画、扫描线、余辉)、热成像(先画温度场再上伪彩色)、代尔夫特蓝瓷砖(锡釉砖上的钴蓝手绘)、洞穴壁画(火光下的赭石、吹喷手印)、1-bit 早期画图软件(黑白整屏、8×8 图案填充)、古希腊黑绘陶瓶(黑釉剪影、刻线、饰带展开图)、铅笔素描(石墨排线、擦笔、边缘只剩线稿)、X 光片(安检透视、轮廓发亮、伪彩)、1930 年代黑白橡皮管动画(白手套、饼切眼、老胶片)、黑白麻胶版画(刻刀减法、手拓发花、套色错版)、VHS 家庭录像(钨丝灯偏色、色度渗色、REC)、扁平矢量(分层几何色块、七色、层间投影)、绘本角色动画(小角色挤压拉伸的真动画)、圆珠笔涂鸦(蓝红圆珠笔线稿、墨团、彩铅、页边涂鸦)、描图纸叠层(灯箱上的黑线底图 + 一张张单色描图纸叠片:正片叠底、套准十字、定位钉、绘图胶带)、粉彩界面 · Pastel UI(产品发布片式的界面画面:纯色粉彩底与大光斑、macOS 窗口卡片、胶囊与粗黑标题色条、状态标签与 ✓ / ✗ 徽章、放大镜、从卡片边探头的扁平小图标)、阅卷批改 · Exam Grading(绿毛毡桌上被红笔批改的答题卡:定位黑块、考号涂卡、得分格与阅卷栏、长尾夹夹住的标准答案卡、油墨不均的朱红印章、立体红笔、波浪线 / 圈 / 引线 / 批注 / 叉 / 圈起来的分数)、皮影戏 · Shadow Puppetry(油灯照亮的幕布上,雕空、透明染色的驴皮关节人偶:镂空纹样、阳刻空脸、雉翎盔头、线结与操纵杆、离幕时虚化的双影;雕花戏台、红漆金字牌匾、红灯笼)、钢笔淡彩 · Pen & Wash(速写小卡上的针管笔线稿 + 松散淡彩:线条抖、出头、不闭合,颜色错位出线、留白缝、干边与颗粒,不铺满的背景色块;大头、圆眼镜、点点眼、红鼻子的呆萌小人;卡片拍在木桌上,旁边放着针管笔和水笔)、复古水粉 · Retro Gouache(复古绘本风的水粉大头像:不透明水粉从暗到亮一层层盖上去,单色背景用干笔皴擦;大红鼻子、腮红、圆眼和大耳朵用几阶色值塑出来;看得见针脚的毛衣和毛线帽,一根根的头发和胡子,毛毡;最后是印刷书页的纸纹)、蓝调绘本 · Blue Picture Book(软蓝色调的现代绘本跨页:几乎只用粉蓝、矢车菊蓝、深青蓝三阶蓝加黑墨和纸白,只点一点珊瑚红、粉色腮红和芥末黄;毛笔 / 墨铅笔线干、抖、断,粗细不匀,线不闭合,暗部用快速来回的乱线排出来;颜色是干蜡笔、粉彩、干水粉,错位出线,纸纹的白点透出来;白粉笔痕压在蓝上,甩点和细尘;背景蓝块毛边、不到纸边;大圆脑袋、带高光的点点眼、点彩腮红和雀斑、火柴腿穿靴子的小人,乱线毛边的白色毛绒动物;最后印在书上:中缝和页码)、江南园林 · Jiangnan Garden(细笔园林春景,数字水粉插画:成千上万片叶形小笔触按一个太阳堆出树冠,暗芯、亮边、一簇簇的高光;白色和淡粉的繁花是一簇簇圆点花瓣,枝条从缝里露出来;垂柳是一绺一绺发丝般的细枝挂满小叶;黛瓦飞檐是真的瓦垄:筒瓦板瓦一行行、檐口瓦当滴水、翘起的翼角和卷起的脊头;粉墙月洞门、冰裂纹漏窗、翡翠绿槅扇和挂落、红灯笼、匾额;九曲石桥、石阶、小木船;碧绿湖面倒映岸上的一切,更柔、更暗,加涟漪和细竖纹;睡莲、白鹭;从前景花枝到雾里青山层层退远,墙上桥上落着叶影;最后一方小红印)、干刷色块 · Dry-Brush Blocks(mid-century 海报 / 水粉拼贴式的编辑插画:米白纸上几大块干笔或滚筒刷出的色块,颜色严格限定在森林绿、鼠尾草绿、青蓝、藏蓝、近黑和朱红,外加一点天蓝、淡青瓷和米色;每块颜色在自己的笔刷坐标系里刷:一道道平行的笔,起笔饱满、收笔干枯,两侧几乎是直边,两端梳成长短不一的毛齿,块里有顺笔的鬃毛纹、皴擦斑和露出来的纸色;背后的大色板用滚筒:近乎平涂、成簇的细点、干的两侧和几道细刮痕;色块像丝网套印或撕纸拼贴一样叠起来,撕口带一圈浅色纤维边;人物拆成几个大块面:亮暗两半朝不同方向刷的外套、几块肤色平面拼的头、粗黑框眼镜、干笔皴擦的白胡子;瓶子是竖刷的深色剪影加一道高光和小块标签;一旁一个小朱红方块;不勾线、不做渐变;最后像胶印:轻微柔化、纸纹、暗部零星白点、纸上细尘)、暮色微缩绘本 · Twilight Storybook(温柔、怀旧的黄昏绘本单页,满是微缩细节:大片粉彩黄昏天空,从顶上的薰衣草紫经玫瑰、蜜桃到地平线的暖金,柔和的平底云带、细细的光线和一轮低垂的淡日;一侧天空已经入夜:星空、带暗带的银河、弯月、流星,昼夜交界经过淡紫和靛蓝,不发灰;下面是一层层粉彩条纹的起伏山丘,拼布似的田、细细的垄、小圆树;前景是几万朵小野花铺成的坡,坡顶是色点,越往下越大:雏菊、矢车菊、虞美人、波斯菊、金盏花、毛茛、羽扇豆、勿忘我,夜的一侧整片变成月光蓝;很小、扁平、可爱的原创角色;上面叠一层科学图版的语言:圆形的「detail a」放大图,细墨线、排线、尺寸标注、标签和比例尺,几行灰色的小写英文手写字;最后是细颗粒、光晕、暗角和底边一道撕纸边)、排线夜景 · Hatched Nocturne(彩铅 / 色粉排线式的小幅夜景版画:天空、云、山和海全由密密的短笔触叠成,每片区域的笔触顺着同一股「风」走——天空斜着流、蒸汽绕着云团卷、山坡顺着坡向、海面横着长拖,每一笔色相和明度都差一点,笔毛分道、拖干的笔尾、纸纹里漏出的细缝,没有一处平滑渐变;深靛蓝、藏青、冷灰蓝的夜色里只有一个暖色光源,光是一层层加上去的发光笔触:核心黄白、外圈橙红、再外是被照亮的笔触,被照亮的蒸汽按「光 × 受光」上色,所以是红橙而不是粉;发光的细丝(会蜿蜒、分股、末端亮珠)、火星、星点;海面上被横向笔触打碎的倒影和光柱;几十像素高的小人靠一点亮色(围巾)点出来;最后装裱成小版画:米白纸边、压印的版痕、左下铅笔小标题、右下更小的说明,用细的普通字体)、笔记应用界面 · Obsidian UI(讲解片里的深色笔记应用窗口:近黑页面上一团淡紫光晕,窗口里有标签栏、细长图标栏、带缩进线的文件列表、粗黑 H1 下一道紫色短条、属性块和 #标签、紫色的内部链接和行内代码、带语法色的 mermaid 代码块——点「阅读」后渲染成扁平深色的流程图,一个节点亮紫——紫色左边的引用标注,右栏关系图谱里被链接的笔记亮成紫色光点;全画只有一个紫色强调色,不画官方 logo)、白板卡片 · Canvas Board(深色笔记应用的白板视图:深色页面上一扇应用窗口——红黄绿三点和「.canvas」标签页的标签栏、左边一列线性图标——里面是一块随镜头平移缩放的灰点阵无限白板;分组框和浮在框上方的组名,深色圆角卡片带 2 px 的卡片色边(红、橙、黄、绿、青、紫)和一层很淡的同色底,卡片之间是从边的中点沿法线弯出去的曲线连线,末端实心箭头、中间一块白板底色的标签;卡片里是 Markdown:标题、正文、紫色高亮、等宽行内代码、勾选清单(勾上时紫色方框弹出、对勾画出、文字变灰加删除线)、紫色竖条的引用、紫色标签胶囊、颜色编号胶囊;图片卡片上方写文件名,里面可以用手绘笔触画草图(每笔画两遍、略弯、出头,手写体批注);右上角一列缩放按钮;全画只有一个紫色强调色加卡片色;所有东西都记在白板坐标里、每次按镜头重画,任意缩放都锐利,镜头能平移缩放、卡片能掉落、连线能一点点画出来)、Flexoki 纸面 · Flexoki Paper(文档站式的图解页:暖白纸 #FFFCF0 上的墨黑字和一串暖灰,几张不描边、不投影的浅灰圆角卡片,粗黑中文标题、灰色英文类型名、等宽编号;卡片里的图照轻量图表渲染器的样子画——比底色差一级的框和 2 px 灰边(直角、圆角、胶囊、菱形、圆柱、圆)、墨线末端一个小的实心三角箭头、普通半粗体标签垫一块底色,虚线生命线和回复、带纸色缝的饼图、细网格上的柱状图、表头着色的对比表;Flexoki 的橙、红、蓝、绿、紫、青只放在有意义的地方,橙色聚焦框、黑底胶囊、字距收紧的大数字;能做成图一边一边画出来、数字滚动的动图)。用户说「claude绘图」「用代码画」「你自己画」「不用生图模型画」「程序化绘画」,或点名以上任一画风(含黏土、彩泥、定格动画、蓝晒、晒图、十字绣、刺绣、复古面板、老式收音机、贴纸、小票、收据、手帐拼贴、实验笔记本、方格本、荧光笔、便利贴、黑板、板书、粉笔、赛博朋克、霓虹、雨夜街道、卡通、手绘卡通、逐帧手绘、抖线、等轴、2.5D、微缩模型、单线画、一笔画、线条动画、柔光 3D、3D 渲染、C4D 风、软糖字、小球海、形变、变形动画、报刊拼贴、剪报、达达、勒索信字、网点印刷、弥散渐变、玻璃拟态、毛玻璃、包豪斯、几何构成、丝网印刷、Synthwave、蒸汽波、合成器浪潮、80 年代复古、拼豆、拼拼豆、熔珠、熨豆、豆豆画、钉板、烫豆、岩画、岩刻、凿刻、石刻、沙漠漆、史前壁刻、大角羊、古埃及、埃及壁画、墓室壁画、法老时代、象形文字、尼罗河、底比斯、罗马马赛克、马赛克镶嵌、镶嵌画、石子拼画、地砖画、古罗马地板、彩色玻璃、彩绘玻璃、花窗、玻璃花窗、教堂花窗、哥特花窗、铅条玻璃、泥金手抄本、手抄本、彩饰手抄本、中世纪手稿、羊皮纸、哥特体、花体首字母、泥金、贴金、星盘、达芬奇、达·芬奇、达芬奇手稿、手稿风、文艺复兴手稿、发明手稿、镜像字、镜像书写、扑翼机、红粉笔、钢笔排线、机械草图、分解图、剪影、剪影肖像、侧影、侧面像、黑纸剪影、剪影小像、椭圆金框、乔治时代肖像、摄政时期肖像、凸版印刷、活版印刷、木活字、铅字海报、马戏团海报、复古海报、老海报、19 世纪海报、双色套印、错版、套色错位、木刻插图、构成主义、苏联海报、苏联构成主义、俄国先锋派、罗德琴科风、红黑海报、照片蒙太奇、照片拼贴海报、西里尔字、装饰艺术、装饰风、流线型、流线型海报、1930 年代海报、旅行海报、铁路海报、火车海报、喷枪画、喷笔画、阶梯高楼、射线背景、盖茨比风、黄金时代漫画、老漫画、复古漫画、美漫封面、漫画封面、Ben-Day 网点、本戴点、网点上色、四色印刷、四色错版、新闻纸、对白框、拟声字、1940 年代漫画、波普、波普艺术、波普丝网、沃霍尔风、丝网版画头像、撞色头像、多格重复头像、六宫格撞色头像、ASCII、字符画、字符艺术、文字画、行式打印机、绿条纸、连续打印纸、针孔打印纸、老电脑打印、叠打、低多边形、低面数、低模、多边形风、千禧年 3D、90 年代 3D、复古 3D 游戏、老游戏截图、PS1 风、N64 风、平面着色、线框、游戏 HUD、飞行游戏、穿环、喷漆、模板涂鸦、镂空模板、喷漆模板、模板喷绘、街头涂鸦、街头艺术、墙绘、滴漆、班克西风格、刺绣徽章、徽章、布章、臂章、刺绣贴、绣标、锁边、牛仔外套徽章、户外徽章、营地徽章、弧形条章、蓝图、工程图、施工图、蜡笔画、儿童画、绿屏终端、CRT、显像管、热成像、热像仪、温度图、代尔夫特、荷兰蓝瓷砖、洞穴壁画、史前壁画、赭石、1-bit、黑白画图软件、MacPaint 风、黑绘、古希腊陶瓶、希腊瓶画、铅笔素描、素描、铅笔画、X 光、X 光片、安检图像、橡皮管动画、黑白卡通、老动画、麻胶版画、黑白版画、藏书票、VHS、家庭录像、录像带、扁平插画、扁平风、矢量插画、绘本动画、角色动画、挤压拉伸、圆珠笔、圆珠笔涂鸦、原子笔、页边涂鸦、课本涂鸦、手画棋盘、描图纸、硫酸纸、叠片、叠层、分色片、灯箱、拷贝台、透光台、套准、定位钉、粉彩界面、粉彩 UI、Dot 风、Dot 那种风格、产品发布会界面、发布会质感、窗口卡片、macOS 窗口、界面卡片、讲解片界面页、小图标探头、阅卷、阅卷批改、批改、判卷、改卷、改作业、答题卡、试卷、考卷、测验卷、红笔批改、红笔打分、打分数、盖章批改、朱红印章、标准答案卡、长尾夹、讲解片评测 / 打分页、皮影、皮影戏、影子戏、驴皮影、灯影戏、皮影人偶、雕花戏台、戏台牌匾、亮相、钢笔淡彩、淡彩、淡彩速写、钢笔淡彩小人、针管笔、勾线笔、针管笔加水彩、线稿上色、速写卡片、速写本小人、水彩小卡、城市速写、街头速写、水笔、自来水笔、复古水粉、水粉、水粉画、不透明水粉、哑光丙烯、复古绘本、绘本插画、绘本大头像、童书插画、复古童书、大头像、大鼻子人物、针织毛衣、麻花毛衣、毛线帽、毛毡帽、卷发、胡子、蓝调绘本、蓝色绘本、软蓝绘本、蓝调童书、软蓝童书插画、蓝色童书插画、蓝色系绘本、限色绘本、蓝白绘本、现代绘本跨页、手绘绘本跨页、绘本跨页、绘本内页、干笔墨线、墨铅笔线、粉彩蜡笔质感绘本、白色毛绒动物、毛绒白熊、点彩腮红、江南园林、园林春景、春水园林、中式园林插画、古典园林插画、国风园林插画、苏式园林、细笔园林、园林风景插画、水榭、临水茶榭、亭台楼阁、粉墙黛瓦、黛瓦白墙、飞檐翘角、翼角起翘、月洞门、漏窗、冰裂纹窗、槅扇、挂落、九曲桥、曲桥、垂柳园林、碧水倒影、园林倒影、睡莲池、数字水粉风景、细腻厚涂风景、干刷色块、干笔色块、干刷、干刷插画、干笔插画、滚筒刷、滚筒色块、色块插画、大色块插画、毛边色块、刷痕色块、粗刷笔触、mid-century、世纪中期插画、中世纪现代插画、复古编辑插画、复古海报插画、水粉拼贴、撕纸色块、限色海报、暮色微缩绘本、暮色绘本、黄昏绘本、微缩绘本、黄昏转夜、昼夜交界、日夜交界、半边黄昏半边星空、粉彩黄昏、粉紫晚霞、黄昏星空、银河插画、野花坡、野花草坡、花海插画、萤火虫、放风筝插画、拼布山丘、条纹田野、小圆树、细节放大图、局部放大图、技术细节小窗、科学图版风插画、手写英文小字、晚安绘本、治愈系绘本插画、排线夜景、排线风夜景、彩铅夜景、色粉夜景、粉彩排线、短笔触夜景、笔触夜空、方向笔触、夜景版画、小版画、限量版画风、版画装裱、版痕、纸边标题、铅笔题字、夜景插画、夜空插画、深蓝夜景、靛蓝夜空、冷暖对比夜景、唯一暖光、夜里的火光、发光的云、被照亮的云、红色精灵闪电、精灵闪电、火山夜景、熔岩入海、熔岩、岩浆、火山喷发插画、海上风暴、海面倒影、光柱倒影、火星飞溅、星点、看海的人、礁石上的人、远处的小人、小人比例尺、雪夜篝火、渔火、笔记应用界面、笔记软件界面、笔记 App 界面、Obsidian 风、Obsidian 界面、Obsidian 风格、黑曜石笔记、深色笔记界面、暗色主题界面、Markdown 笔记、Markdown 编辑器、双链笔记、内部链接、关系图谱、知识图谱界面、图谱视图、局部图谱、反向链接、文件列表、侧边栏、标签页、属性栏、行内代码、代码块、mermaid、mermaid 流程图、代码块渲染成图、源码 / 阅读切换、阅读视图、引用标注、callout、读书笔记界面、知识库界面、第二大脑、讲解片里的笔记应用、应用窗口演示、白板卡片、无限白板、白板视图、画布视图、Canvas 视图、Obsidian Canvas、Obsidian 白板、笔记应用白板、卡片白板、卡片和连线、节点和连线、带箭头的连线、弯曲连线、连线标签、分组框、点阵背景、点阵白板、深色白板、深色界面卡片、彩色边卡片、勾选清单卡片、待办卡片、引用卡片、图片卡片、草图卡片、手绘平面图、缩放按钮、镜头平移、镜头缩放、卡片掉落动画、连线画出来、搬家计划、旅行计划白板、活动计划白板、头脑风暴白板、项目拆解白板、计划白板、Flexoki、Flexoki 纸面、Flexoki 配色、Flexoki 风、暖白纸、米白纸面、墨黑字、文档站风格、文档页图解、技术文档配图、图解页、一页图解、讲解片图表页、几张图讲清楚、流程图、画流程图、时序图、序列图、饼图、柱状图、条形图、对比表、参数对比、图表合集、图表墙、Mermaid 风、Mermaid 图、图表渲染器、灰底圆角框、小三角箭头、橙色聚焦框、数字滚动、计时器大数字、配方图解、步骤图解、手冲咖啡图解、菜谱图解、工作流程图解),或 "draw it yourself", "paint with code", "procedural painting", "watercolor / collage / colored pencil / anime / editorial / impasto oil / ukiyo-e / pixel art / clay / claymation / cyanotype / sun print / cross-stitch / embroidery / retro instrument panel / vintage radio / sticker collage / receipt / lab notebook / graph paper / chalkboard / blackboard / cyberpunk / neon city / cartoon / hand-drawn animation / isometric / 2.5D / continuous line / one-line drawing / soft 3D / 3D render / puffy letters / ball pit / shape morph / morphing / newspaper collage / Dada / ransom note / halftone / glassmorphism / aurora gradient / Bauhaus / geometric poster / screen print / synthwave / retrowave / outrun / perler beads / hama beads / artkal / fuse beads / melty beads / pegboard beads / petroglyph / rock art / rock carving / desert varnish / Egyptian tomb painting / ancient Egypt / hieroglyphs / Theban tomb / Roman mosaic / floor mosaic / tesserae / opus vermiculatum / Pompeii mosaic / stained glass / leaded glass / church window / Gothic window / grisaille / illuminated manuscript / medieval manuscript / book of hours / gold leaf / illuminated initial / blackletter / vellum / astrolabe / da Vinci notebook / Leonardo codex / Renaissance sketchbook / mirror writing / iron-gall ink / red chalk / sanguine / ornithopter / exploded view / inventor's sketch / silhouette / silhouette portrait / cut-paper profile / shade portrait / Georgian portrait / Regency portrait / oval gilt frame / letterpress / wood type / playbill / circus poster / Victorian poster / two-colour misregistration / woodcut poster / constructivism / constructivist poster / Soviet avant-garde / Russian avant-garde / Rodchenko style / photomontage poster / art deco / streamline moderne / 1930s travel poster / railway poster / airbrush poster / sunburst rays / Gatsby style / golden age comic / vintage comic book / comic cover / Ben-Day dots / four-color printing / newsprint / speech balloon / pulp cover / pop art / Warhol-style / pop silkscreen / silkscreen portrait / repeated pop portrait grid / ASCII art / text art / typewriter art / line printer / greenbar / fanfold paper / tractor feed / overstrike / printer plot / low poly / low-poly / retro 3D / 90s 3D game / PS1 style / N64 style / software rasterizer / flat shading / affine texture mapping / vertex fog / game HUD / stencil / stencil graffiti / spray paint stencil / street art / drips and overspray / Banksy-style stencil / embroidered patch / embroidery patch / iron-on patch / sew-on patch / merit badge / camp badge / merrow border / rocker patch / denim jacket patches / blueprint / technical drawing / crayon / kid's drawing / CRT terminal / green screen / thermal camera / thermal imaging / Delft tiles / Delft blue / cave painting / ochre / Lascaux-style / 1-bit / MacPaint-style / black-figure / Greek vase / pencil drawing / graphite / X-ray / baggage scanner / rubber hose / 1930s cartoon / linocut / lino print / VHS / home video / flat vector / flat illustration / storybook animation / squash and stretch / ballpoint / biro / ballpoint doodle / margin doodles / hand-drawn board game / overlay sheets / tracing-paper overlays / light box / colour separations / registration marks / acetate overlay / pastel UI / Dot-style product film / launch-film interface / macOS window cards / exam grading / grading an answer sheet / red-pen marking / graded test paper / rubber-stamped answer sheet / shadow puppet / shadow puppetry / Chinese shadow play / leather shadow puppets / backlit puppet screen / pen and wash / pen & wash / line and wash / ink and watercolour / ink and watercolor / fineliner sketch / fineliner and watercolour / sketchbook characters / sketch cards / urban sketching / water brush / gouache / retro gouache / gouache portrait / gouache illustration / opaque gouache / matte acrylic / picture-book portrait / vintage picture book / retro children's book illustration / mid-century children's book / big-nosed character portrait / cable-knit sweater / knitted bobble hat / blue picture book / soft blue picture book / soft-blue children's book illustration / modern picture book / limited-palette picture book / picture-book spread / scratchy ink line / dry-brush ink line / ink pencil line / crayon and pastel texture / chalky white marks / blue and coral palette / fluffy white bear / Jiangnan garden / Chinese garden / classical Chinese garden illustration / Chinese water garden / spring garden illustration / lush painterly garden / waterside pavilion / moon gate / lattice windows / zigzag bridge / weeping willow garden / upturned eaves / grey-tiled roof / blossom trees and reflections / lily pond with egrets / digital gouache landscape / dry-brush blocks / dry brush illustration / dry-brushed colour blocks / roller texture / brush-textured shapes / mid-century illustration / mid-century modern poster / mid-century editorial illustration / gouache collage / torn-paper collage poster / limited palette poster / scumbled texture / vintage book cover illustration / twilight storybook / dusk picture book / dusk to night sky / day and night split sky / pastel sunset sky / Milky Way illustration / wildflower meadow / wildflower hill / patchwork hills / tiny round trees / fireflies / paper kite / magnified detail inset / detail callout circle / scientific plate overlay / handwritten lowercase captions / cozy miniature illustration / bedtime story illustration / hatched nocturne / hatched night scene / pastel hatching night / coloured-pencil nocturne / directional strokes / short brush strokes sky / night print with margins / small art print / plate mark / pencilled title and caption / indigo night with one warm light / glowing cloud lit from below / red sprites / lava entering the sea / volcano at night / glowing threads and sparks / broken reflection on the sea / tiny figures for scale / Obsidian UI / Obsidian-style note app / dark note-taking app / dark-theme Markdown editor / note app window / file explorer sidebar / wiki links / backlinks / graph view / local graph / knowledge graph UI / properties and tags / inline code / mermaid code block / mermaid flowchart rendered / source vs reading view / callout block / reading notes app / second brain UI / knowledge base screen / canvas board / infinite whiteboard / dotted board / note-app canvas view / Obsidian-style canvas / cards and connectors / curved arrows between cards / edge labels / group frames / coloured card borders / task-list card / quote card / image card with a sketch / hand-drawn floor plan / zoom controls / camera pan and zoom / cards dropping in / moving plan board / Flexoki / Flexoki paper / Flexoki palette / warm paper and ink / docs-site diagrams / explainer sheet / diagram sheet / Mermaid-style diagrams / lightweight diagram renderer / flowchart / sequence diagram / pie chart / bar chart / comparison table / diagram wall / grey-bordered boxes / small triangular arrowheads / orange focus ring / rolling numbers / recipe explainer without an image model" 时使用;也用于需要逐步画出(draw-on)动画的插画。单独说「剪纸」指剪纸拼贴、「刺绣」指十字绣、「丝网印刷 / screen print」指包豪斯几何;「打马赛克」是打码,不是马赛克画风;单说「蓝图」指蓝图工程图,「蓝晒 / 晒图」仍指蓝晒;「铅笔 / 素描」指铅笔素描,「彩铅」指韩国彩铅;「像素」仍指像素风,「1-bit / 黑白画图软件」指 1-bit 早期画图软件;「霓虹」仍指赛博朋克;「喷漆 / 街头涂鸦」仍指喷漆模板涂鸦,「圆珠笔 / 随手涂鸦 / 页边涂鸦」指圆珠笔涂鸦;「描图纸 / 硫酸纸 / 叠片 / 灯箱」指描图纸叠层(蓝图工程图那张描图布是晒成蓝图的,不是叠片);「Dot 风 / 粉彩界面 / 窗口卡片 / 发布会界面」指粉彩界面(纯色底 + 白色实心窗口卡片),要磨砂玻璃和弥散渐变仍用弥散玻璃;「阅卷 / 批改 / 答题卡 / 判卷 / 红笔打分」指阅卷批改,实验记录里的红笔圈和便利贴仍用实验笔记本,带「已付」橡皮章的小票拼贴仍用贴纸拼贴 · 小票;「皮影 / 皮影戏 / 影子戏」指皮影戏(透光的彩色驴皮人偶),黑纸剪出的侧影小像仍用剪影,彩纸剪贴仍用剪纸拼贴。「钢笔淡彩 / 淡彩速写 / 针管笔加水彩 / 线稿上色的速写小卡」指钢笔淡彩;单说「水彩」仍指水彩(风景、花卉的大片晕染),蓝铅笔稿 + 毛笔线 + 赛璐璐阴影的拟人小物仍用卡通手绘,「素描 / 铅笔」仍指铅笔素描。「水粉 / 复古水粉 / 绘本大头像 / 复古童书插画」指复古水粉(不透明水粉画的特写大头像);梵高式厚涂的风景、名画感仍用油画厚涂,扁平矢量、会挤压拉伸的小角色动画(「绘本动画」)仍用绘本角色动画,针管笔线稿加淡彩的速写小卡仍用钢笔淡彩,撞色多格的头像仍用波普丝网。「蓝调绘本 / 软蓝绘本 / 蓝色童书插画 / 绘本跨页」指蓝调绘本(软蓝限色的现代绘本跨页:干笔墨线 + 干蜡笔粉彩上色 + 白粉笔痕);单说「绘本」仍指绘本角色动画,「水粉 / 绘本大头像」仍指复古水粉,「编辑风 / Riso」仍指编辑风手绘,针管笔线稿加淡彩的速写小卡仍用钢笔淡彩,小孩自己画的蜡笔画仍用儿童蜡笔画。「江南园林 / 园林春景 / 中式园林插画 / 粉墙黛瓦 / 飞檐 / 月洞门 / 九曲桥」指江南园林(细笔数字水粉的园林春景:叶形小笔触堆出的繁茂树冠、繁花、垂柳、黛瓦飞檐、碧水倒影、层层远山);单说「水墨 / 山水」仍指水墨,单说「水彩」仍指水彩,动漫背景 / 赛璐璐天空仍指日本动漫,浮世绘仍是浮世绘;梵高式厚涂的风景仍用油画厚涂,皮影人偶的一场戏仍用皮影戏。「干刷色块 / 干笔色块 / 滚筒色块 / mid-century 海报插画」指干刷色块(米白纸上几大块干笔或滚筒刷出的限色色块,人物拆成几个大块面,背后一块纯色板、一旁一个小红方块);单说「水粉 / 绘本大头像」仍指复古水粉,「剪纸 / 彩纸拼贴」仍指剪纸拼贴,「丝网印刷 / screen print」仍指包豪斯几何,「Riso / 编辑风」仍指编辑风手绘,没有笔触的平滑几何色块仍用扁平矢量。「暮色微缩绘本 / 暮色绘本 / 黄昏转夜 / 昼夜交界 / 野花坡 / 细节放大图」指暮色微缩绘本(粉彩黄昏转入银河夜空、拼布山丘、几万朵小野花、很小的原创角色,加圆形放大图和手写小字);单说「绘本」仍指绘本角色动画,「蓝调绘本 / 软蓝绘本」仍指蓝调绘本,赛璐璐天空和夏日少年感仍用日本动漫,大片晕染的风景仍用水彩,整页的机械分解手稿仍用达·芬奇手稿,剖面和施工图仍用蓝图工程图。「排线夜景 / 彩铅或色粉夜景 / 短笔触夜空 / 夜景小版画 / 熔岩入海 / 精灵闪电 / 被照亮的云」指排线夜景(满画面顺着风向的短笔触、深蓝夜色里只有一个暖光、发光的丝和火星、碎的倒影、很小的人,装成带纸边和铅笔字的小版画);梵高式的厚涂漩涡和颜料浮雕仍用油画厚涂,明亮可爱的彩铅甜品仍用韩国彩铅,黑白石墨排线仍用铅笔素描,粉彩黄昏转入银河星空、满坡小野花仍用暮色微缩绘本,霓虹雨夜街道仍用赛博朋克。「Obsidian 风 / 笔记应用界面 / 深色笔记软件 / 双链笔记 / 关系图谱 / mermaid 代码块渲染成图」指笔记应用界面(深色主题的笔记应用窗口:文件列表、Markdown 正文、代码块切到阅读视图渲染成流程图、亮紫光点的关系图谱,只有一个紫色强调色);明亮的粉彩底和白色窗口卡片仍用粉彩界面,点阵无限白板上的卡片和弯曲连线用白板卡片,暖白纸面上的浅灰卡片图表用 Flexoki 纸面,磨砂玻璃和弥散渐变仍用弥散玻璃,绿屏荧光字符的老终端仍用绿屏终端 CRT,霓虹全息的未来界面仍用赛博朋克。「白板卡片 / 无限白板 / Canvas 视图 / 卡片和连线 / 点阵白板 / 分组框 / 带箭头的弯曲连线」指白板卡片(深色应用窗口里随镜头平移缩放的点阵白板:分组框、彩色边卡片、带箭头和标签的弯曲连线、清单 / 引用 / 草图卡片、右上角缩放按钮);笔记正文页、文件列表和关系图谱仍用笔记应用界面,暖白纸上的流程图、时序图和图表仍用 Flexoki 纸面,明亮的粉彩产品界面和检查结果仍用粉彩界面,一层层叠起来的图解仍用描图纸叠层。「Flexoki / Flexoki 纸面 / 暖白纸上的图解页 / Mermaid 那样的流程图、时序图、饼图、柱状图、对比表 / 讲解片里的图表页」指 Flexoki 纸面(暖白纸、墨黑字、不描边的浅灰圆角卡片,卡片里的图照轻量图表渲染器画:灰边框、墨线小三角箭头、普通标签,强调色只点在有意义的地方);手写粉笔的示意图仍用黑板板书,铅笔图表、荧光笔和便利贴仍用实验笔记本,彩色粉彩底、macOS 窗口和 ✓ / ✗ 徽章的产品界面仍用粉彩界面,深色笔记应用窗口仍用笔记应用界面,点阵无限白板上的卡片和连线仍用白板卡片,系统的微缩模型仍用等轴 2.5D,剖面和施工图仍用蓝图工程图。+description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型,由 Claude 用代码一笔一笔「画」出图片(程序化绘画)。内置七十四种画风:中国水墨、水彩、剪纸拼贴、韩国彩铅、日本动漫、编辑风手绘(Riso)、油画厚涂(梵高式流向笔触+颜料浮雕打光)、浮世绘木版画(晕色、木纹、墨线主版、青海波)、像素风(低分辨率+Bayer 抖动+像素字体)、黏土定格(高度图捏出的彩泥+影棚打光)、蓝晒(普鲁士蓝日光晒图,植物剪影透光)、十字绣(Aida 布十字绣+回针绣+缎面绣+法式结)、复古仪器面板(60 年代收音机/仪器正面:柚木、拉丝铝、旋钮、刻度窗、指示灯)、贴纸拼贴·小票(模切乙烯贴纸、热敏小票、和纸胶带、吊牌、橡皮章)、实验笔记本·贴纸(线圈方格本、铅笔图表、荧光笔、红笔圈、便利贴)、黑板板书(墨绿石板、粉笔颗粒、板擦残影、示意图与公式)、赛博朋克(雨夜霓虹街道、玻璃管霓虹招牌、全息广告、湿路面倒影)、卡通手绘(蓝铅笔稿、毛笔线、错位平涂、赛璐璐阴影、逐帧抖线)、等轴 2.5D(正等轴微缩模型、一个太阳照出三面明暗、悬浮数据卡)、单线画(一根不断开的线一笔画完、唯一点睛色)、柔光 3D(光线追踪的糖果色小球海和鼓鼓的软字、景深)、形变动画(一条轮廓依次变形、洋葱皮残影、缓动曲线)、报刊拼贴(牛皮纸、手撕旧报纸、网点老照片、勒索信拼贴字)、弥散玻璃(弥散渐变、磨砂玻璃卡片界面)、包豪斯几何(三原色几何、丝网印刷海报)、复古 Synthwave(切口落日、霓虹网格、镀铬字、录像带质感)、拼豆(钉板上的熔珠小管、熨烫熔合)、岩画(沙漠漆上凿出的凹坑图形、新旧凿痕、剥落)、古埃及墓室壁画(灰泥墙、红格起稿、分栏叙事、象形文字、剥落)、罗马马赛克(石子与玻璃沿轮廓一排排铺、灰缝、燕尾铭牌)、彩色玻璃花窗(哥特尖拱窗、通体着色玻璃、grisaille 彩绘与银染、铅条、透光)、泥金手抄本(羊皮纸、鹅毛笔哥特体、朱红标题、打磨金箔首字母)、达·芬奇手稿(铁胆墨水、左手排线、红粉笔、镜像手写、机械分解图)、剪影(黑纸剪出的侧影小像、薄金粉、椭圆金框)、凸版印刷海报(木活字、红黑双色错版、木刻插图)、苏联构成主义(红黑两版、斜条与楔形、西里尔大字、网点照片拼贴)、装饰艺术 Art Deco(1930 年代喷枪流线型海报、交替射线、阶梯高楼、金色 Deco 字)、黄金时代漫画(毛笔墨线、Ben-Day 网点、四色错版、新闻纸)、波普丝网(多格撞色平涂 + 错位的照相黑版)、ASCII 字符画(行式打印机、绿条连续纸、叠打)、低多边形(1999 年代 3D:平面着色、仿射贴图、逐顶点雾、15 位色抖动)、喷漆模板涂鸦(混凝土墙上多层卡纸模板喷绘、雾化与滴痕)、刺绣徽章(牛仔布上的机绣徽章:填充绣、缎面绣、锁边)、蓝图工程图(描图墨线晒成蓝底白线)、儿童蜡笔画(小孩在糙纸上的蜡笔涂抹)、绿屏终端 CRT(荧光字符画、扫描线、余辉)、热成像(先画温度场再上伪彩色)、代尔夫特蓝瓷砖(锡釉砖上的钴蓝手绘)、洞穴壁画(火光下的赭石、吹喷手印)、1-bit 早期画图软件(黑白整屏、8×8 图案填充)、古希腊黑绘陶瓶(黑釉剪影、刻线、饰带展开图)、铅笔素描(石墨排线、擦笔、边缘只剩线稿)、X 光片(安检透视、轮廓发亮、伪彩)、1930 年代黑白橡皮管动画(白手套、饼切眼、老胶片)、黑白麻胶版画(刻刀减法、手拓发花、套色错版)、VHS 家庭录像(钨丝灯偏色、色度渗色、REC)、扁平矢量(分层几何色块、七色、层间投影)、绘本角色动画(小角色挤压拉伸的真动画)、圆珠笔涂鸦(蓝红圆珠笔线稿、墨团、彩铅、页边涂鸦)、描图纸叠层(灯箱上的黑线底图 + 一张张单色描图纸叠片:正片叠底、套准十字、定位钉、绘图胶带)、粉彩界面 · Pastel UI(产品发布片式的界面画面:纯色粉彩底与大光斑、macOS 窗口卡片、胶囊与粗黑标题色条、状态标签与 ✓ / ✗ 徽章、放大镜、从卡片边探头的扁平小图标)、阅卷批改 · Exam Grading(绿毛毡桌上被红笔批改的答题卡:定位黑块、考号涂卡、得分格与阅卷栏、长尾夹夹住的标准答案卡、油墨不均的朱红印章、立体红笔、波浪线 / 圈 / 引线 / 批注 / 叉 / 圈起来的分数)、皮影戏 · Shadow Puppetry(油灯照亮的幕布上,雕空、透明染色的驴皮关节人偶:镂空纹样、阳刻空脸、雉翎盔头、线结与操纵杆、离幕时虚化的双影;雕花戏台、红漆金字牌匾、红灯笼)、钢笔淡彩 · Pen & Wash(速写小卡上的针管笔线稿 + 松散淡彩:线条抖、出头、不闭合,颜色错位出线、留白缝、干边与颗粒,不铺满的背景色块;大头、圆眼镜、点点眼、红鼻子的呆萌小人;卡片拍在木桌上,旁边放着针管笔和水笔)、复古水粉 · Retro Gouache(复古绘本风的水粉大头像:不透明水粉从暗到亮一层层盖上去,单色背景用干笔皴擦;大红鼻子、腮红、圆眼和大耳朵用几阶色值塑出来;看得见针脚的毛衣和毛线帽,一根根的头发和胡子,毛毡;最后是印刷书页的纸纹)、蓝调绘本 · Blue Picture Book(软蓝色调的现代绘本跨页:几乎只用粉蓝、矢车菊蓝、深青蓝三阶蓝加黑墨和纸白,只点一点珊瑚红、粉色腮红和芥末黄;毛笔 / 墨铅笔线干、抖、断,粗细不匀,线不闭合,暗部用快速来回的乱线排出来;颜色是干蜡笔、粉彩、干水粉,错位出线,纸纹的白点透出来;白粉笔痕压在蓝上,甩点和细尘;背景蓝块毛边、不到纸边;大圆脑袋、带高光的点点眼、点彩腮红和雀斑、火柴腿穿靴子的小人,乱线毛边的白色毛绒动物;最后印在书上:中缝和页码)、江南园林 · Jiangnan Garden(细笔园林春景,数字水粉插画:成千上万片叶形小笔触按一个太阳堆出树冠,暗芯、亮边、一簇簇的高光;白色和淡粉的繁花是一簇簇圆点花瓣,枝条从缝里露出来;垂柳是一绺一绺发丝般的细枝挂满小叶;黛瓦飞檐是真的瓦垄:筒瓦板瓦一行行、檐口瓦当滴水、翘起的翼角和卷起的脊头;粉墙月洞门、冰裂纹漏窗、翡翠绿槅扇和挂落、红灯笼、匾额;九曲石桥、石阶、小木船;碧绿湖面倒映岸上的一切,更柔、更暗,加涟漪和细竖纹;睡莲、白鹭;从前景花枝到雾里青山层层退远,墙上桥上落着叶影;最后一方小红印)、干刷色块 · Dry-Brush Blocks(mid-century 海报 / 水粉拼贴式的编辑插画:米白纸上几大块干笔或滚筒刷出的色块,颜色严格限定在森林绿、鼠尾草绿、青蓝、藏蓝、近黑和朱红,外加一点天蓝、淡青瓷和米色;每块颜色在自己的笔刷坐标系里刷:一道道平行的笔,起笔饱满、收笔干枯,两侧几乎是直边,两端梳成长短不一的毛齿,块里有顺笔的鬃毛纹、皴擦斑和露出来的纸色;背后的大色板用滚筒:近乎平涂、成簇的细点、干的两侧和几道细刮痕;色块像丝网套印或撕纸拼贴一样叠起来,撕口带一圈浅色纤维边;人物拆成几个大块面:亮暗两半朝不同方向刷的外套、几块肤色平面拼的头、粗黑框眼镜、干笔皴擦的白胡子;瓶子是竖刷的深色剪影加一道高光和小块标签;一旁一个小朱红方块;不勾线、不做渐变;最后像胶印:轻微柔化、纸纹、暗部零星白点、纸上细尘)、暮色微缩绘本 · Twilight Storybook(温柔、怀旧的黄昏绘本单页,满是微缩细节:大片粉彩黄昏天空,从顶上的薰衣草紫经玫瑰、蜜桃到地平线的暖金,柔和的平底云带、细细的光线和一轮低垂的淡日;一侧天空已经入夜:星空、带暗带的银河、弯月、流星,昼夜交界经过淡紫和靛蓝,不发灰;下面是一层层粉彩条纹的起伏山丘,拼布似的田、细细的垄、小圆树;前景是几万朵小野花铺成的坡,坡顶是色点,越往下越大:雏菊、矢车菊、虞美人、波斯菊、金盏花、毛茛、羽扇豆、勿忘我,夜的一侧整片变成月光蓝;很小、扁平、可爱的原创角色;上面叠一层科学图版的语言:圆形的「detail a」放大图,细墨线、排线、尺寸标注、标签和比例尺,几行灰色的小写英文手写字;最后是细颗粒、光晕、暗角和底边一道撕纸边)、排线夜景 · Hatched Nocturne(彩铅 / 色粉排线式的小幅夜景版画:天空、云、山和海全由密密的短笔触叠成,每片区域的笔触顺着同一股「风」走——天空斜着流、蒸汽绕着云团卷、山坡顺着坡向、海面横着长拖,每一笔色相和明度都差一点,笔毛分道、拖干的笔尾、纸纹里漏出的细缝,没有一处平滑渐变;深靛蓝、藏青、冷灰蓝的夜色里只有一个暖色光源,光是一层层加上去的发光笔触:核心黄白、外圈橙红、再外是被照亮的笔触,被照亮的蒸汽按「光 × 受光」上色,所以是红橙而不是粉;发光的细丝(会蜿蜒、分股、末端亮珠)、火星、星点;海面上被横向笔触打碎的倒影和光柱;几十像素高的小人靠一点亮色(围巾)点出来;最后装裱成小版画:米白纸边、压印的版痕、左下铅笔小标题、右下更小的说明,用细的普通字体)、笔记应用界面 · Obsidian UI(讲解片里的深色笔记应用窗口:近黑页面上一团淡紫光晕,窗口里有标签栏、细长图标栏、带缩进线的文件列表、粗黑 H1 下一道紫色短条、属性块和 #标签、紫色的内部链接和行内代码、带语法色的 mermaid 代码块——点「阅读」后渲染成扁平深色的流程图,一个节点亮紫——紫色左边的引用标注,右栏关系图谱里被链接的笔记亮成紫色光点;全画只有一个紫色强调色,不画官方 logo)、白板卡片 · Canvas Board(深色笔记应用的白板视图:深色页面上一扇应用窗口——红黄绿三点和「.canvas」标签页的标签栏、左边一列线性图标——里面是一块随镜头平移缩放的灰点阵无限白板;分组框和浮在框上方的组名,深色圆角卡片带 2 px 的卡片色边(红、橙、黄、绿、青、紫)和一层很淡的同色底,卡片之间是从边的中点沿法线弯出去的曲线连线,末端实心箭头、中间一块白板底色的标签;卡片里是 Markdown:标题、正文、紫色高亮、等宽行内代码、勾选清单(勾上时紫色方框弹出、对勾画出、文字变灰加删除线)、紫色竖条的引用、紫色标签胶囊、颜色编号胶囊;图片卡片上方写文件名,里面可以用手绘笔触画草图(每笔画两遍、略弯、出头,手写体批注);右上角一列缩放按钮;全画只有一个紫色强调色加卡片色;所有东西都记在白板坐标里、每次按镜头重画,任意缩放都锐利,镜头能平移缩放、卡片能掉落、连线能一点点画出来)、Flexoki 纸面 · Flexoki Paper(文档站式的图解页:暖白纸 #FFFCF0 上的墨黑字和一串暖灰,几张不描边、不投影的浅灰圆角卡片,粗黑中文标题、灰色英文类型名、等宽编号;卡片里的图照轻量图表渲染器的样子画——比底色差一级的框和 2 px 灰边(直角、圆角、胶囊、菱形、圆柱、圆)、墨线末端一个小的实心三角箭头、普通半粗体标签垫一块底色,虚线生命线和回复、带纸色缝的饼图、细网格上的柱状图、表头着色的对比表;Flexoki 的橙、红、蓝、绿、紫、青只放在有意义的地方,橙色聚焦框、黑底胶囊、字距收紧的大数字;能做成图一边一边画出来、数字滚动的动图)、暖调彩铅绘本 · Warm Pencil Storybook(暖白、有齿纹的纸上一层层叠涂的彩色铅笔绘本页:天空、山坡、草、水、一只大而温柔的生物和一个小小的孩子,全由顺着形体走向的细铅笔线叠成——天空横向长排线,山坡顺着坡势,龟壳绕着每块盾片的生长纹,脖子横过褶皱,雨衣顺着衣褶,苔藓和头发一簇簇顺毛;每块先铺一层浅色底,再上固有色、背光处叠同色系的深色,受光处罩一层暖色、阴影里罩一层冷色,每层角度错开一点、笔触交叉;蜡只挂在纸齿的峰上,同一批纸坑一层层都透出细白点,压得重、叠得多的地方才慢慢合上;后画的东西先留白再铺背景,颜色不互相混;毛是一绺一绺的:根部散开、尖端聚拢、顺着毛向,每绺受光一侧亮、背光一侧暗;没有墨线、没有黑色,只有很淡的同色轮廓;黄昏的暖光:灯笼和窗灯是一层层橙黄的发光叠涂(不是一团光晕,也不是放射线),低低的太阳给受光一侧一道暖边;水里的倒影也是一笔笔横排线;附带树、小房子、石头、鳞片、野花、纸灯笼和穿雨衣提灯笼的小孩等绘本部件)。用户说「claude绘图」「用代码画」「你自己画」「不用生图模型画」「程序化绘画」,或点名以上任一画风(含黏土、彩泥、定格动画、蓝晒、晒图、十字绣、刺绣、复古面板、老式收音机、贴纸、小票、收据、手帐拼贴、实验笔记本、方格本、荧光笔、便利贴、黑板、板书、粉笔、赛博朋克、霓虹、雨夜街道、卡通、手绘卡通、逐帧手绘、抖线、等轴、2.5D、微缩模型、单线画、一笔画、线条动画、柔光 3D、3D 渲染、C4D 风、软糖字、小球海、形变、变形动画、报刊拼贴、剪报、达达、勒索信字、网点印刷、弥散渐变、玻璃拟态、毛玻璃、包豪斯、几何构成、丝网印刷、Synthwave、蒸汽波、合成器浪潮、80 年代复古、拼豆、拼拼豆、熔珠、熨豆、豆豆画、钉板、烫豆、岩画、岩刻、凿刻、石刻、沙漠漆、史前壁刻、大角羊、古埃及、埃及壁画、墓室壁画、法老时代、象形文字、尼罗河、底比斯、罗马马赛克、马赛克镶嵌、镶嵌画、石子拼画、地砖画、古罗马地板、彩色玻璃、彩绘玻璃、花窗、玻璃花窗、教堂花窗、哥特花窗、铅条玻璃、泥金手抄本、手抄本、彩饰手抄本、中世纪手稿、羊皮纸、哥特体、花体首字母、泥金、贴金、星盘、达芬奇、达·芬奇、达芬奇手稿、手稿风、文艺复兴手稿、发明手稿、镜像字、镜像书写、扑翼机、红粉笔、钢笔排线、机械草图、分解图、剪影、剪影肖像、侧影、侧面像、黑纸剪影、剪影小像、椭圆金框、乔治时代肖像、摄政时期肖像、凸版印刷、活版印刷、木活字、铅字海报、马戏团海报、复古海报、老海报、19 世纪海报、双色套印、错版、套色错位、木刻插图、构成主义、苏联海报、苏联构成主义、俄国先锋派、罗德琴科风、红黑海报、照片蒙太奇、照片拼贴海报、西里尔字、装饰艺术、装饰风、流线型、流线型海报、1930 年代海报、旅行海报、铁路海报、火车海报、喷枪画、喷笔画、阶梯高楼、射线背景、盖茨比风、黄金时代漫画、老漫画、复古漫画、美漫封面、漫画封面、Ben-Day 网点、本戴点、网点上色、四色印刷、四色错版、新闻纸、对白框、拟声字、1940 年代漫画、波普、波普艺术、波普丝网、沃霍尔风、丝网版画头像、撞色头像、多格重复头像、六宫格撞色头像、ASCII、字符画、字符艺术、文字画、行式打印机、绿条纸、连续打印纸、针孔打印纸、老电脑打印、叠打、低多边形、低面数、低模、多边形风、千禧年 3D、90 年代 3D、复古 3D 游戏、老游戏截图、PS1 风、N64 风、平面着色、线框、游戏 HUD、飞行游戏、穿环、喷漆、模板涂鸦、镂空模板、喷漆模板、模板喷绘、街头涂鸦、街头艺术、墙绘、滴漆、班克西风格、刺绣徽章、徽章、布章、臂章、刺绣贴、绣标、锁边、牛仔外套徽章、户外徽章、营地徽章、弧形条章、蓝图、工程图、施工图、蜡笔画、儿童画、绿屏终端、CRT、显像管、热成像、热像仪、温度图、代尔夫特、荷兰蓝瓷砖、洞穴壁画、史前壁画、赭石、1-bit、黑白画图软件、MacPaint 风、黑绘、古希腊陶瓶、希腊瓶画、铅笔素描、素描、铅笔画、X 光、X 光片、安检图像、橡皮管动画、黑白卡通、老动画、麻胶版画、黑白版画、藏书票、VHS、家庭录像、录像带、扁平插画、扁平风、矢量插画、绘本动画、角色动画、挤压拉伸、圆珠笔、圆珠笔涂鸦、原子笔、页边涂鸦、课本涂鸦、手画棋盘、描图纸、硫酸纸、叠片、叠层、分色片、灯箱、拷贝台、透光台、套准、定位钉、粉彩界面、粉彩 UI、Dot 风、Dot 那种风格、产品发布会界面、发布会质感、窗口卡片、macOS 窗口、界面卡片、讲解片界面页、小图标探头、阅卷、阅卷批改、批改、判卷、改卷、改作业、答题卡、试卷、考卷、测验卷、红笔批改、红笔打分、打分数、盖章批改、朱红印章、标准答案卡、长尾夹、讲解片评测 / 打分页、皮影、皮影戏、影子戏、驴皮影、灯影戏、皮影人偶、雕花戏台、戏台牌匾、亮相、钢笔淡彩、淡彩、淡彩速写、钢笔淡彩小人、针管笔、勾线笔、针管笔加水彩、线稿上色、速写卡片、速写本小人、水彩小卡、城市速写、街头速写、水笔、自来水笔、复古水粉、水粉、水粉画、不透明水粉、哑光丙烯、复古绘本、绘本插画、绘本大头像、童书插画、复古童书、大头像、大鼻子人物、针织毛衣、麻花毛衣、毛线帽、毛毡帽、卷发、胡子、蓝调绘本、蓝色绘本、软蓝绘本、蓝调童书、软蓝童书插画、蓝色童书插画、蓝色系绘本、限色绘本、蓝白绘本、现代绘本跨页、手绘绘本跨页、绘本跨页、绘本内页、干笔墨线、墨铅笔线、粉彩蜡笔质感绘本、白色毛绒动物、毛绒白熊、点彩腮红、江南园林、园林春景、春水园林、中式园林插画、古典园林插画、国风园林插画、苏式园林、细笔园林、园林风景插画、水榭、临水茶榭、亭台楼阁、粉墙黛瓦、黛瓦白墙、飞檐翘角、翼角起翘、月洞门、漏窗、冰裂纹窗、槅扇、挂落、九曲桥、曲桥、垂柳园林、碧水倒影、园林倒影、睡莲池、数字水粉风景、细腻厚涂风景、干刷色块、干笔色块、干刷、干刷插画、干笔插画、滚筒刷、滚筒色块、色块插画、大色块插画、毛边色块、刷痕色块、粗刷笔触、mid-century、世纪中期插画、中世纪现代插画、复古编辑插画、复古海报插画、水粉拼贴、撕纸色块、限色海报、暮色微缩绘本、暮色绘本、黄昏绘本、微缩绘本、黄昏转夜、昼夜交界、日夜交界、半边黄昏半边星空、粉彩黄昏、粉紫晚霞、黄昏星空、银河插画、野花坡、野花草坡、花海插画、萤火虫、放风筝插画、拼布山丘、条纹田野、小圆树、细节放大图、局部放大图、技术细节小窗、科学图版风插画、手写英文小字、晚安绘本、治愈系绘本插画、排线夜景、排线风夜景、彩铅夜景、色粉夜景、粉彩排线、短笔触夜景、笔触夜空、方向笔触、夜景版画、小版画、限量版画风、版画装裱、版痕、纸边标题、铅笔题字、夜景插画、夜空插画、深蓝夜景、靛蓝夜空、冷暖对比夜景、唯一暖光、夜里的火光、发光的云、被照亮的云、红色精灵闪电、精灵闪电、火山夜景、熔岩入海、熔岩、岩浆、火山喷发插画、海上风暴、海面倒影、光柱倒影、火星飞溅、星点、看海的人、礁石上的人、远处的小人、小人比例尺、雪夜篝火、渔火、笔记应用界面、笔记软件界面、笔记 App 界面、Obsidian 风、Obsidian 界面、Obsidian 风格、黑曜石笔记、深色笔记界面、暗色主题界面、Markdown 笔记、Markdown 编辑器、双链笔记、内部链接、关系图谱、知识图谱界面、图谱视图、局部图谱、反向链接、文件列表、侧边栏、标签页、属性栏、行内代码、代码块、mermaid、mermaid 流程图、代码块渲染成图、源码 / 阅读切换、阅读视图、引用标注、callout、读书笔记界面、知识库界面、第二大脑、讲解片里的笔记应用、应用窗口演示、白板卡片、无限白板、白板视图、画布视图、Canvas 视图、Obsidian Canvas、Obsidian 白板、笔记应用白板、卡片白板、卡片和连线、节点和连线、带箭头的连线、弯曲连线、连线标签、分组框、点阵背景、点阵白板、深色白板、深色界面卡片、彩色边卡片、勾选清单卡片、待办卡片、引用卡片、图片卡片、草图卡片、手绘平面图、缩放按钮、镜头平移、镜头缩放、卡片掉落动画、连线画出来、搬家计划、旅行计划白板、活动计划白板、头脑风暴白板、项目拆解白板、计划白板、Flexoki、Flexoki 纸面、Flexoki 配色、Flexoki 风、暖白纸、米白纸面、墨黑字、文档站风格、文档页图解、技术文档配图、图解页、一页图解、讲解片图表页、几张图讲清楚、流程图、画流程图、时序图、序列图、饼图、柱状图、条形图、对比表、参数对比、图表合集、图表墙、Mermaid 风、Mermaid 图、图表渲染器、灰底圆角框、小三角箭头、橙色聚焦框、数字滚动、计时器大数字、配方图解、步骤图解、手冲咖啡图解、菜谱图解、工作流程图解、暖调彩铅绘本、暖调彩铅、彩铅绘本、彩铅童书、彩铅童书插画、彩色铅笔绘本、彩色铅笔童书、软彩铅、彩铅叠涂、层层叠涂的彩铅、顺着形体排线、纸齿白点、纸纹透白、怀旧童书、翻绘本的感觉、温暖怀旧的绘本、暖色绘本页、巨物与小孩、大动物和小孩、巨大温柔的生物、温柔的巨兽、大乌龟、巨龟、老乌龟、背着花园的乌龟、龟背上的小花园、大龟过河、过河、小溪、踏脚石、提灯笼的小孩、黄色雨衣、纸灯笼、亮灯的窗、亮灯的小房子、黄昏小镇、成簇的毛、顺毛、毛一绺一绺、苔藓、金黄的树),或 "draw it yourself", "paint with code", "procedural painting", "watercolor / collage / colored pencil / anime / editorial / impasto oil / ukiyo-e / pixel art / clay / claymation / cyanotype / sun print / cross-stitch / embroidery / retro instrument panel / vintage radio / sticker collage / receipt / lab notebook / graph paper / chalkboard / blackboard / cyberpunk / neon city / cartoon / hand-drawn animation / isometric / 2.5D / continuous line / one-line drawing / soft 3D / 3D render / puffy letters / ball pit / shape morph / morphing / newspaper collage / Dada / ransom note / halftone / glassmorphism / aurora gradient / Bauhaus / geometric poster / screen print / synthwave / retrowave / outrun / perler beads / hama beads / artkal / fuse beads / melty beads / pegboard beads / petroglyph / rock art / rock carving / desert varnish / Egyptian tomb painting / ancient Egypt / hieroglyphs / Theban tomb / Roman mosaic / floor mosaic / tesserae / opus vermiculatum / Pompeii mosaic / stained glass / leaded glass / church window / Gothic window / grisaille / illuminated manuscript / medieval manuscript / book of hours / gold leaf / illuminated initial / blackletter / vellum / astrolabe / da Vinci notebook / Leonardo codex / Renaissance sketchbook / mirror writing / iron-gall ink / red chalk / sanguine / ornithopter / exploded view / inventor's sketch / silhouette / silhouette portrait / cut-paper profile / shade portrait / Georgian portrait / Regency portrait / oval gilt frame / letterpress / wood type / playbill / circus poster / Victorian poster / two-colour misregistration / woodcut poster / constructivism / constructivist poster / Soviet avant-garde / Russian avant-garde / Rodchenko style / photomontage poster / art deco / streamline moderne / 1930s travel poster / railway poster / airbrush poster / sunburst rays / Gatsby style / golden age comic / vintage comic book / comic cover / Ben-Day dots / four-color printing / newsprint / speech balloon / pulp cover / pop art / Warhol-style / pop silkscreen / silkscreen portrait / repeated pop portrait grid / ASCII art / text art / typewriter art / line printer / greenbar / fanfold paper / tractor feed / overstrike / printer plot / low poly / low-poly / retro 3D / 90s 3D game / PS1 style / N64 style / software rasterizer / flat shading / affine texture mapping / vertex fog / game HUD / stencil / stencil graffiti / spray paint stencil / street art / drips and overspray / Banksy-style stencil / embroidered patch / embroidery patch / iron-on patch / sew-on patch / merit badge / camp badge / merrow border / rocker patch / denim jacket patches / blueprint / technical drawing / crayon / kid's drawing / CRT terminal / green screen / thermal camera / thermal imaging / Delft tiles / Delft blue / cave painting / ochre / Lascaux-style / 1-bit / MacPaint-style / black-figure / Greek vase / pencil drawing / graphite / X-ray / baggage scanner / rubber hose / 1930s cartoon / linocut / lino print / VHS / home video / flat vector / flat illustration / storybook animation / squash and stretch / ballpoint / biro / ballpoint doodle / margin doodles / hand-drawn board game / overlay sheets / tracing-paper overlays / light box / colour separations / registration marks / acetate overlay / pastel UI / Dot-style product film / launch-film interface / macOS window cards / exam grading / grading an answer sheet / red-pen marking / graded test paper / rubber-stamped answer sheet / shadow puppet / shadow puppetry / Chinese shadow play / leather shadow puppets / backlit puppet screen / pen and wash / pen & wash / line and wash / ink and watercolour / ink and watercolor / fineliner sketch / fineliner and watercolour / sketchbook characters / sketch cards / urban sketching / water brush / gouache / retro gouache / gouache portrait / gouache illustration / opaque gouache / matte acrylic / picture-book portrait / vintage picture book / retro children's book illustration / mid-century children's book / big-nosed character portrait / cable-knit sweater / knitted bobble hat / blue picture book / soft blue picture book / soft-blue children's book illustration / modern picture book / limited-palette picture book / picture-book spread / scratchy ink line / dry-brush ink line / ink pencil line / crayon and pastel texture / chalky white marks / blue and coral palette / fluffy white bear / Jiangnan garden / Chinese garden / classical Chinese garden illustration / Chinese water garden / spring garden illustration / lush painterly garden / waterside pavilion / moon gate / lattice windows / zigzag bridge / weeping willow garden / upturned eaves / grey-tiled roof / blossom trees and reflections / lily pond with egrets / digital gouache landscape / dry-brush blocks / dry brush illustration / dry-brushed colour blocks / roller texture / brush-textured shapes / mid-century illustration / mid-century modern poster / mid-century editorial illustration / gouache collage / torn-paper collage poster / limited palette poster / scumbled texture / vintage book cover illustration / twilight storybook / dusk picture book / dusk to night sky / day and night split sky / pastel sunset sky / Milky Way illustration / wildflower meadow / wildflower hill / patchwork hills / tiny round trees / fireflies / paper kite / magnified detail inset / detail callout circle / scientific plate overlay / handwritten lowercase captions / cozy miniature illustration / bedtime story illustration / hatched nocturne / hatched night scene / pastel hatching night / coloured-pencil nocturne / directional strokes / short brush strokes sky / night print with margins / small art print / plate mark / pencilled title and caption / indigo night with one warm light / glowing cloud lit from below / red sprites / lava entering the sea / volcano at night / glowing threads and sparks / broken reflection on the sea / tiny figures for scale / Obsidian UI / Obsidian-style note app / dark note-taking app / dark-theme Markdown editor / note app window / file explorer sidebar / wiki links / backlinks / graph view / local graph / knowledge graph UI / properties and tags / inline code / mermaid code block / mermaid flowchart rendered / source vs reading view / callout block / reading notes app / second brain UI / knowledge base screen / canvas board / infinite whiteboard / dotted board / note-app canvas view / Obsidian-style canvas / cards and connectors / curved arrows between cards / edge labels / group frames / coloured card borders / task-list card / quote card / image card with a sketch / hand-drawn floor plan / zoom controls / camera pan and zoom / cards dropping in / moving plan board / Flexoki / Flexoki paper / Flexoki palette / warm paper and ink / docs-site diagrams / explainer sheet / diagram sheet / Mermaid-style diagrams / lightweight diagram renderer / flowchart / sequence diagram / pie chart / bar chart / comparison table / diagram wall / grey-bordered boxes / small triangular arrowheads / orange focus ring / rolling numbers / recipe explainer / warm pencil storybook / coloured-pencil storybook / colored pencil picture book / soft pencil textures / layered coloured pencil / pencil strokes following the form / paper tooth specks / nostalgic children's storybook / giant gentle creature and a small child / giant tortoise / tortoise with a garden on its back / stepping stones / child with a lantern / yellow raincoat / paper lantern / lit windows at dusk / tufted fur in locks / Midjourney sref 3220081856 look without an image model" 时使用;也用于需要逐步画出(draw-on)动画的插画。单独说「剪纸」指剪纸拼贴、「刺绣」指十字绣、「丝网印刷 / screen print」指包豪斯几何;「打马赛克」是打码,不是马赛克画风;单说「蓝图」指蓝图工程图,「蓝晒 / 晒图」仍指蓝晒;「铅笔 / 素描」指铅笔素描,「彩铅」指韩国彩铅;「像素」仍指像素风,「1-bit / 黑白画图软件」指 1-bit 早期画图软件;「霓虹」仍指赛博朋克;「喷漆 / 街头涂鸦」仍指喷漆模板涂鸦,「圆珠笔 / 随手涂鸦 / 页边涂鸦」指圆珠笔涂鸦;「描图纸 / 硫酸纸 / 叠片 / 灯箱」指描图纸叠层(蓝图工程图那张描图布是晒成蓝图的,不是叠片);「Dot 风 / 粉彩界面 / 窗口卡片 / 发布会界面」指粉彩界面(纯色底 + 白色实心窗口卡片),要磨砂玻璃和弥散渐变仍用弥散玻璃;「阅卷 / 批改 / 答题卡 / 判卷 / 红笔打分」指阅卷批改,实验记录里的红笔圈和便利贴仍用实验笔记本,带「已付」橡皮章的小票拼贴仍用贴纸拼贴 · 小票;「皮影 / 皮影戏 / 影子戏」指皮影戏(透光的彩色驴皮人偶),黑纸剪出的侧影小像仍用剪影,彩纸剪贴仍用剪纸拼贴。「钢笔淡彩 / 淡彩速写 / 针管笔加水彩 / 线稿上色的速写小卡」指钢笔淡彩;单说「水彩」仍指水彩(风景、花卉的大片晕染),蓝铅笔稿 + 毛笔线 + 赛璐璐阴影的拟人小物仍用卡通手绘,「素描 / 铅笔」仍指铅笔素描。「水粉 / 复古水粉 / 绘本大头像 / 复古童书插画」指复古水粉(不透明水粉画的特写大头像);梵高式厚涂的风景、名画感仍用油画厚涂,扁平矢量、会挤压拉伸的小角色动画(「绘本动画」)仍用绘本角色动画,针管笔线稿加淡彩的速写小卡仍用钢笔淡彩,撞色多格的头像仍用波普丝网。「蓝调绘本 / 软蓝绘本 / 蓝色童书插画 / 绘本跨页」指蓝调绘本(软蓝限色的现代绘本跨页:干笔墨线 + 干蜡笔粉彩上色 + 白粉笔痕);单说「绘本」仍指绘本角色动画,「水粉 / 绘本大头像」仍指复古水粉,「编辑风 / Riso」仍指编辑风手绘,针管笔线稿加淡彩的速写小卡仍用钢笔淡彩,小孩自己画的蜡笔画仍用儿童蜡笔画。「江南园林 / 园林春景 / 中式园林插画 / 粉墙黛瓦 / 飞檐 / 月洞门 / 九曲桥」指江南园林(细笔数字水粉的园林春景:叶形小笔触堆出的繁茂树冠、繁花、垂柳、黛瓦飞檐、碧水倒影、层层远山);单说「水墨 / 山水」仍指水墨,单说「水彩」仍指水彩,动漫背景 / 赛璐璐天空仍指日本动漫,浮世绘仍是浮世绘;梵高式厚涂的风景仍用油画厚涂,皮影人偶的一场戏仍用皮影戏。「干刷色块 / 干笔色块 / 滚筒色块 / mid-century 海报插画」指干刷色块(米白纸上几大块干笔或滚筒刷出的限色色块,人物拆成几个大块面,背后一块纯色板、一旁一个小红方块);单说「水粉 / 绘本大头像」仍指复古水粉,「剪纸 / 彩纸拼贴」仍指剪纸拼贴,「丝网印刷 / screen print」仍指包豪斯几何,「Riso / 编辑风」仍指编辑风手绘,没有笔触的平滑几何色块仍用扁平矢量。「暮色微缩绘本 / 暮色绘本 / 黄昏转夜 / 昼夜交界 / 野花坡 / 细节放大图」指暮色微缩绘本(粉彩黄昏转入银河夜空、拼布山丘、几万朵小野花、很小的原创角色,加圆形放大图和手写小字);单说「绘本」仍指绘本角色动画,「蓝调绘本 / 软蓝绘本」仍指蓝调绘本,赛璐璐天空和夏日少年感仍用日本动漫,大片晕染的风景仍用水彩,整页的机械分解手稿仍用达·芬奇手稿,剖面和施工图仍用蓝图工程图。「排线夜景 / 彩铅或色粉夜景 / 短笔触夜空 / 夜景小版画 / 熔岩入海 / 精灵闪电 / 被照亮的云」指排线夜景(满画面顺着风向的短笔触、深蓝夜色里只有一个暖光、发光的丝和火星、碎的倒影、很小的人,装成带纸边和铅笔字的小版画);梵高式的厚涂漩涡和颜料浮雕仍用油画厚涂,明亮可爱的彩铅甜品仍用韩国彩铅,黑白石墨排线仍用铅笔素描,粉彩黄昏转入银河星空、满坡小野花仍用暮色微缩绘本,霓虹雨夜街道仍用赛博朋克。「Obsidian 风 / 笔记应用界面 / 深色笔记软件 / 双链笔记 / 关系图谱 / mermaid 代码块渲染成图」指笔记应用界面(深色主题的笔记应用窗口:文件列表、Markdown 正文、代码块切到阅读视图渲染成流程图、亮紫光点的关系图谱,只有一个紫色强调色);明亮的粉彩底和白色窗口卡片仍用粉彩界面,点阵无限白板上的卡片和弯曲连线用白板卡片,暖白纸面上的浅灰卡片图表用 Flexoki 纸面,磨砂玻璃和弥散渐变仍用弥散玻璃,绿屏荧光字符的老终端仍用绿屏终端 CRT,霓虹全息的未来界面仍用赛博朋克。「白板卡片 / 无限白板 / Canvas 视图 / 卡片和连线 / 点阵白板 / 分组框 / 带箭头的弯曲连线」指白板卡片(深色应用窗口里随镜头平移缩放的点阵白板:分组框、彩色边卡片、带箭头和标签的弯曲连线、清单 / 引用 / 草图卡片、右上角缩放按钮);笔记正文页、文件列表和关系图谱仍用笔记应用界面,暖白纸上的流程图、时序图和图表仍用 Flexoki 纸面,明亮的粉彩产品界面和检查结果仍用粉彩界面,一层层叠起来的图解仍用描图纸叠层。「Flexoki / Flexoki 纸面 / 暖白纸上的图解页 / Mermaid 那样的流程图、时序图、饼图、柱状图、对比表 / 讲解片里的图表页」指 Flexoki 纸面(暖白纸、墨黑字、不描边的浅灰圆角卡片,卡片里的图照轻量图表渲染器画:灰边框、墨线小三角箭头、普通标签,强调色只点在有意义的地方);手写粉笔的示意图仍用黑板板书,铅笔图表、荧光笔和便利贴仍用实验笔记本,彩色粉彩底、macOS 窗口和 ✓ / ✗ 徽章的产品界面仍用粉彩界面,深色笔记应用窗口仍用笔记应用界面,点阵无限白板上的卡片和连线仍用白板卡片,系统的微缩模型仍用等轴 2.5D,剖面和施工图仍用蓝图工程图。「暖调彩铅绘本 / 彩铅绘本 / 彩铅童书插画 / 巨物与小孩 / 大龟过河 / 纸齿白点 / 层层叠涂」指暖调彩铅绘本(暖白纸上满画面顺形体的彩铅叠涂、纸齿透出细白点、毛发成簇顺毛,大而温柔的生物和小小的孩子,黄昏暖光和橙黄的灯,没有墨线和黑色);单说「彩铅」仍指韩国彩铅(明亮可爱的甜品小物、粉嫩高光),黑白石墨仍用铅笔素描,软蓝限色、刮擦墨线加蜡笔颗粒的绘本跨页仍用蓝调绘本,粉彩黄昏转入星空、满坡小野花仍用暮色微缩绘本,不透明水粉的特写大头像仍用复古水粉,深蓝夜色里只有一个暖光的排线小版画仍用排线夜景;单说「绘本」仍指绘本角色动画。---# Claude 绘图@@ -87,6 +87,7 @@ description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型| 笔记应用界面 · Obsidian UI | `lib/obsidianui.py` · `ObsidianUI` | `examples/obsidianui_reading_notes.py` 小王子 · 读书笔记 · Reading Notes(讲解片里的一帧笔记应用:#161616 的近黑页面,左上一团淡紫光晕;窗口里是标签栏「小王子 · 狐狸」(当前标签底边打开,和笔记连成一片)、细长图标栏、文件列表(展开的「2026 读书」挂一条缩进线,「小王子」高亮)、面包屑「2026 读书 / 小王子」和右侧边栏;笔记里粗黑 H1「小王子」下一道带辉光的紫色短条,属性块「标签 #童话 #读书笔记」「读完 2026-10-12」,两行正文:紫色的内部链接「狐狸」「驯养」、行内代码「建立联系」、加粗的「彼此需要」;一个 mermaid 代码块逐行敲出(语法色、紫色块状光标跟着行尾走),指针点「源码 / 阅读」切到阅读视图,渲染成流程图「陌生 —花时间→ 驯养 → 彼此需要 → 独一无二」,「驯养」亮紫并加一圈外环;下面是紫色左边的引用标注「狐狸说」;右栏「局部关系图谱」:书里的人物和地点是灰点灰线,这篇笔记链接到的四篇(小王子、狐狸、玫瑰、驯养)亮成紫色光点、连线变紫,下面三条反向链接,右下角浮着状态栏;`--accent` 可换强调色;`--stages` 出 93 个阶段加成品,会动的东西拆成中间姿态) | 约 0.5 秒(加 `--stages` 约 5 秒) || 白板卡片 · Canvas Board | `lib/canvasboard.py` · `CanvasBoard` | `examples/canvasboard_moving_plan.py` 搬家计划 · Moving Plan(深色页面左上一片淡紫光,一扇深色应用窗口:标签栏上红黄绿三点和标签页「搬家计划.canvas ×」,左边一列线性图标,右上角一列缩放按钮 + − 适合窗口 ?;窗口里是灰点阵的无限白板,三个分组框,组名浮在框上方。「收拾 · 第 1 周」:紫边、带淡紫光圈的选中卡片「搬家计划」——老城区 → 河边新家,「11 月 8 日 · 周六 · 还有 12 天」里后半句压着紫色高亮,三个紫色标签胶囊;红边清单「先清掉的东西」,三项打了紫色勾、变灰加删除线,两项还空着;组外一张散放的采购卡和紫色进度条「已买 2/3」。「搬家当天 · 11/8」:时间线卡,一根竖线串起 08:00 → 13:30 四个时间点,最后一个是紫点、「新家卸货」压紫色高亮;黄边卡片「箱子编号」,四个颜色胶囊 厨房 K1–K6(橙)、书房 S1–S9(青)、卧室 B1–B5(绿)、易碎 ×4(红)。「新家 · 河边 3 楼」:图片卡片「新家平面图.png」,深色方格纸上手绘的平面图——墙、门的开启弧线、窗、卧室里绿色的床、客厅里青色的书桌、厨房橙色的台面、手写体房间名,一条紫色虚线从大门画到床边,旁边手写「床先进卧室」;紫色竖条的引用卡「先把床装好,其他的明天再说。」;绿边清单「第一晚要用的」,底下一行「都装在 `B1` 箱」。四条弯曲连线带箭头和标签:紫色「当天」、灰色「装箱」「13:30」、绿色「B1 先开」;`--stages` 出 121 个阶段加成品:卡片一张张掉落、打勾、连线画出、镜头平移到下一组、平面图一笔笔画出、指针点「适合窗口」后拉远到整块白板) | 约 0.6 秒(`--stages` 约 26 秒) || Flexoki 纸面 · Flexoki Paper | `lib/flexoki.py` · `FlexokiPaper` | `examples/flexoki_pour_over.py` 一杯手冲咖啡 · Pour-over, in Five Diagrams(暖白纸 #FFFCF0 上的一页图解:左上黑底胶囊「图解 · 手冲咖啡」、粗黑大标题「一杯手冲咖啡」和灰色英文 Pour-over, in five diagrams,右上灰胶囊「总时长」和大字 2:30;五张不描边的浅灰圆角卡片排成两行(右边一列和上一行共用一条缝),每张有粗黑中文标题、灰色英文类型名和等宽编号:① 流程图「从豆子到一杯」:称豆 15 g → 研磨 · 中细 → 冲洗滤纸 → 闷蒸 30 g 水,往下到菱形「鼓包平了?」,绿色「是」→ 分两段注水 → 胶囊形「出杯」,红色「否」沿一条倒圆角的折线绕回闷蒸;② 时序图「两分半里发生了什么」:水壶 / 滤杯 / 分享壶三条虚线生命线、滤杯上的激活条、左边一列等宽时间 0:00 0:45 1:15 2:30、三次注水、浅黄便签「排气 · 45 s」、虚线回复「约 210 g 咖啡液」;③ 柱状图「磨多细,滴多久」:粗 / 中 / 中细 / 细四根青色柱,选中的中细是橙色,柱顶写时间;④ 饼图「240 g 水分三次」:30 / 120 / 90 g 三块(橙、蓝、绿),块之间是纸色的缝,块上写 1/8 1/2 3/8,旁边图例;⑤ 对比表「三种冲法」:手冲 / 法压壶 / 意式(表头前橙、紫、青三个小圆点)× 方式、研磨、时间、口感,手冲一列套橙色圆角框;底下一行灰色小字写配方并注明数字是示意;`--stages` 出 151 个阶段加成品:标题升起,五张卡片暗着升起,再一张张亮起、套上橙色聚焦框,图一边一边画出来——框弹出,线画过去再落下箭头,消息飞过去,右上的计时器从 0:00 走到 2:30,柱子长高、数字跟着滚,饼图顺时针扫开,表格一行行滑进来) | 约 0.3 秒 |+| 暖调彩铅绘本 · Warm Pencil Storybook | `lib/pencilbook.py` · `PencilStorybook` | `examples/pencilbook_tortoise_crossing.py` 大龟过河 · The Tortoise Crossing(一页暖调彩铅绘本:黄昏,一只很老、很大的乌龟慢慢蹚过一条浅浅的小溪,背上长着一座小花园——一圈连成片的苔藓垫,垂下一绺绺长苔藓,里面几丛草和野花、一棵秋天金黄的小树、一根弯木杆上挂着一盏纸灯笼;它低下头,用一双老而温和的眼睛看着身旁踏脚石上的小孩:黄色雨衣、帽子放下、短短的波波头、红靴子,也提着一盏灯笼,仰头看它;龟壳一块块盾片都是低低的穹顶,绕着生长纹排线,沟是断续的深褐线,受光的左侧被落下的太阳镶一道暖边,右边背光面叠一层冷紫;脖子横着几道松弛的褶,腿上一片片小鳞,前腿往前迈、后腿往后蹬,肚子底下的水压在阴影里;背后是从软蓝到蜜桃、奶油黄的天空和留白的云,太阳刚落到远山后面,山坡上几栋小房子亮了灯;水里是一笔笔横排线画出的倒影:天、窗灯、龟腿和小孩;近岸两丛开小花的灌木框住画面;所有面都是顺形体的细彩铅线一层层叠出来的,纸齿透出细白点,没有墨线和黑色;照绘本画家的顺序画:空纸、天空(先把龟、树和灯杆留白)、远山和小镇、溪流、龟的浅色底层、塑形、背上的花园、踏脚石和小孩、倒影和涟漪,最后是灯光和近岸;`--stages` 出 9 个阶段加成品) | 约 40 秒 |各画风共用 `lib/core.py` 里的底层工具:噪声、模糊、样条曲线、多边形遮罩、有机轮廓 `blob_pts`、毛笔 `bristle_stroke`、中文字体查找;新四种还用到补零平移 `shift`、文字遮罩 `text_mask`、西文字体查找 `latin_font`/`load_font`,以及高度图打光 `height_normals`、`height_shadow`(沿光线步进的投影)、`ambient_occlusion`。@@ -163,7 +164,8 @@ description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型- 夜里的一个瞬间:一处火光、闪电、极光、篝火、渔火、熔岩、烟花,配一大片深蓝的天和水,要一眼就是「手画的小幅版画」、有满画面的笔触感和一点孤独,讲解片里的「一个极短的瞬间」「远处发生的大事」「自然现象」页,文章配图和海报 → 排线夜景(要梵高式厚涂漩涡和颜料浮雕用油画厚涂;要粉彩黄昏转入银河、满坡野花用暮色微缩绘本;要霓虹雨夜街道用赛博朋克;要黑白石墨排线用铅笔素描;要明亮可爱的彩铅小物用韩国彩铅);- 讲解片里讲「笔记 / 知识库 / 双链 / Markdown / 代码块怎么变成图」的那一页,或任何要「在一个像真的深色应用窗口里演示一个操作」的画面:文件列表、标题和正文、代码块切到阅读视图渲染、关系图谱亮起来,一屏讲清一件事 → 笔记应用界面(要明亮的粉彩底和白色窗口卡片用粉彩界面;要点阵白板上的卡片和连线用白板卡片;要暖白纸面上的图表用 Flexoki 纸面;要磨砂玻璃和弥散渐变用弥散玻璃;要绿屏荧光字符用绿屏终端 CRT);- 计划和想法之间的关系,「把几张卡片摆在一块白板上、用箭头连起来」的整理:旅行 / 搬家 / 活动计划、读书和研究笔记的脉络、头脑风暴、项目拆解、评论区里的一问一答,讲解片里「白板上一步步摆出来、镜头跟着移过去」的页 → 白板卡片(要笔记正文、文件列表和关系图谱用笔记应用界面;要暖白纸上的流程图和图表用 Flexoki 纸面;要明亮的粉彩产品界面用粉彩界面;要一层层叠起来的图解用描图纸叠层);-- 讲解片、文档、教程里的「图表页」:步骤和流程、时间线上的往来、占比、对比,要像文档站或技术博客里的图——暖白纸、墨黑字、浅灰圆角卡片,图像 Mermaid 渲染出来那样干净(灰边框、墨线小三角箭头、普通标签),一页放几张图讲清一件事(一份配方、一个工作流程、一次部署、一组产品数字),还能做成「图一边一边画出来、数字滚动」的动图 → Flexoki 纸面(要手写粉笔的示意图用黑板板书;要铅笔图表和便利贴的实验记录用实验笔记本;要彩色粉彩底和 macOS 窗口的产品界面用粉彩界面;要深色笔记应用窗口用笔记应用界面;要点阵白板上的卡片和连线用白板卡片;要系统的微缩模型用等轴 2.5D)。+- 讲解片、文档、教程里的「图表页」:步骤和流程、时间线上的往来、占比、对比,要像文档站或技术博客里的图——暖白纸、墨黑字、浅灰圆角卡片,图像 Mermaid 渲染出来那样干净(灰边框、墨线小三角箭头、普通标签),一页放几张图讲清一件事(一份配方、一个工作流程、一次部署、一组产品数字),还能做成「图一边一边画出来、数字滚动」的动图 → Flexoki 纸面(要手写粉笔的示意图用黑板板书;要铅笔图表和便利贴的实验记录用实验笔记本;要彩色粉彩底和 macOS 窗口的产品界面用粉彩界面;要深色笔记应用窗口用笔记应用界面;要点阵白板上的卡片和连线用白板卡片;要系统的微缩模型用等轴 2.5D);+- 温暖、怀旧、像翻开一本童书的一页:一只大而温柔的生物陪着一个小小的孩子(巨龟、大熊、温柔的怪兽陪孩子过河、等车、看日落),午后和黄昏的暖光、亮灯的窗和灯笼、草地、小溪和小镇,要满画面看得见彩色铅笔的笔触和纸齿,讲解片里「温柔的陪伴 / 慢慢来 / 一起走一段」的页,童书封面和插页 → 暖调彩铅绘本(要明亮可爱的彩铅甜品小物用韩国彩铅;要软蓝限色、乱线墨线的绘本跨页用蓝调绘本;要粉彩黄昏转入星空、满坡野花用暮色微缩绘本;要黑白石墨写生用铅笔素描;要不透明水粉的特写大头像用复古水粉)。每种画风一幅范例作为质量基准(范例都不用禅意主题);水墨另加一幅「月印万川」(留白托月、水面倒影)。@@ -1249,6 +1251,31 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask- 图表:`pie(cx, cy, r, values, colours, sweep, gap=3, labels, label_r)` 从十二点顺时针,`sweep` 0–1 扫开,块之间是 gap px 的底色缝;`legend(x, y, items=[(颜色, 名字, 数值)], size, pitch, value_x, alpha)`(alpha 可以每行一个);`bars(x0, y0, x1, y1, values, labels, colours, vmax, ticks, tick_fmt, p, value_fmt, bar_w, value_colours)`(p 可以每根一个,柱顶数值按 p 滚动);`table(x, y, widths, n_rows, row_h, head_h, header, dots)` 画框和表头,返回 Table(`cell(i, j)`、`col(j)`、`box`),`table_row(t, i, cells, colours, weights)` 画一行(每行可以放一层)。- 色板常量 `PAPER BG2 UI UI2 UI3 TX3 TX2 TX1B INK`、`BASE50 … BASE950 BLACK`、`RED RED4 ORANGE ORANGE4 YELLOW YELLOW4 GREEN GREEN4 CYAN CYAN4 BLUE BLUE4 PURPLE PURPLE4 MAGENTA MAGENTA4`、`ACCENTS SERIES THEMES PALETTE`;颜色也可以写强调色的名字('orange' 是 400 档,'orange6' 是 600 档);`mix(a, b, t)`;`render()`、`composite()`、`stage(name)`、`save(path, stages_dir)`;`save('x.jpg')` 默认 quality 88、4:4:4 色度。+**暖调彩铅绘本 `PencilStorybook`**:+- 思路:照彩铅绘本画家的顺序画一页(空纸 → 先把主体留白、铺天空 → 远景 → 水 → 主体的浅色底层 → 塑形 → 细节和毛发 → 人物 → 倒影 → 灯光和近景),每一块面都是顺着形体走向的细铅笔线一层层叠出来的,没有墨线、没有黑色。+ - 纸:直方图均衡过的纸纹 `T`(0–1 均匀分布,以 1 px 的细颗粒为主),所以「蜡挂在纸纹高于 1 − 压力的地方」直接就是覆盖率;预先算好沿 8 个方向拖开的纸纹,每一笔按自己的方向取,漏掉的纸坑顺着笔拉成很短的道。纸坑里也留一点蜡(`floor` 0.34);另有一张蜡层缓冲 `F`,叠得越多,后面的笔越能压进纸坑——所以同一批纸坑一层层都透出细白点(越来越带色),压得重、叠得多的地方才慢慢合上。+ - 一笔:中心线在方向场里积分出来(方向按 mod π 处理,中途不会掉头),带一点手腕的弧度。几万笔一次画完:Pillow 把每一笔当折线按序号画进 2 倍超采样的整数 id 图,numpy 只对被盖住的子像素查回这一笔的颜色、起点、方向、长度、压力和收笔,算出沿笔的位置,得到压力曲线(落笔重、收笔轻挑),蜡只落在压力够得着的(同方向拖开的)纸纹上,再用 bincount 汇回像素。同一批里最上面那笔说了算,层次靠多遍(`passes`)叠。+ - 落笔位置用抖动网格(排线均匀,不会一团一团);区域既是落笔概率,也是逐像素的压力(`fade`),所以暗部是平滑的过渡,不是散落的深色短线;`avoid` 是后面要画的东西:铺天空时先把龟、树和灯杆留白,颜色才不会和蓝色混在一起。+ - 蜡的混色:新 = 旧 + 覆盖 ×(目标 − 旧),目标 =(1 − opacity)× 旧 × 颜色 / 纸色 + opacity × 颜色。盖在白纸上就是本色,黄盖在蓝上变绿,同色越叠越深;浅色(白、奶油、黄)盖在深色上要调高 `opacity`(压光)。+ - 塑形:`shading()` 把轮廓鼓成一个软穹顶(几层模糊相加),按法线和光的方向(默认左上)给出 0–1 的受光;`form()` 照彩铅画家的塑形:整块铺一层浅色底、固有色、背光处同色系的深色、核心暗部最深的颜色,再在受光一侧罩一层暖色、阴影里罩一层冷色,每层绕着形体自己的方向场错开 ±`cross` 度,笔触交叉。+ - 方向场:`flow(角度, 扰动, 尺度)` 缓缓漂移的方向(天空、水面);`contour(遮罩)` 顺着形状的等值线(绕着穹顶、石头、每块盾片的生长纹);`radial()` 从一点放射;`blend()` 双倍角混合(0 和 π 是同一个方向);`rotate()`。+ - 毛发:`fur()` 一绺一绺地画:每绺 4–12 根细线,根部在绺里散开、尖端聚拢,朝同一边微弯,落笔重、收笔挑,顺着毛向;每绺背光一侧的几根暗一点(`side`),所以每绺都有亮面和暗面。`pelt()` 是整张毛皮:浅色底层、背光处暗而短的毛绺、固有色、受光处的浅色毛尖。`grass()` 反过来,草叶从根部往上散开;`leaves()` 是树冠里一簇簇短弯的叶片笔触。+ - 光:`glow()` 是一层层顺着周围表面走的暖色笔触(靠近光源黄白、往外橙色、越往外越稀,不放射成星芒),下面垫一层带纸纹的提亮(不是一团平滑光晕);`window()` 亮灯的窗(窗框附近橙、中间奶油黄、几根窗棂);`lift()` 可塑橡皮 / 白色铅笔提亮。+ - 水:`reflect()` 在水面铺横向笔触,颜色取水线以上画面的镜像(被涟漪横推、模糊、混进水色),倒影也是一笔一笔的;`ripples()` 是立在水里的东西周围断开的椭圆圈。+ - 绘本部件:`tree()` 树干、几根枝和一团团分别打光的树冠(`tree_plan()` 先给出遮罩,好让背景留白);`cottage()` 小房子(墙竖着排线、屋顶顺着坡、亮灯的窗、门、烟囱);`stone()` 顶面略平、绕着形体排线的石头,可带苔藓;`scales()` 错开排列的小鳞片,背光一侧一道褶;`flowers()` 野花,圆头花瓣笔触围着花心,可带茎。+ - 人物:`child()` 几百像素高的绘本小孩:帽子放下的雨衣、靴子、一绺绺顺下来的波波头、点点眼、腮红、一只手往前提灯笼(`paint=False` 只给遮罩,同一个 seed 画出来是同一个孩子);`lantern()` 圆圆的纸灯笼;`eye()` 带高光的软点眼;`blush()` 腮红。+ - 收尾:`finish()` 只记参数、在 render 里加(每张阶段快照都和成品一致,要在画第一笔之前调用):轻微柔化、细颗粒、很淡的暖色暗角。+- 构造:`PencilStorybook(W, H, seed, keep_stages=True, stages_dir=None)`(总像素不超过 4096²),先 `finish()` 再 `paper(tone, tooth, mottle, fibres)`。坐标是整张画布的像素;给方向场传一个数就是角度(度,0 向右、90 向下),方向场数组是弧度;`LIGHT` 是默认光(左上、略朝前)。+- 遮罩:`poly(pts, smooth)`、`ellipse(cx, cy, rx, ry, rot)`、`blob(cx, cy, rx, ry, rough)`、`tube(path, w0, w1)`、`below(xs, ys, invert)`、`rect(x0, y0, x1, y1)` 返回画布大小的浮点遮罩;`line_y(xs, ys)` 是样条线在每一列的 y;`value(top, bottom, y0, y1, mottle)` 竖向的 0–1 场。+- 笔触:`hatch(region, field, colour, length, width, density, pressure, opacity, alpha, jitter, bend, value, hue, taper, passes, clip, avoid, fade)`。`region` 是落笔概率遮罩或 (x0, y0, x1, y1);`density` 约等于把区域铺几遍;`length` / `width` 给 (最小, 最大)、一个数或 f(x, y);`colour` 给颜料、一串颜料(随机取)、(色阶, 场或 f(x, y)) 或 f(x, y) → (N, 3)。`strokes(paths, …)` 画给定的折线;`line(path, colour, width, pressure, seg, wobble, clip, gaps)` 几笔叠成的软铅笔线;`edge(mask, colour, …, where)` 很淡、断续的同色轮廓。+- 塑形:`shading(mask, light, sigma, wrap, flat)`;`form(mask, colours=(浅, 固有, 暗[, 最深]), field, light, cross, length, width, density, pressure, warm, cool, edge, lit, avoid)` 返回受光场。+- 毛发和草木:`fur(region, field, colour, length, width, density, tuft, spread, curl, converge, pressure, side, light)`(`converge` 1 尖端聚拢、−1 散开);`pelt(mask, colours, field, light, length, density, lit)`;`grass(region, colour, height, lean, sway, density, tuft, fan)`;`leaves(region, colour, size, density, field)`;`tree(x, y, h, r, colours, trunk, clumps, leaf, light, lean, seed)`、`tree_plan(x, y, h, r, clumps, lean, seed)`;`flowers(region, kinds, n, size, stems)`(花种见 `FLOWERS`:daisy buttercup poppy forgetmenot pink clover cornflower marigold)。+- 物件:`cottage(x, y, w, h, wall, roof, windows, door, chimney, roof_h, light, glow, avoid)`;`stone(cx, cy, rx, ry, colours, moss, flat, light, warm, cool, avoid)`;`scales(mask, size, colours, groove, field, light, lit)`;`dots(region, colours, n, size)`。+- 光和水:`glow(x, y, r, colours, strength, density, halo, squash, clip, field)`;`window(x0, y0, x1, y1, panes, frame, light, sill, glow)`;`lift(mask, colour, amount)`;`reflect(waterline, region, src, ripple, stretch, darken, tint, mixw, soft, length, width, density, field)`(`src` 传画水之前的画布,`waterline` 可以是逐列的数组);`ripples(cx, cy, rx, ry, rings, colour, grow)`。+- 人物:`child(x, y, h, facing, coat, hair, boots, legs, skin, look, light, arm, paint, seed)` 返回 hand / head / eye / mask;`lantern(x, y, size, body, ribs, cap, handle, glow)` 返回灯笼中心;`eye(x, y, r, colour, lid, look, glint)`;`blush(x, y, r, colour, amount)`。+- 收尾:`finish(soft, grain, vignette, warmth)`;`render()`、`composite()`、`stage(name)`、`save(path, stages_dir)`;`save('x.jpg')` 默认 quality 88、4:4:4 色度。+- 颜色用 `PAINTS` 里的名字(paper white cream ivory;sky_top cobalt sky cornflower sky_pale powder periwinkle lavender mauve violet ultramarine indigo slate teal aqua;lemon butter sun apricot peach glow lantern flame orange tangerine;meadow yellowgreen grass leaf sage moss olive forest pine lichen;ochre gold amber sienna brown umber sepia tan sand stone warmgrey pebble;terracotta brick rose coral vermilion red cheek pink;skin skin_shade hair hair_light raincoat raincoat_shade raincoat_deep denim boot eye)或 '#rrggbb';色阶用 `RAMPS` 里的名字(dusk_sky day_sky glow water meadow hills shell skin stone autumn)或自己给一串颜色。+**顺序**:都是先远后近、先大后小,文字最后叠加。水墨的雾要画在它该吞没的东西之后;水彩的叶梗要先画,并且只画在叶子外面。## 三、毛病清单(都真实出现过)@@ -2421,6 +2448,30 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask| 动图里大片纸色差几级(末帧误差中位数 2) | Pillow 按调色板量化时查的是缩减过的色立方:改成 numpy 精确找最近色(每种颜色算一次、缓存),离 Flexoki 色 2 级以内的直接用那个颜色 || 动图里红色「否」、浅黄便签、紫色小圆点的边缘变成橙色和灰色(单点误差到 49 级) | 这些饱和的中间色面积太小,中值切分分不到:留 60 个色位只从饱和、又不贴近 Flexoki 色的像素里切;误差超过 20 级的像素 478 → 166 |+**暖调彩铅绘本**++| 问题 | 改法 |+|---|---|+| 第一版满画面大白点,像粗纸上的蜡笔,不像彩铅 | 纸纹里中、大尺度的成分太多,每笔覆盖又太少:纸纹以 1 px 细颗粒为主(1 px 0.6 → 0.8,2 px 0.45 → 0.38,6 px 0.25 → 0.12,22 px 0.12 → 0.05),默认压力 0.62 → 0.74,纸坑里也留一点蜡(`floor`,最后定在 0.34),每笔轻一点(alpha 0.9 → 0.62)、多叠几遍,白点才是细的、带色的 |+| 塑形的暗部是一道道散落的深色短线,像在下雨 | 暗部只靠落笔概率:区域同时当作逐像素的压力(`fade` = 区域^0.65),落笔概率用它的平方根,暗部才是平滑过渡 |+| 先画的山坡透过后画的龟壳,壳的下半截发绿 | 彩铅半透明,后上的颜色和底下的混:先算好前景(龟、树、灯杆、小孩、石头)的遮罩,铺天空、山坡和水时 `avoid` 留白,像画家先把主体空出来 |+| 苔藓盖住半个龟壳,像一块草坪,下沿是一排三角形的齿 | 只留壳顶一带,改成几十个互相叠着、各自打光的圆垫;下沿再加一圈小垫和几团散落的小垫,挂下来的是一绺绺长苔藓 |+| 改成圆垫以后,壳上是一块块绿色的霉斑 | 主带的圆垫要密到连成一片:每个位置两排、半径 26–42 |+| 盾片之间的沟是浅色的线,两边描深 | 沟是盾片之间没上色的缝:直接沿 (u, v) 边界画深褐色的线(两遍、断续),下沿再补一道浅金色的亮边 |+| 盾片的分界是一根根直线,壳像拼起来的木板 | 肋盾之间的分界在中间往外鼓一点,每块盾片单独按穹顶打光(亮的一侧奶油黄、背光一侧赭红) |+| 四条腿是直柱子,龟像一张桌子 | 前腿往前迈、后腿往后蹬,脚到水面变宽;远侧两条腿躲到近侧的腿后面、压得很暗;肚子底下的水加一层冷色阴影;龟整体下移 34 px,露出的腿短一些 |+| 脖子是一块方方的、竖条纹的硬纸板 | 脖子改成上沿平、下沿下垂的形状(喉下松弛的皮),褶皱是往前弯的弧,间距不等,喉下再加三道横褶 |+| 小孩太小、脸看不清,头发像爆炸头 | 高 172 → 206 px;头发从头顶上方一点往下散开,长簇、几乎不卷(卷曲 0.1 → 0.03)、尖端半收拢,才是波波头;腮红半径 0.3 → 0.2 倍头的半径 |+| 小孩的脸融进身后的浅色水面 | 肤色加深一级(浅色底层从奶油色换成浅粉),脸加一圈很淡的同色轮廓;腿改成矢车菊蓝 / 牛仔蓝的裤袜,不用粉蓝 |+| 灯笼的光是一圈放射线,像星芒 | 光笔触改成顺着周围表面的随机流向(不放射),密度 1.3 → 1.0–1.1 |+| 杆上的灯笼外面一圈纸白的圆环 | 铺天空时留白用的灯笼遮罩比灯笼大:灯笼自己的颜色够实,不用留白 |+| 云底的暖色是一条细线,像给云描了边 | 只取云下沿 26 px 宽的带子再模糊,去掉玫瑰色 |+| 边光画在了背光的那一侧 | 受光的一侧是遮罩梯度朝光的地方:side = 0.82·gx + 0.45·gy,原来符号反了 |+| 龟壳的暖色边光画到了苔藓上,苔藓里出现一道浅色弧线 | 边光只画在光秃的壳上(减去苔藓、挂下来的苔藓、树冠和灯杆) |+| 灯杆上横着一道道条纹,像拐杖糖 | 细长的东西不要交叉排线:笔触顺着杆走(`contour()`),交叉角 26° → 8° |+| 树冠是一团黄色的海绵 | 团块更小、更分开(离中心 0.42–0.7 r,半径 0.3–0.44 r),每团单独打光,暗部用赭红,团与团之间才有缝 |+| 动图 1.58 MB,超了 | 普通叠化每帧都把整片天空、整条溪流改一点,细铅笔纹理每次都要重发:每个像素只在 5 帧里的约 2 帧完成过渡(先后由柔和的噪声加从左到右的扫过决定,像下一层彩铅一片片铺上去),0.99 MB;去掉 Bayer 反而更大(1.67 MB) |+## 四、做成动画- 各画风都有 `stage(name)` 和 `save(path, stages_dir)`,按阶段依次淡入叠化,就是「一幅画被逐步画出来」。README 里的动图就是这样做的。@@ -2495,6 +2546,12 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask- 会动的都是真的中间帧:范例按进度重画内容层(`layer(name, fresh=True)`),阶段名带 `~` 的每帧 60 毫秒硬切、不叠化,带 `@毫秒` 的是停留,成品停 2.6 秒。- 调色板:28 个 Flexoki 色强制占位,离它们 2 级以内的像素直接用它们(大片纸色和卡片色一级不差,也不闪);167 色按全部关键帧(末帧 ×6)中值切分,不贴近 Flexoki 色的像素(文字和线的抗锯齿边)×3;60 色只从饱和的中间色里切。最近色用 numpy 精确查(Pillow 的查表差几级)。不加抖动(纸面上没有渐变)。没变的像素记成品红透明,整帧没变的帧并进上一帧的时长。- 结果:138 帧、13.73 秒、约 0.58 MB,按解码结果逐帧自检,末帧 p99 误差 4。+- 暖调彩铅绘本的动图(脚本在 `claude_drawing/arte_work/make_gif_pencilbook.py`):+ - 阶段:暖白空纸 → 天空(先把龟、树和灯杆留白,纸白的云)→ 远山、小镇和对岸 → 溪流和倒影 → 龟的第一层浅色底 → 塑形(盾片、沟、背光面、皮肤、脖子的褶、脸、腿上的鳞)→ 龟背上的小花园(苔藓垫、挂下来的苔藓、金黄的树、灯杆和灯笼、野花)→ 踏脚石和小孩 → 腿和小孩的倒影、肚子底下的阴影、涟漪 → 成品(灯笼和窗灯的光、落日给的暖边、近岸的灌木、草和野花)。每段 900 毫秒 + 5 帧叠化。+ - 叠化一片片铺上去:每个像素只在 5 帧中的约 2 帧里完成过渡,先后由柔和的低频噪声加从左到右的扫过决定,像下一层彩铅一片片铺满画面。普通叠化每帧都把整片细纹理改一点、每次都要重发(1.58 MB),这样每个像素只发约两次。+ - 调色板:第一帧(空纸)只给 12 色;228 色从和它不同的像素切(末帧 ×3),饱和色 ×2(雨衣、金黄的树、灯笼、屋顶、野花)、偏暗的绿和褐 ×1.5(苔藓、龟壳的沟和背光面、肚子底下的阴影)、接近纸色的浅色 ×1.5(纸齿白点、白云);再留 14 色,其中 3 个是强制的(最深的褐、纸色、灯笼的光),另外 11 色只从末帧误差最大(> 16 级)的像素里切。+ - 固定 4×4 Bayer(去掉反而更大)。和屏上已显示颜色差不到 5 级(叠化帧)或 3 级(关键帧)的像素沿用上一帧,末帧精确发送。+ - 结果:55 帧、14.75 秒、约 0.99 MB,按解码结果逐帧自检,末帧 p99 误差 20。- 绘本角色动画的动图是真动画,不是阶段叠化:`Storybook.gif()` 按时间逐帧渲染,720×405、15 fps(GIF 延时只能写厘秒,按累计取整写成 7、7、6 厘秒交替),共用一张加权调色板 + 固定 4×4 Bayer,没变的像素记成品红透明,151 帧(动作 9.95 秒 + 末帧停 1.4 秒)约 0.56 MB;范例加 `--gif out.gif` 出这张,`--stages` 的关键帧仍可喂给上面的阶段动图工具。- 形变动画可以直接出真动画:`Morph.at(keys, T)` 给出全局时间 T 的轮廓,逐帧渲染即可。- 更细的逐笔动画:把一组笔画单独画到透明层上导出,再用 Motion Canvas 遮罩按顺序显现。这个还没做成现成接口。@@ -2576,6 +2633,7 @@ lib/nocturne.py 排线夜景(直方图均衡的纸纹与沿 8 个方向lib/obsidianui.py 笔记应用界面(近黑页面与淡紫光晕;距离场抗锯齿的应用窗口:标签页、图标栏、带缩进线的文件列表、面包屑、分段开关、浮动状态栏;CSS 式多层阴影与零偏移辉光;苹方 / 兰亭黑 Heavy / SF Pro / SF Mono 自动分段,带底色描边的标签字;一行正文的富文本(加粗、内部链接、行内代码、高亮、#标签)与属性行;带语法色的代码块、逐行图层和块状光标;引用标注、任务勾选框;阅读视图的扁平流程图节点与带标签的箭头连线;关系图谱的灰点灰线与紫色亮点径向光;鼠标指针与点击环;可换的单一强调色;带姿态的图层:位移、缩放、不透明度、横向 / 纵向 / 圆形揭开)lib/canvasboard.py 白板卡片(保留式绘制:所有形状按白板坐标记进有名字的节点,每次按镜头重画;距离场抗锯齿的圆角矩形、圆、环,逐段只算包围盒的折线和虚线,4 倍超采样的多边形,CSS box-shadow;节点的位姿和进度变量(fade / draw / reveal / pop),tween 出中间阶段,drop 缓动;随镜头移动缩放的点阵;应用窗口、标签栏、图标栏、缩放按钮、鼠标指针和点击波纹;分组框、卡片色边和淡色底、选中光圈、举起的大阴影、图片卡片和方格纸;行内 Markdown(高亮、行内代码、粗体)、会打勾的清单、引用、标签胶囊、颜色胶囊、进度条;沿法线出入的三次曲线连线、箭头和标签;手绘抖线、椭圆和弧、箭头;苹方 + SF Pro + SF Mono + 手札体,浮点字号)lib/flexoki.py Flexoki 纸面(Flexoki 色板与角色名、浅色 / 深色主题;有符号距离场的圆角矩形、圆、环、精确菱形、圆柱、扇形与折线,1 px 解析抗锯齿;带弧长的折线:按进度画出、沿弧长虚线、在箭头下截短,三次曲线、按切线出入的曲线、倒圆角折线;4 倍超采样的小三角箭头;先合成再放下的节点组;苹方加假粗的粗黑标题、SF Pro 可变字重、SF Mono;带姿态的图层与 fresh 重画;卡片、聚焦框、胶囊、步骤胶囊、大数字、轨道条、窗口、虚线框、宽度标注、代码行;流程图的框和边、时序图的生命线 / 激活条 / 消息 / 便签、饼图、图例、柱状图、表格)+lib/pencilbook.py 暖调彩铅绘本(以 1 px 细颗粒为主的直方图均衡纸纹与沿 8 个方向拖开的纸纹,纸坑里留的一点蜡和越叠越深的蜡层缓冲;在方向场里积分出中心线、带手腕弧度的铅笔笔触;id 图光栅化:Pillow 按序号画折线、2 倍超采样,numpy 只对被盖住的子像素查回这一笔,算出沿笔位置和压力曲线,蜡只落在压力够得着的纸纹上,bincount 汇回像素;抖动网格落笔、逐像素压力的平滑过渡、留白(avoid);半透明的蜡混色与压光;软穹顶受光和照彩铅画家顺序的分层塑形:浅色底、固有色、同色系暗部、最深处、暖色和冷色罩染、交叉角度;漂移、等值线、放射方向场与双倍角混合;根部散开尖端聚拢、有亮面暗面的毛绺,整张毛皮,散开的草丛,树冠的叶簇;顺着表面的暖色发光笔触与带纸纹的提亮,亮灯的窗,提亮;镜像取样的横排线倒影、断开的涟漪圈;分别打光的团块树冠、小房子、石头、鳞片、野花、纸灯笼、雨衣小孩、点点眼和腮红;很淡的同色轮廓、几笔叠成的软线;轻微柔化、细颗粒、暖色暗角)examples/*.py 范例脚本;*.jpg 成品;drawing_*.gif 逐步画出的动图中文字体:自动找 Kaiti/Songti(macOS)、Noto CJK(Linux)、KaiTi/SimSun(Windows),或设 INKPAINT_FONT西文字体(后来新增的画风用):core.latin_font(style) 按 sans / sans_bold / rounded / script / hand / typewriter 等找系统字体,可用 INKPAINT_FONT_<STYLE> 指定;字体文件不要放进仓库diff --git a/examples/drawing_pencilbook_tortoise_crossing.gif b/examples/drawing_pencilbook_tortoise_crossing.gifnew file mode 100644index 0000000..388ccacBinary files /dev/null and b/examples/drawing_pencilbook_tortoise_crossing.gif differdiff --git a/examples/pencilbook_tortoise_crossing.jpg b/examples/pencilbook_tortoise_crossing.jpgnew file mode 100644index 0000000..7f3d17dBinary files /dev/null and b/examples/pencilbook_tortoise_crossing.jpg differdiff --git a/examples/pencilbook_tortoise_crossing.py b/examples/pencilbook_tortoise_crossing.pynew file mode 100644index 0000000..b69f16c--- /dev/null+++ b/examples/pencilbook_tortoise_crossing.py@@ -0,0 +1,593 @@+"""Example (warm pencil storybook): 大龟过河 · The Tortoise Crossing -- a picture-book page in soft, layered+coloured pencil on warm toothy paper.++Dusk. A very old, very large tortoise wades slowly across a shallow stream. On its back it carries a little garden:+a mossy cap with tufts of grass and wildflowers, a small tree in autumn gold, and a paper lantern hanging from a+crooked post. Beside it, on the stepping stones, walks a small child in a yellow raincoat with a lantern of their+own, looking up at the tortoise, which has lowered its head to look back. Behind them the sky goes from soft blue to+peach and butter over the hills, the sun is just down behind the far ridge, and a few cottages on the hillside have+lit their windows. The water carries the warm sky, the cottages' lights and the tortoise's legs.++Everything is coloured pencil: every surface is many fine strokes that follow its form (the sky in long horizontals,+the hills along their slopes, the shell round each scute's growth rings, the neck across its wrinkles, the coat down+its folds, moss and hair in tufts), laid in layers -- light under-layer, local colour, the shadow of the same family,+a warm glaze in the light and a cool one in the shade -- with the tooth of the warm paper showing through as fine+specks. No ink lines, no black.++Painted in the order an illustrator works: paper -> sky -> hills and village -> stream -> the tortoise's first layer+-> modelling the tortoise -> the garden on its back -> the child and the stepping stones -> reflections and ripples+-> lights (lanterns, windows, the warm rim of the low sun) and the near bank.+--stages writes those steps as snapshots for the draw-on. No image model.+python3 pencilbook_tortoise_crossing.py [out.jpg] [--stages DIR]+"""+import os, sys, time+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'lib'))+import numpy as np+from pencilbook import PencilStorybook, hexc+from core import blur, spline, smoothstep, noise2d++W, H = 1920, 1080+LIGHT = (-0.82, -0.45, 0.42) # the sun just down behind the left-hand ridge+SUN = (300, 512)++# the tortoise (side view, walking left); the shell's upper outline and its lower rim, front end -> back end+TOP = [(846, 646), (868, 534), (920, 434), (1000, 352), (1110, 296), (1250, 270), (1400, 280), (1530, 326),+ (1625, 406), (1688, 504), (1712, 594), (1714, 674)]+RIM = [(846, 646), (880, 684), (960, 718), (1080, 734), (1240, 742), (1400, 740), (1540, 730), (1640, 714),+ (1714, 674)]+WATER_T = 846 # where the tortoise's legs meet the water+HEAD = [(774, 610), (736, 584), (690, 574), (640, 580), (604, 600), (582, 627), (582, 652), (598, 673),+ (636, 690), (690, 698), (746, 694), (788, 676)]+EYE = (650, 621)+NECK = [(936, 640), (872, 630), (812, 618), (772, 612), (758, 648), (770, 690), (806, 716), (858, 736), (936, 748)]+CHILD = dict(x=440, y=869, h=206)+STONES = [(444, 882, 76, 26), (296, 960, 84, 29), (566, 814, 52, 18), (650, 764, 42, 15)]+TREE = dict(x=1374, y=290, h=122, r=118, clumps=11, lean=-0.03, seed=77)+POST = [(1090, 308), (1086, 250), (1081, 196), (1068, 174), (1046, 168)]+LANTERN = (1044, 178, 38)+COTTAGES = [ # x, ground y, w, wall h, wall, roof, seed+ (64, 566, 72, 50, ('cream', 'ivory', 'sand', 'tan'), ('peach', 'terracotta', 'brick', 'sienna'), 11),+ (182, 552, 60, 44, ('powder', 'sky_pale', 'cornflower', 'slate'), ('peach', 'coral', 'brick', 'sienna'), 12),+ (300, 560, 82, 54, ('cream', 'sun', 'apricot', 'amber'), ('lavender', 'slate', 'indigo', 'violet'), 13),+ (440, 572, 58, 42, ('cream', 'pink', 'rose', 'brick'), ('peach', 'terracotta', 'brick', 'sienna'), 14),+ (1768, 566, 70, 46, ('cream', 'ivory', 'sand', 'tan'), ('lavender', 'slate', 'indigo', 'violet'), 15),+]+++def curve(pts, n):+ """n points along a spline through pts, evenly by arc length"""+ P = spline(pts, 16)+ d = np.r_[0, np.cumsum(np.linalg.norm(np.diff(P, axis=0), axis=1))]+ s = np.linspace(0, d[-1], n)+ return np.stack([np.interp(s, d, P[:, 0]), np.interp(s, d, P[:, 1])], 1).astype(np.float32)+++class Scene:+ def __init__(self, p):+ self.p = p+ self.r = np.random.default_rng(5)+ self.plan()++ def sd(self):+ return int(self.r.integers(1 << 30))++ # ------------------------------------------------------------------ masks first (colour round them)+ def plan(self):+ p = self.p+ self.T = curve(TOP, 240); self.B = curve(RIM, 240)+ self.shell = p.poly(np.vstack([self.T, self.B[::-1]]))+ under = self.B.copy()+ under[:, 1] += 46 * np.sin(np.linspace(0, np.pi, len(under))) ** 0.7+ self.plastron = p.poly(np.vstack([self.B, under[::-1]])) * (1 - self.shell)+ self.neck = p.poly(NECK, smooth=True)+ self.head = p.poly(HEAD, smooth=True)+ wl = smoothstep(WATER_T + 2, WATER_T - 2, p.YY)+ self.legs = dict(+ front=p.poly([(950, 700), (1082, 698), (1100, 748), (1084, 800), (1066, 866), (880, 866), (894, 800),+ (918, 748)], smooth=True) * wl,+ back=p.poly([(1494, 718), (1638, 710), (1668, 760), (1692, 820), (1708, 866), (1524, 866), (1514, 810),+ (1488, 768)], smooth=True) * wl,+ far_front=p.poly([(1086, 736), (1178, 736), (1196, 866), (1090, 866)], smooth=True) * wl,+ far_back=p.poly([(1418, 740), (1502, 740), (1500, 866), (1406, 866)], smooth=True) * wl)+ near = np.maximum(self.legs['front'], self.legs['back'])+ far = np.maximum(self.legs['far_front'], self.legs['far_back']) * (1 - near)+ self.far_legs = far * (1 - self.shell) * (1 - self.plastron)+ self.near_legs = near * (1 - self.shell)+ self.tort = np.clip(self.shell + self.plastron + self.neck + self.head + near + far, 0, 1)+ # the tree and the lantern post on its back, planned now so the sky is coloured round them+ self.crown, self.trunk, _, _ = p.tree_plan(TREE['x'], TREE['y'], TREE['h'], TREE['r'], TREE['clumps'],+ TREE['lean'], TREE['seed'])+ self.postm = p.tube(POST, 13, 7)+ # the child and the stones+ c = p.child(CHILD['x'], CHILD['y'], CHILD['h'], 1, look=(0.6, -0.8), light=LIGHT, paint=False, seed=21)+ self.child_info = c+ self.childm = blur(c['mask'], 0.8)+ self.child_lantern = p.ellipse(c['hand'][0], c['hand'][1] + 22, 18, 20)+ self.stones = np.zeros((H, W), np.float32)+ for (cx, cy, rx, ry) in STONES:+ self.stones = np.maximum(self.stones, p.ellipse(cx, cy, rx * 1.02, ry * 1.1))+ self.fg = np.clip(self.tort + self.crown + self.trunk + self.postm, 0, 1)+ # land, water+ self.far_ridge = ([0, 200, 420, 700, 950, 1200, 1500, 1750, 1920], [522, 497, 512, 470, 500, 482, 506, 472, 492])+ self.near_ridge = ([0, 250, 520, 800, 1100, 1400, 1650, 1920], [548, 530, 556, 566, 568, 560, 544, 552])+ self.bank_y = p.line_y([0, 500, 1000, 1500, 1920], [642, 630, 634, 628, 638])+ self.water = (p.YY > self.bank_y[None]).astype(np.float32)+ NB = ([0, 240, 560, 900, 1250, 1560, 1920], [944, 976, 1000, 1006, 998, 982, 948])+ self.nearbank = p.below(*NB)+ self.water = self.water * (1 - self.nearbank)++ # ------------------------------------------------------------------ 1 sky+ def cloud(self, cx, cy, w, h, bumps=4):+ """a soft storybook cloud bank: a flat-bottomed lens with a few rounded bumps on top"""+ p = self.p+ m = p.ellipse(cx, cy, w * 0.5, h * 0.42)+ for k in range(bumps):+ t = (k + 0.5) / bumps - 0.5 + self.r.normal(0, 0.05)+ bw = w * self.r.uniform(0.16, 0.26)+ m = np.maximum(m, p.ellipse(cx + t * w * 0.8, cy - h * self.r.uniform(0.15, 0.45), bw, bw * self.r.uniform(0.55, 0.8)))+ m = m * (p.YY < cy + h * 0.3) + m * (p.YY >= cy + h * 0.3) * smoothstep(cy + h * 0.45, cy + h * 0.3, p.YY)+ return blur(m, 3)++ def sky_phase(self):+ p = self.p+ sky = p.below(self.far_ridge[0], np.asarray(self.far_ridge[1]) + 30, invert=True)+ clouds = np.zeros((H, W), np.float32)+ for (cx, cy, w, h, nb) in [(330, 196, 420, 70, 5), (640, 150, 260, 44, 3), (120, 318, 230, 40, 3),+ (1530, 120, 400, 62, 5), (1820, 230, 240, 42, 3), (760, 330, 300, 34, 4),+ (1180, 380, 230, 30, 3)]:+ clouds = np.maximum(clouds, self.cloud(cx, cy, w, h, nb))+ sun = np.exp(-(((p.XX - SUN[0]) / 560) ** 2 + ((p.YY - SUN[1]) / 280) ** 2))+ v = np.clip(p.value(0.0, 1.0, 0, 560, 0.03) * (1 - 0.15 * sun) + 0.2 * sun, 0, 1)+ keep = sky * (1 - 0.9 * clouds)+ f = p.flow(-2, 4, 400)+ p.hatch(keep, f, ('dusk_sky', v), length=(70, 160), width=(1.8, 2.7), density=1.7, pressure=0.78,+ avoid=self.fg, seed=self.sd())+ p.hatch(keep, p.rotate(f, -7), ('dusk_sky', np.clip(v + 0.05, 0, 1)), length=(60, 140), width=(1.8, 2.6),+ density=1.3, pressure=0.76, avoid=self.fg, seed=self.sd())+ p.hatch(keep, p.rotate(f, 5), ('dusk_sky', np.clip(v - 0.04, 0, 1)), length=(40, 100), width=(1.7, 2.4),+ density=1.0, pressure=0.7, alpha=0.5, avoid=self.fg, seed=self.sd())+ p.hatch(sky * sun * 0.9 * (1 - 0.6 * clouds), p.rotate(f, 4), ('glow', np.clip(1 - sun, 0, 1)), length=(60, 140),+ width=(1.8, 2.6), density=1.2, pressure=0.72, opacity=0.5, avoid=self.fg, seed=self.sd())+ # clouds: the paper left almost white, a cream top, lavender in the core, warm peach underneath (the sun+ # is below them), strokes running along the cloud+ cf = p.blend(f, p.contour(clouds, 6), 0.4)+ under = blur(clouds * (1 - np.roll(clouds, -26, 0)), 9) * clouds+ top = blur(clouds * (1 - np.roll(clouds, 18, 0)), 7) * clouds+ core = clouds * smoothstep(0.55, 0.95, blur(clouds, 6))+ p.hatch(clouds, cf, ('cream', 'white', 'ivory'), (40, 100), (1.6, 2.4), 1.0, 0.7, opacity=0.6, alpha=0.6,+ avoid=self.fg, seed=self.sd())+ p.hatch(core * 0.7, cf, ('lavender', 'mauve', 'powder'), (40, 100), (1.6, 2.4), 0.9, 0.7, alpha=0.5,+ avoid=self.fg, seed=self.sd())+ p.hatch(np.clip(under * 1.3, 0, 1), cf, ('peach', 'apricot', 'butter'), (40, 100), (1.6, 2.4), 1.0, 0.72,+ opacity=0.45, alpha=0.55, avoid=self.fg, seed=self.sd())+ p.hatch(np.clip(top * 1.2, 0, 1) * (1 - 0.5 * sun), cf, ('sun', 'butter', 'cream'), (30, 80), (1.5, 2.2), 0.8,+ 0.66, opacity=0.6, alpha=0.5, avoid=self.fg, seed=self.sd())+ # the sun just gone: a pale disc half behind the ridge+ disc = p.ellipse(SUN[0], SUN[1] - 6, 40, 40)+ p.lift(disc, 'sun', 0.8, 0.2)+ p.hatch(disc, 0, 'butter', (12, 30), (1.6, 2.2), 1.6, 0.7, 0.6, seed=self.sd())++ # ------------------------------------------------------------------ 2 hills, village, far bank+ def land_phase(self):+ p = self.p+ avoid = self.fg+ far = p.below(self.far_ridge[0], self.far_ridge[1]) * (1 - p.below(None, 600))+ far_l = p.shading(far, LIGHT, 60, flat=0.4)+ p.form(far, ('lavender', 'periwinkle', 'violet', 'indigo'), p.flow(-6, 14, 200), LIGHT,+ length=(30, 70), width=(1.6, 2.4), density=1.2, lit=far_l * 0.7 + 0.2, warm='peach', avoid=avoid,+ seed=self.sd())+ near = p.below(self.near_ridge[0], self.near_ridge[1]) * (p.YY < self.bank_y[None] + 2)+ hill_f = p.blend(p.flow(-10, 16, 220), p.contour(near, 30, 0), 0.35)+ lit = p.shading(near, LIGHT, 80, flat=0.3)+ p.form(near, ('meadow', 'yellowgreen', 'grass', 'moss'), hill_f, LIGHT, length=(26, 60), width=(1.6, 2.4),+ density=1.3, lit=lit, warm='butter', cool='lavender', avoid=avoid, seed=self.sd())+ # hedgerows and a few far trees along the hill+ for (tx, ty, th, tr) in [(140, 560, 30, 22), (262, 548, 36, 26), (395, 566, 34, 24), (540, 576, 40, 28),+ (1700, 562, 34, 26), (1880, 570, 44, 32), (860, 580, 26, 20)]:+ p.tree(tx, ty, th, tr, ('meadow', 'yellowgreen', 'moss', 'forest'), clumps=5, leaf=(4, 8), light=LIGHT,+ avoid=avoid, seed=self.sd())+ for (x, y, w, h, wall, roof, s) in COTTAGES:+ p.cottage(x, y, w, h, wall, roof, light=LIGHT, glow=0.0, avoid=avoid, seed=s)+ # the far bank: a strip of grass and reeds at the water's edge+ bank = (p.YY > self.bank_y[None] - 26) * (p.YY < self.bank_y[None] + 2)+ bank = blur(bank.astype(np.float32), 2)+ p.hatch(bank, p.flow(-4, 10), ('grass', 'moss', 'olive'), (24, 60), (1.6, 2.2), 1.4, 0.76, avoid=avoid,+ seed=self.sd())+ p.grass(bank * smoothstep(0.2, 0.8, noise2d(H, W, 60, 2, self.sd())), ('moss', 'olive', 'grass', 'forest'),+ height=(12, 30), density=0.6, avoid=avoid, seed=self.sd())++ # ------------------------------------------------------------------ 3 the stream+ def water_phase(self):+ p = self.p+ av = np.clip(self.fg + self.childm + self.stones, 0, 1)+ src = p.C.copy()+ depth = np.clip((p.YY - self.bank_y[None]) / 340, 0, 1)+ p.reflect(self.bank_y, self.water, src=src, ripple=7, stretch=0.9, darken=0.08, tint='cornflower',+ mixw=0.16, length=(40, 110), width=(1.7, 2.5), density=1.8, pressure=0.76, opacity=0.38,+ field=p.flow(0, 3, 300), seed=self.sd())+ # the stream's own body: a cooler blue-green laid deeper toward us, and darker ripple bands+ p.hatch(self.water * (0.25 + 0.5 * depth) * (1 - av), p.flow(0, 3), ('aqua', 'teal', 'cornflower'),+ (40, 120), (1.6, 2.4), 0.9, 0.66, opacity=0.3, alpha=0.5, seed=self.sd())+ bands = smoothstep(0.55, 0.8, noise2d(H, W, 14, 2, self.sd()) * 0.7 + 0.3 * noise2d(H, W, 50, 2, self.sd()))+ bands = bands * np.clip(1 - np.abs(np.sin(p.YY / 9.0)) * 0.3, 0, 1)+ p.hatch(self.water * bands * 0.8 * (1 - av), p.flow(0, 2), ('cobalt', 'slate', 'teal'), (30, 90), (1.4, 2.0),+ 0.8, 0.7, alpha=0.55, seed=self.sd())+ light_bands = smoothstep(0.62, 0.85, noise2d(H, W, 18, 2, self.sd()))+ p.hatch(self.water * light_bands * 0.7 * (1 - av), p.flow(0, 2), ('sun', 'peach', 'cream'), (30, 90),+ (1.4, 2.0), 0.6, 0.66, opacity=0.5, alpha=0.5, seed=self.sd())+ # the sunset's warm path on the water below the sun+ path_ = np.exp(-((p.XX - SUN[0]) / (60 + 0.5 * np.maximum(0, p.YY - 640))) ** 2) * smoothstep(900, 650, p.YY)+ p.hatch(self.water * path_ * (1 - av) * (0.45 + 0.55 * smoothstep(0.4, 0.6, noise2d(H, W, 10, 2, self.sd()))),+ p.flow(0, 2), ('sun', 'glow', 'apricot', 'butter'), (20, 70), (1.5, 2.2), 1.7, 0.76, opacity=0.72,+ alpha=0.75, seed=self.sd())+ # warm reflections of the lit cottage windows, broken into horizontal strokes+ for (x, y, w, h, *_rest) in COTTAGES:+ wx = x + w * 0.36+ yy = 2 * self.bank_y[int(min(W - 1, wx))] - (y - h * 0.5)+ m = p.ellipse(wx, yy + 14, w * 0.2, 30) * self.water * (1 - av)+ p.hatch(m, 0, ('lantern', 'glow', 'flame'), (8, 22), (1.5, 2.1), 1.0, 0.72, opacity=0.7, alpha=0.7,+ seed=self.sd())++ # ------------------------------------------------------------------ 4 the tortoise: first layer+ def tortoise_base(self):+ p = self.p+ self.shell_lit = p.shading(self.shell, LIGHT, 120)+ p.hatch(self.shell, p.contour(self.shell, 30, fallback=-30), ('sand', 'gold', 'tan'), (24, 54), (1.7, 2.4),+ 1.4, 0.7, seed=self.sd())+ skin = np.clip(self.neck + self.head + self.near_legs, 0, 1) * (1 - self.shell)+ self.skin = skin+ p.hatch(skin, p.contour(skin, 12, 90, fallback=80), ('lichen', 'sand'), (14, 34), (1.6, 2.2), 1.4, 0.7,+ seed=self.sd())+ p.hatch(self.far_legs + self.plastron, 80, ('sage', 'tan'), (14, 30), (1.6, 2.2), 1.3, 0.7, seed=self.sd())++ # ------------------------------------------------------------------ 5 modelling the tortoise+ def P(self, u, v):+ """shell coordinates -> canvas: u along the shell (front 0 .. back 1), v from the rim (0) to the top (1)"""+ u = np.clip(np.asarray(u, np.float32), 0, 1); v = np.asarray(v, np.float32)+ i = u * (len(self.T) - 1)+ i0 = np.minimum(i.astype(int), len(self.T) - 2); f = (i - i0)[..., None]+ Tp = self.T[i0] * (1 - f) + self.T[i0 + 1] * f+ Bp = self.B[i0] * (1 - f) + self.B[i0 + 1] * f+ return Bp * (1 - v[..., None]) + Tp * v[..., None]++ def tortoise_model(self):+ p = self.p+ sd = self.sd+ P = self.P+ # far legs and the underside, in shadow and cool+ p.form(self.far_legs, ('olive', 'umber', 'sepia', 'indigo'), 85, LIGHT, length=(14, 30), density=1.5,+ lit=p.shading(self.far_legs, LIGHT) * 0.3, cool='violet', seed=sd())+ p.form(self.plastron, ('tan', 'olive', 'umber', 'sepia'), 4, LIGHT, length=(18, 40), density=1.4,+ lit=np.full((H, W), 0.3, np.float32), cool='violet', seed=sd())+ # the shell, all over: amber and ochre, lit from the low sun on the left+ sl = self.shell_lit+ p.form(self.shell, ('gold', 'ochre', 'amber', 'sienna'), p.contour(self.shell, 40, fallback=-30), LIGHT,+ length=(22, 50), width=(1.6, 2.4), density=1.3, lit=sl, warm='butter', cool='lavender', seed=sd())+ # the scutes: each a low dome with growth rings, laid out in (u, v)+ ub = np.linspace(0.015, 0.985, 13) + np.r_[0, self.r.normal(0, 0.004, 11), 0]+ cu = [0.04, 0.27, 0.49, 0.71, 0.95]+ tl = [0.3, 0.13, 0.0, -0.13, -0.3]+ vu = [0.17, 0.39, 0.61, 0.83]+ V0, V1 = 0.165, 0.625++ def cell(u0, u1, v0, v1, t0=0.0, t1=0.0, n=16):+ us = np.linspace(u0, u1, n); vs = np.linspace(v0, v1, n)+ bow = (lambda vv: 0.05 * (vv - V0) * (V1 - vv) / 0.05) if v0 >= V0 - 1e-3 and v1 <= V1 + 1e-3 else (lambda vv: 0.0)+ sh = lambda uu, vv, t: uu + t * (vv - 0.4) + bow(vv)+ tt = np.interp(us, [u0, u1], [t0, t1])+ pts = np.vstack([P(sh(us, v0, tt), np.full(n, v0)), P(sh(u1, vs, t1), vs),+ P(sh(us[::-1], v1, tt[::-1]), np.full(n, v1)), P(sh(u0, vs[::-1], t0), vs[::-1])])+ return smoothstep(0.4, 0.75, blur(p.poly(pts), 4.0)) * self.shell++ cells = [('m', cell(ub[k], ub[k + 1], 0.0, V0)) for k in range(12)]+ cells += [('c', cell(cu[k], cu[k + 1], V0, V1, tl[k], tl[k + 1])) for k in range(4)]+ cells += [('v', cell(vu[k], vu[k + 1], V1, 1.0)) for k in range(3)]+ for kind, m in cells:+ d = blur(m, 5 if kind == 'm' else 11)+ f = p.contour(m, 4 if kind == 'm' else 9, fallback=-30)+ loc = p.shading(m, LIGHT, 14 if kind == 'm' else 34)+ lo = m * smoothstep(0.55, 0.9, loc) * (0.5 + 0.5 * sl)+ p.hatch(lo, f, ('butter', 'gold', 'sun'), (10, 26), (1.4, 2.0), 1.2, 0.72, opacity=0.55, alpha=0.6,+ seed=sd())+ p.hatch(m * smoothstep(0.45, 0.9, 1 - loc), f, ('sienna', 'amber', 'brown'), (10, 26), (1.4, 2.0), 1.1,+ 0.76, alpha=0.6, seed=sd())+ ring = m * smoothstep(0.8, 0.3, d)+ p.hatch(ring, f, ('sienna', 'brown', 'amber'), (10, 26), (1.4, 2.0), 1.2, 0.76, alpha=0.6, seed=sd())+ for lev in ((0.5, 0.72, 0.9) if kind != 'm' else (0.6,)):+ band = m * smoothstep(0.06, 0.0, np.abs(d - lev))+ p.hatch(band, f, ('brown', 'sienna'), (12, 30), (1.2, 1.6), 1.0, 0.72, alpha=0.5, seed=sd())+ # grooves between the scutes: soft dark pencil lines along the boundaries+ lines = [[P(np.linspace(0.015, 0.985, 60), np.full(60, V0))],+ [P(np.linspace(cu[0] + tl[0] * 0.2, cu[-1] + tl[-1] * 0.2, 60), np.full(60, V1))]]+ lines = [l[0] for l in lines]+ for k in range(1, 12):+ lines.append(P(np.full(8, ub[k]), np.linspace(0.0, V0, 8)))+ for k in range(1, 4):+ vs = np.linspace(V0, V1, 12)+ lines.append(P(cu[k] + tl[k] * (vs - 0.4) + 0.05 * (vs - V0) * (V1 - vs) / 0.05, vs))+ for k in range(1, 3):+ vs = np.linspace(V1, 1.0, 10)+ lines.append(P(np.full(10, vu[k]), vs))+ for ln in lines:+ p.line(ln, 'sepia', 2.7, 0.8, 0.62, 0.3, seg=(40, 90), wobble=0.9, clip=self.shell, gaps=0.08, seed=sd())+ p.line(ln, 'umber', 1.8, 0.78, 0.55, 0.3, seg=(30, 70), wobble=1.3, clip=self.shell, gaps=0.15, seed=sd())+ p.line(ln + np.array([2.5, 2.5], np.float32), 'gold', 1.6, 0.66, 0.4, 0.55, seg=(30, 70), wobble=1.0,+ clip=self.shell, gaps=0.3, seed=sd()) # a catch of light on the lip of each plate+ # the dome's shadow side: deeper and cooler+ p.hatch(self.shell * smoothstep(0.4, 0.95, 1 - sl), p.contour(self.shell, 40, fallback=-30),+ ('umber', 'sienna', 'violet'), (20, 46), (1.6, 2.3), 1.1, 0.78, alpha=0.55, seed=sd())+ p.hatch(self.shell * smoothstep(0.55, 1.0, 1 - sl) * 0.8, -30, ('violet', 'indigo', 'periwinkle'), (20, 46),+ (1.6, 2.3), 0.8, 0.74, alpha=0.45, seed=sd())+ # the rim of the shell overhangs: a band of shadow just inside the lower edge+ rimband = self.shell * smoothstep(0.08, 0.0, self.v_of_shell())+ p.hatch(rimband, 0, ('umber', 'sepia'), (14, 30), (1.5, 2.0), 1.2, 0.8, alpha=0.6, seed=sd())+ p.edge(self.shell, 'brown', density=0.7, where=0.4 + 0.6 * smoothstep(0.3, 0.8, 1 - sl), seed=sd())++ # the skin: neck across its wrinkles, the head round its form, legs with scales+ sk = ('lichen', 'sage', 'olive', 'umber')+ neck = self.neck * (1 - self.shell) * (1 - self.head)+ neckf = p.blend(np.full((H, W), np.deg2rad(86), np.float32), p.contour(self.neck, 8), 0.25)+ nl = p.shading(self.neck, LIGHT, 34)+ p.form(neck, sk, neckf, LIGHT, length=(12, 30), width=(1.5, 2.1), density=1.4, lit=nl, warm='butter',+ cool='lavender', seed=sd())+ xs = np.cumsum(self.r.uniform(13, 24, 9)) + 778+ for k, x0 in enumerate(xs): # loose folds across the neck, bowing forward+ if x0 > 930: break+ ty = np.interp(x0, [772, 812, 872, 936], [612, 618, 630, 640])+ by = np.interp(x0, [770, 806, 858, 936], [690, 716, 736, 748])+ bow = self.r.uniform(7, 13)+ top_y = ty + self.r.uniform(4, 16)+ pts = [(x0 + 3, top_y), (x0 - bow, (top_y + by) / 2), (x0 + 2, by - self.r.uniform(2, 10))]+ p.line(pts, 'umber', 1.9, 0.72, 0.62, 0.3, seg=(40, 90), wobble=0.5, clip=neck, seed=sd())+ p.line([(q[0] + 4.5, q[1]) for q in pts], 'cream', 1.5, 0.66, 0.4, 0.6, seg=(40, 90), clip=neck, seed=sd())+ for k in range(3): # loose skin under the throat+ yy = 700 + 12 * k+ p.line([(784, yy - 8), (830, yy + 10), (880, yy + 16), (930, yy + 18)], 'umber', 1.5, 0.66, 0.5, 0.3,+ seg=(40, 80), clip=neck, seed=sd())+ p.hatch(neck * smoothstep(690, 740, p.YY), 0, ('umber', 'violet'), (14, 30), (1.4, 2.0), 1.1, 0.78, alpha=0.6,+ seed=sd())+ hl = p.shading(self.head, LIGHT, 42)+ p.form(self.head, sk, p.contour(self.head, 14, fallback=10), LIGHT, length=(10, 26), width=(1.4, 2.0),+ density=1.5, lit=hl, warm='butter', cool='lavender', seed=sd())+ # the face: an old, gentle eye under a soft lid, a long closed smile, a nostril, warmth in the cheek+ ex, ey = EYE+ p.blush(ex - 10, ey + 34, 16, 'peach', 0.6, seed=sd())+ socket = p.ellipse(ex + 1, ey, 13, 11)+ p.hatch(socket * (1 - p.ellipse(ex, ey, 7, 7.5)), 30, ('olive', 'umber'), (5, 11), (1.2, 1.6), 1.2, 0.74,+ alpha=0.45, seed=sd())+ p.eye(ex, ey, 6.8, 'sepia', look=(-1.6, 1.4), seed=sd())+ p.line([(ex - 12, ey - 3), (ex - 4, ey - 9), (ex + 6, ey - 10), (ex + 15, ey - 5)], 'umber', 1.9, 0.74, 0.8,+ 0.3, seg=(50, 60), wobble=0.2, seed=sd()) # the lid+ p.line([(ex - 10, ey - 15), (ex + 2, ey - 19), (ex + 16, ey - 14)], 'olive', 1.4, 0.62, 0.6, 0.3,+ seg=(40, 50), wobble=0.3, seed=sd()) # the brow fold above it+ p.line([(ex - 8, ey + 9), (ex + 3, ey + 12), (ex + 13, ey + 9)], 'olive', 1.3, 0.62, 0.6, 0.3, seg=(30, 40),+ wobble=0.2, seed=sd())+ p.line([(604, 670), (632, 682), (672, 688), (712, 684), (734, 676)], 'umber', 1.9, 0.74, 0.78, 0.3,+ seg=(40, 80), wobble=0.4, seed=sd()) # mouth: a long, closed, slightly upturned line+ p.line([(734, 676), (742, 668)], 'umber', 1.5, 0.7, 0.6, 0.3, seg=(20, 30), seed=sd())+ p.hatch(p.ellipse(594, 634, 3.6, 2.6), 0, 'sepia', (3, 6), (1.3, 1.6), 3, 0.9, 0.5, seed=sd())+ for k in range(3): # a few wrinkles under the eye and on the cheek+ p.line([(ex + 18 + 6 * k, ey + 14 + 3 * k), (ex + 30 + 6 * k, ey + 22 + 4 * k)], 'olive', 1.2, 0.6, 0.5,+ 0.3, seg=(20, 30), seed=sd())+ p.edge(self.head, 'umber', density=0.6, where=0.4 + 0.6 * smoothstep(0.3, 0.8, 1 - hl), seed=sd())+ # legs: scales, skin folds at the top where they come out from under the shell, wet near the water+ legs = self.near_legs+ ll = p.shading(legs, LIGHT, 40)+ p.form(legs, sk, 88, LIGHT, length=(14, 32), width=(1.5, 2.1), density=1.4, lit=ll, warm='butter',+ cool='lavender', seed=sd())+ p.scales(legs * smoothstep(WATER_T - 6, WATER_T - 36, p.YY), 20, ('olive', 'sage', 'lichen'), 'umber', 0,+ LIGHT[:2], lit=ll, seed=sd())+ for (lx0, lx1, ly) in [(924, 1090, 708), (1494, 1652, 722)]:+ for k in range(3):+ yy = ly + 10 + 13 * k+ p.line([(lx0 + 10, yy + 6), ((lx0 + lx1) / 2, yy + 12 + self.r.normal(0, 2)), (lx1 - 8, yy + 4)],+ 'umber', 1.6, 0.66, 0.55, 0.3, seg=(40, 80), clip=legs, seed=sd())+ p.hatch(legs * smoothstep(WATER_T - 50, WATER_T, p.YY), 0, ('umber', 'teal'), (14, 30), (1.4, 2.0), 1.1, 0.76,+ alpha=0.55, seed=sd())+ p.edge(legs, 'umber', density=0.6, seed=sd())+ # the shell's shadow on the neck, legs and the plastron+ sh = blur(np.roll(self.shell, 14, 0), 22)+ shadow = np.clip(sh * 1.6, 0, 1) * (1 - self.shell) * np.clip(self.skin + self.plastron, 0, 1)+ p.hatch(shadow, 0, ('violet', 'umber', 'indigo'), (14, 30), (1.4, 2.0), 1.4, 0.78, alpha=0.62, seed=sd())++ def v_of_shell(self):+ """an approximate v (0 at the rim .. 1 at the top) for every pixel of the shell"""+ if not hasattr(self, '_v'):+ p = self.p+ ty = np.interp(p.XX[0], self.T[:, 0], self.T[:, 1])[None].repeat(H, 0)+ by = np.interp(p.XX[0], self.B[:, 0], self.B[:, 1])[None].repeat(H, 0)+ self._v = np.clip((by - p.YY) / np.maximum(1, by - ty), 0, 1).astype(np.float32)+ return self._v++ # ------------------------------------------------------------------ 6 the garden on its back+ def garden_phase(self):+ p = self.p+ sd = self.sd+ P = self.P+ # a mossy cap of rounded cushions along the top of the shell+ cush = []+ for k, u in enumerate(np.linspace(0.2, 0.82, 34)): # the main band, overlapping+ for v, rr in ((self.r.uniform(0.95, 1.01), self.r.uniform(30, 42)), (self.r.uniform(0.86, 0.92), self.r.uniform(26, 38))):+ c = P(np.array([u + self.r.normal(0, 0.006)]), np.array([v]))[0]+ cush.append((c[0], c[1] - 4, rr, rr * self.r.uniform(0.6, 0.78), sd()))+ for k in range(26): # a lumpy lower edge+ u = self.r.uniform(0.22, 0.8)+ c = P(np.array([u]), np.array([self.r.uniform(0.76, 0.84)]))[0]+ rr = self.r.uniform(14, 26)+ cush.append((c[0], c[1], rr, rr * self.r.uniform(0.6, 0.8), sd()))+ for k in range(9): # a few loose ones further down+ u = self.r.uniform(0.25, 0.78)+ c = P(np.array([u]), np.array([self.r.uniform(0.62, 0.72)]))[0]+ rr = self.r.uniform(9, 16)+ cush.append((c[0], c[1], rr, rr * 0.7, sd()))+ cap = np.zeros((H, W), np.float32); clit = np.zeros_like(cap)+ for (cx, cy, rx, ry, s_) in sorted(cush, key=lambda c: c[1]):+ m = p.blob(cx, cy, rx, ry, 0.18, seed=s_)+ clit = clit * (1 - m) + p.shading(m, LIGHT, rx * 0.5) * m+ cap = np.maximum(cap, m)+ self.cap = cap+ glob_lit = p.shading(cap, LIGHT, 60)+ lit = np.clip(0.55 * clit + 0.45 * glob_lit, 0, 1)+ mf = p.blend(p.radial(1280, 560, 0, 12, 30), p.flow(-90, 30, 40), 0.3)+ p.pelt(cap, ('meadow', 'yellowgreen', 'moss', 'forest'), mf, LIGHT, length=(7, 15), density=1.2, lit=lit,+ seed=sd())+ # a few long locks of moss hanging over the shell below the cap+ locks = np.zeros((H, W), np.float32)+ for u in np.linspace(0.23, 0.8, 26) + self.r.normal(0, 0.006, 26):+ c = P(np.array([u]), np.array([self.r.uniform(0.74, 0.8)]))[0]+ locks = np.maximum(locks, p.ellipse(c[0], c[1] + 20, self.r.uniform(8, 12), self.r.uniform(18, 30)))+ locks = blur(locks, 2) * self.shell * (1 - cap * 0.6)+ self.locks = locks+ hf = p.flow(94, 8, 60)+ llit = p.shading(locks, LIGHT, 8)+ kw = dict(light=LIGHT[:2], spread=0.26, curl=0.08)+ p.fur(locks, hf, ('forest', 'pine', 'olive'), (20, 36), (1.0, 1.4), 1.0, (5, 9), pressure=0.82, seed=sd(), **kw)+ p.fur(locks, hf, ('moss', 'olive', 'grass'), (22, 40), (1.0, 1.4), 1.1, (5, 9), pressure=0.78, seed=sd(), **kw)+ p.fur(locks * smoothstep(0.4, 0.9, llit), hf, ('yellowgreen', 'meadow'), (14, 28), (1.0, 1.3), 0.8, (3, 6),+ opacity=0.5, seed=sd(), **kw)+ # the tree, the crooked lantern post, tufts of grass and wildflowers+ p.tree(TREE['x'], TREE['y'], TREE['h'], TREE['r'], ('lemon', 'gold', 'amber', 'sienna'), ('tan', 'brown', 'umber'),+ TREE['clumps'], (8, 16), LIGHT, TREE['lean'], seed=TREE['seed'])+ p.form(self.postm, ('brown', 'umber', 'sepia', 'sepia'), p.contour(self.postm, 2.5, fallback=90), LIGHT,+ cross=8, length=(10, 22), width=(1.3, 1.8), density=1.7, warm='ochre', seed=sd())+ for (kx, ky) in [(1085, 262), (1082, 218)]: # knots on the stick+ p.hatch(p.ellipse(kx, ky, 3.5, 2.5), 0, 'sepia', (3, 6), (1.2, 1.5), 3, 0.9, 0.5, seed=sd())+ tufts = cap * smoothstep(0.55, 0.75, noise2d(H, W, 26, 2, sd())) * smoothstep(0.3, 0.8, blur(cap, 6))+ p.grass(tufts, ('grass', 'yellowgreen', 'moss', 'meadow'), height=(14, 34), density=0.9, sway=20, seed=sd())+ for (u, n) in [(0.28, 9), (0.4, 7), (0.55, 10), (0.66, 8), (0.76, 6)]:+ c = P(np.array([u]), np.array([0.93]))[0]+ p.flowers(p.ellipse(c[0], c[1] - 10, 46, 18) * cap, ('daisy', 'buttercup', 'poppy', 'forgetmenot', 'pink'),+ n=n, size=(5.0, 8.5), stems='moss', seed=sd())+ lx, ly, ls = LANTERN+ p.line([(POST[-1][0], POST[-1][1]), (lx, ly)], 'umber', 1.5, 0.75, 0.85, 0.4, seg=(30, 40))+ self.lantern_c = p.lantern(lx, ly, ls, seed=sd())++ # ------------------------------------------------------------------ 7 the child and the stepping stones+ def child_phase(self):+ p = self.p+ sd = self.sd+ for (cx, cy, rx, ry) in sorted(STONES, key=lambda s: s[1]):+ p.stone(cx, cy, rx, ry, moss=('moss', 'olive', 'grass') if rx > 45 else None, light=LIGHT,+ avoid=self.childm if cy < CHILD['y'] + 20 else None, seed=sd())+ c = p.child(CHILD['x'], CHILD['y'], CHILD['h'], 1, look=(0.6, -0.8), light=LIGHT, seed=21)+ self.child_info = c+ hx, hy = c['hand']+ p.line([(hx, hy - 4), (hx + 2, hy + 8)], 'umber', 1.4, 0.7, 0.8, 0.4, seg=(30, 40))+ self.child_lc = p.lantern(hx + 2, hy + 8, 30, seed=sd())++ # ------------------------------------------------------------------ 8 reflections and ripples+ def reflection_phase(self):+ p = self.p+ sd = self.sd+ src = p.C.copy()+ av = np.clip(self.fg + self.childm + self.stones, 0, 1)+ # the tortoise's legs and underside, mirrored at the waterline+ reg = self.water * (p.YY > WATER_T) * (p.XX > 880) * (p.XX < 1700) * (1 - av)+ wl = np.full(W, float(WATER_T), np.float32)+ ys = np.clip(2 * WATER_T - p.YY, 0, H - 1).astype(int)+ refl_mask = self.tort[ys, p.XX.astype(int)] * reg+ refl_mask = blur(refl_mask, 3) * smoothstep(WATER_T + 150, WATER_T + 10, p.YY)+ p.reflect(wl, refl_mask, src=src, ripple=6, stretch=1.0, darken=0.3, tint='teal', mixw=0.22,+ length=(20, 60), width=(1.6, 2.3), density=1.9, pressure=0.78, opacity=0.45, seed=sd())+ gap = (self.water * (p.XX > 1040) * (p.XX < 1560) * (p.YY > 760) * (p.YY < WATER_T + 70)).astype(np.float32)+ gap = blur(gap, 6) * (1 - self.tort) * (1 - av)+ dark = gap * smoothstep(WATER_T + 70, 790, p.YY)+ p.hatch(dark, p.flow(0, 3), ('slate', 'teal', 'indigo', 'violet'), (24, 60), (1.6, 2.3), 1.6, 0.8, alpha=0.7,+ seed=sd())+ p.hatch(dark * smoothstep(860, 790, p.YY), p.flow(0, 3), ('indigo', 'umber', 'violet'), (24, 60), (1.6, 2.3),+ 1.2, 0.82, alpha=0.65, seed=sd())+ # the child and their stone+ cw = float(CHILD['y'] + 16)+ reg = self.water * (p.YY > cw) * (1 - av)+ ys = np.clip(2 * cw - p.YY, 0, H - 1).astype(int)+ cm = np.clip(self.childm + self.child_lantern, 0, 1)[ys, p.XX.astype(int)] * reg+ cm = blur(cm, 2.5) * smoothstep(cw + 120, cw + 5, p.YY)+ p.reflect(np.full(W, cw, np.float32), cm, src=src, ripple=5, stretch=1.0, darken=0.15, tint='teal', mixw=0.2,+ length=(14, 40), width=(1.5, 2.1), density=1.6, pressure=0.74, opacity=0.45, seed=sd())+ # ripples where the legs meet the water and round the stones+ for (cx, rx) in [(996, 92), (1584, 86), (1206, 60), (1437, 54)]:+ p.ripples(cx, WATER_T + 4, rx, 11, 3, 'cream', 1.8, opacity=0.7, seed=sd())+ p.ripples(cx, WATER_T + 7, rx * 1.05, 12, 2, 'slate', 1.5, opacity=0.35, seed=sd())+ for (cx, cy, rx, ry) in STONES:+ p.ripples(cx, cy + ry * 0.55, rx * 1.12, ry * 0.5, 2, 'cream', 1.5, opacity=0.6, grow=1.25, seed=sd())++ # ------------------------------------------------------------------ 9 the lights and the near bank+ def lights_phase(self):+ p = self.p+ sd = self.sd+ # the low sun's warm rim on the left of the tortoise, the child and the tree+ bare = 1 - np.clip(self.cap + self.locks + self.crown + self.postm, 0, 1)+ for m, w in ((self.shell * bare, 18), (self.head, 10), (self.neck * (1 - self.shell), 10), (self.near_legs, 8),+ (self.crown, 12), (self.cap, 8), (self.childm, 5)):+ inner = m * smoothstep(0.85, 0.3, blur(m, w))+ gy, gx = np.gradient(blur(m, w))+ side = smoothstep(0.0, 1.0, (0.82 * gx + 0.45 * gy) * w * 2.4)+ p.hatch(inner * side, p.contour(m, 4), ('glow', 'apricot', 'butter'), (10, 26), (1.4, 2.0), 1.2, 0.72,+ opacity=0.62, alpha=0.75, seed=sd())+ # lanterns and windows+ lx, ly = self.lantern_c+ p.glow(lx, ly, 76, strength=0.8, halo=0.3, density=1.1, seed=sd())+ near = np.exp(-(((p.XX - lx) / 110) ** 2 + ((p.YY - ly - 90) / 70) ** 2))+ p.hatch(np.clip(self.cap + self.postm, 0, 1) * near, p.flow(-80, 30, 30), ('butter', 'glow', 'lemon'), (8, 18),+ (1.2, 1.7), 1.2, 0.72, opacity=0.55, alpha=0.7, seed=sd())+ cx, cy = self.child_lc+ p.glow(cx, cy, 60, strength=0.8, halo=0.3, density=1.1, seed=sd())+ # its light on the child's coat and on the stone and water below+ near = np.exp(-(((p.XX - cx) / 60) ** 2 + ((p.YY - cy) / 60) ** 2))+ p.hatch(self.childm * near, 90, ('glow', 'lemon'), (6, 14), (1.2, 1.6), 1.2, 0.72, opacity=0.6, alpha=0.7,+ seed=sd())+ m = p.ellipse(cx, 2 * (CHILD['y'] + 16) - cy, 14, 34) * self.water * (1 - self.stones)+ p.hatch(m, 0, ('lantern', 'glow', 'flame'), (6, 18), (1.5, 2.0), 1.4, 0.74, opacity=0.7, alpha=0.75, seed=sd())+ for (x, y, w, h, *_rest) in COTTAGES:+ p.glow(x + w * 0.36, y - h * 0.5, 34, strength=0.45, halo=0.22, density=0.8, length=(5, 12),+ width=(1.2, 1.7), clip=1 - self.fg, seed=sd())+ # the near bank: grass, a few reeds, wildflowers+ bank = self.nearbank+ p.form(bank, ('meadow', 'yellowgreen', 'grass', 'moss'), p.flow(-8, 20, 120), LIGHT, length=(24, 54),+ density=1.3, lit=np.full((H, W), 0.55, np.float32) * (0.8 + 0.2 * noise2d(H, W, 150, 2, sd())),+ warm='butter', seed=sd())+ lump = smoothstep(0.35, 0.75, noise2d(H, W, 90, 2, sd()))+ p.grass(bank * (0.35 + 0.65 * lump), ('grass', 'leaf', 'yellowgreen', 'moss'), height=(24, 60), density=0.9,+ sway=18, seed=sd())+ p.grass(bank * lump, ('forest', 'moss', 'olive', 'leaf'), height=(40, 96), density=0.55, sway=22, seed=sd())+ corners = bank * np.clip(smoothstep(260, 0, p.XX) + smoothstep(1560, 1920, p.XX), 0, 1)+ p.grass(corners, ('moss', 'olive', 'yellowgreen', 'meadow'), height=(70, 150), density=0.45, sway=16,+ tuft=(3, 6), seed=sd())+ p.flowers(bank * smoothstep(0.3, 0.7, noise2d(H, W, 60, 2, sd())), ('daisy', 'buttercup', 'poppy',+ 'forgetmenot', 'daisy', 'pink'), n=90, size=(6.0, 11.0), stems='leaf', seed=sd())+ for (bx, by, br, s_) in [(70, 1030, 120, 401), (1858, 1010, 130, 402)]:+ crown = p.tree(bx, by + 40, 30, br, ('meadow', 'yellowgreen', 'grass', 'forest'), ('olive', 'umber', 'sepia'),+ 7, (8, 15), LIGHT, 0.0, branches=False, seed=s_)+ p.flowers(crown * smoothstep(0.4, 0.9, blur(crown, 10)), ('daisy', 'pink', 'buttercup', 'daisy'), n=26,+ size=(5.0, 8.0), seed=sd())+++PHASES = (('sky', 'sky_phase'), ('land', 'land_phase'), ('stream', 'water_phase'), ('tortoise', 'tortoise_base'),+ ('modelling', 'tortoise_model'), ('garden', 'garden_phase'), ('child', 'child_phase'),+ ('reflections', 'reflection_phase'), ('lights', 'lights_phase'))+++def main():+ out = sys.argv[1] if len(sys.argv) > 1 and not sys.argv[1].startswith('--') else 'pencilbook_tortoise_crossing.jpg'+ stages = sys.argv[sys.argv.index('--stages') + 1] if '--stages' in sys.argv else None+ T0 = time.time()+ tick = (lambda name: print(f'{name:12s} {time.time() - T0:5.1f}s')) if os.environ.get('PB_TIMING') else (lambda n: None)+ p = PencilStorybook(W, H, seed=8, keep_stages=bool(stages), stages_dir=stages)+ p.finish()+ p.paper()+ p.stage('paper')+ sc = Scene(p)+ tick('setup')+ for name, ph in PHASES[:-1]:+ getattr(sc, ph)()+ tick(name)+ p.stage(name)+ getattr(sc, PHASES[-1][1])()+ tick(PHASES[-1][0])+ p.save(out, stages_dir=stages)+ tick('saved')+ print('saved', out, f'{time.time() - T0:.1f}s', p.n_strokes, 'strokes')+++if __name__ == '__main__':+ main()diff --git a/lib/pencilbook.py b/lib/pencilbook.pynew file mode 100644index 0000000..75bf6a1--- /dev/null+++ b/lib/pencilbook.py@@ -0,0 +1,1359 @@+"""pencilbook — 暖调彩铅绘本 / Warm Pencil Storybook: a picture-book spread in soft, layered coloured pencil on warm+toothy paper (numpy + Pillow only).++The look: a children's storybook page drawn in coloured pencil. Every surface -- sky, hills, grass, water, a giant+gentle creature, a small child -- is built from many fine directional pencil strokes laid in layers: a light+under-layer, the local colour, darker strokes of the same family in the shade, a warm glaze where the light falls and+a cool one in the shadow, each layer at a slightly different angle so the strokes cross. The wax only catches the+peaks of the paper's tooth, so tiny specks of warm white paper show through all the colour, fewer where the pencil+was pressed hard or the layers have filled the tooth. Fur and grass are tufts of fine strokes that follow the lie of+the hair. Edges are soft; there are no ink lines, at most a faint pencil contour in a darker version of the local+colour. The light is warm (late afternoon, dusk), lanterns and lit windows glow as layered orange-yellow strokes,+the palette is warm and only medium-saturated (yellow, orange, grass green, cobalt, ochre) and has no black.++Physical model+ paper A warm white sheet with a fine tooth `T`: a 1-3 px grain over a softer ripple, rank-equalised to a uniform+ 0..1 so "the wax reaches where tooth > 1 - pressure" turns a pressure straight into a coverage+ fraction. A pencil dragged across the paper rides from peak to peak, so the pits it skips are drawn out+ a little along the stroke: the tooth is pre-averaged along 8 directions (`TD`) and every stroke reads+ the version that matches its own direction. A wax-fill buffer `F` records how much wax already sits+ in the tooth: later layers reach a little deeper (`fill`), so heavily worked areas close up while+ light ones stay speckled -- but the same pits stay white through every layer, as on real paper.+ stroke One pencil stroke is a centreline integrated through an orientation field (angles mod pi, so it never+ flips halfway), with a slight wrist arc. Thousands are rasterised at once: Pillow draws every stroke as+ a polyline with its own id into a 2x supersampled integer map, then, for every covered sub-pixel, numpy+ looks up that stroke's colour, start, direction, length, pressure and taper, recovers the position+ along the stroke (u) and from it the pressure profile (pressed at the start, lifting off at the end),+ and where the pressure reaches the (direction-matched) tooth the wax is laid. Sub-pixels are summed back+ to pixels with bincount (only covered pixels are touched), so a pass costs about one Pillow line per+ stroke. Within one pass the top stroke wins; layers come from several passes (`passes`), so+ overlapping strokes of different passes build up like real hatching. Strokes are seeded on a jittered+ grid (even hatching, no clumps); the region is both where they land and, pixel by pixel, how hard the+ pencil is pressed (`fade`), so a shadow field gives a smooth gradation instead of scattered dark+ dashes; `avoid` colours round things that come later (an illustrator leaves the tortoise blank while+ laying the sky, so its colours don't mix with the blue).+ wax Coloured pencil is semi-transparent: new = old + A x (target - old), target = (1 - opacity) x+ old x colour / paper + opacity x colour. Over bare paper a stroke is exactly its colour; blue over+ yellow goes green, a dark over its own colour goes deeper; light pencils (white, cream, yellow) over a+ dark need a high `opacity` (burnishing).+ form `shading(mask, light)` turns a silhouette into a soft dome (sum of blurs), takes its normals and gives+ a 0..1 light field for a light from the upper left (default). `form()` paints a shape the way a+ pencil illustrator models it: a light under-layer all over, the local colour, the shadow colour where+ the light falls off, the deepest tone in the core shadow, then a warm glaze on the lit side and a cool+ glaze in the shadow, the layers crossing at +-`cross` degrees around the form's own direction field.+ fields `flow()` a drifting direction (sky, water), `contour()` along the iso-lines of a shape (strokes that+ wrap round a dome or a stone), `radial()` away from a point (glow, petals), `blend()` with doubled+ angles (0 and pi are the same direction), `rotate()`.+ fur, grass `fur()` lays tufts: each tuft is a clump of 4-12 fine strokes whose roots spread across the clump and+ whose tips converge (hair lies in locks), curling a little the same way, pressed at the root and+ lifting off at the tip, all following the lie of the hair; the strands on the side of a lock away from+ the light are a little darker, so every lock has a lit and a shadowed flank. `pelt()` is a whole coat:+ a soft under-layer, dark short locks in the shadow, the local colour, light-tipped locks on the lit+ side. `grass()` is the opposite clump -- blades rising from a base and fanning out; `leaves()` packs+ short curved leaf strokes in clumps for tree crowns.+ storybook `tree()` (a trunk, branches and a crown of separately lit clumps; `tree_plan()` gives its masks first),+ `cottage()` (walls along the vertical, roof along its slopes, lit windows, door, chimney), `stone()`+ (contour-hatched, flattish top, optional moss), `scales()` (staggered small domes with a crease on the+ shadow side), `flowers()` (rounded petal strokes round a centre dab, optional stems).+ light `glow()` lays warm light as strokes that follow the surface round a point (white-yellow near the+ source, orange further out, thinning into the surroundings -- not rays), over a soft tooth-textured+ lift of the paper (never a smooth blob); `window()` is a lit window: orange at the frame, butter-yellow+ at the centre, a few muntins; `lift()` is a kneaded eraser / white-pencil lift.+ water `reflect()` paints horizontal strokes whose colour is the mirrored picture above the waterline (pushed+ sideways by ripples, softened and mixed with the water colour), so a reflection is made of strokes+ too; `ripples()` are broken elliptical pencil rings round something standing in the water.+ people `child()` is a small storybook child (a few hundred px at most): a raincoat with a hood down, boots,+ a bob of hair in smooth locks, a dot eye, a rosy cheek, one hand forward for a lantern+ (`paint=False` only plans its mask); `lantern()` a small round paper lantern; `eye()` a soft dot eye+ with a glint and an optional lid; `blush()`.+ finish `finish()` (call it before the first stroke; applied in render so every stage snapshot matches the+ final): a slight softness, fine grain and a faint warm vignette.++API (canvas pixel coordinates; a number given as a field is a direction in degrees, 0 = to the right, 90 = down;+ field arrays are radians; colours are PAINTS names, '#rrggbb' or RGB triples; ramps are RAMPS names or lists)+ surface PencilStorybook(W, H, seed, keep_stages, stages_dir); paper(tone, tooth, mottle, fibres)+ masks poly(pts, smooth) / ellipse(cx, cy, rx, ry, rot) / blob(cx, cy, rx, ry, rough) / tube(path, w0, w1) /+ below(xs, ys, invert) / rect(x0, y0, x1, y1) -> canvas-sized float masks+ fields flow(angle_deg, turb, scale); contour(mask, sigma, offset); radial(cx, cy, offset); blend(f1, f2, w);+ rotate(field, deg); value(top, bottom, y0, y1, mottle) value fields; shading(mask, light, sigma, wrap)+ strokes hatch(region, field, colour, length, width, density, pressure, opacity, alpha, jitter, bend, value, hue,+ taper, passes, clip, avoid, fade); strokes(paths, colour, width, pressure, opacity, taper, clip);+ line(path, colour, width, pressure, seg, wobble, clip, gaps); edge(mask, colour, width, density, where)+ form form(mask, colours, field, light, cross, length, width, density, pressure, warm, cool, edge, lit, avoid)+ hair fur(region, field, colour, length, width, density, tuft, spread, curl, converge, pressure, side, light);+ pelt(mask, colours, field, light, length, density, lit); grass(region, colour, height, lean, sway,+ density, tuft, fan); leaves(region, colour, size, density, field)+ storybook tree(x, y, h, r, colours, trunk, clumps, leaf, light, lean, seed) / tree_plan(...); cottage(x, y, w, h,+ wall, roof, windows, door, chimney, light, glow); stone(cx, cy, rx, ry, colours, moss, light);+ scales(mask, size, colours, groove, field, light, lit); flowers(region, kinds, n, size, stems)+ light glow(x, y, r, colours, strength, density, halo, squash, clip); window(x0, y0, x1, y1, panes, frame);+ lift(mask, colour, amount)+ water reflect(waterline, region, src, ripple, stretch, darken, tint, length, width, density);+ ripples(cx, cy, rx, ry, rings, colour)+ people child(x, y, h, facing, coat, hair, boots, legs, look, paint) -> anchors; lantern(x, y, size, glow) -> centre;+ eye(x, y, r, lid, look); blush(x, y, r); dots(region, colours, n, size)+ finish finish(soft, grain, vignette); render(); composite(); stage(name); save(path, stages_dir)++ import sys; sys.path.insert(0, 'lib')+ from pencilbook import PencilStorybook+ p = PencilStorybook(1920, 1080, seed=3)+ p.finish(); p.paper()+ sky = p.below(None, 620, invert=True)+ p.hatch(sky, p.flow(-4, 6), ('dusk_sky', p.value(0, 1, 0, 620)), length=(60, 140), density=1.4)+ hill = p.below([0, 600, 1200, 1920], [640, 560, 600, 580])+ p.form(hill, ('sage', 'grass', 'leaf', 'forest'), p.flow(-8, 12), warm='butter', cool='periwinkle')+ p.grass(p.below(None, 900), ('grass', 'leaf', 'yellowgreen'), height=(30, 70))+ p.tree(1400, 640, 120, 90, seed=4)+ c = p.child(700, 900, 200, 1, light=p.LIGHT)+ p.glow(*p.lantern(c['hand'][0], c['hand'][1], 28), 60)+ p.save('page.jpg')+"""+import io+import os+import numpy as np+from PIL import Image, ImageDraw+from core import blur, fbm1d, noise2d, smoothstep, spline, blob_pts+++PAINTS = {+ # paper and the lightest pencils+ 'paper': '#f6eedc', 'white': '#fffaf0', 'cream': '#fbf0d6', 'ivory': '#f8ead0',+ # sky and cool colours+ 'sky_top': '#4f78bd', 'cobalt': '#4469b0', 'sky': '#6f97d0', 'cornflower': '#86a7d9', 'sky_pale': '#b8cce6',+ 'powder': '#cad9ec', 'periwinkle': '#8f9bd0', 'lavender': '#ac9fc8', 'mauve': '#b58fa6', 'violet': '#6b5f99',+ 'ultramarine': '#3a4e98', 'indigo': '#373f73', 'slate': '#68718c', 'teal': '#4e8584', 'aqua': '#93c3c3',+ # warm light+ 'lemon': '#f5e27c', 'butter': '#f7d877', 'sun': '#fbe7a6', 'apricot': '#f4bd78', 'peach': '#f2ad86',+ 'glow': '#ffe39a', 'lantern': '#ffc457', 'flame': '#f89a3a', 'orange': '#ec8a36', 'tangerine': '#e9742f',+ # greens+ 'meadow': '#c3c86a', 'yellowgreen': '#b3c24d', 'grass': '#88a843', 'leaf': '#5f8d3c', 'sage': '#9fb07c',+ 'moss': '#748a38', 'olive': '#7f7a3c', 'forest': '#3f6038', 'pine': '#2f4b3e', 'lichen': '#b7bd88',+ # earth+ 'ochre': '#cc9642', 'gold': '#dca84b', 'amber': '#c97a30', 'sienna': '#a6582f', 'brown': '#7c5236',+ 'umber': '#6a4a33', 'sepia': '#553d30', 'tan': '#c9a77c', 'sand': '#dcc39a', 'stone': '#a39a8c',+ 'warmgrey': '#8f8478', 'pebble': '#bfb5a4',+ # reds and pinks+ 'terracotta': '#c86c47', 'brick': '#a9503a', 'rose': '#df8b86', 'coral': '#e9785e', 'vermilion': '#d65a3a',+ 'red': '#c4443a', 'cheek': '#ea8f7c', 'pink': '#efb0a6',+ # people+ 'skin': '#f2c9a4', 'skin_shade': '#dc9c7c', 'hair': '#6e4630', 'hair_light': '#a2683f',+ 'raincoat': '#f3c53e', 'raincoat_shade': '#dc982f', 'raincoat_deep': '#b8722c',+ 'denim': '#5b74a8', 'boot': '#d2553f', 'eye': '#3b2c2a',+}++RAMPS = {+ 'dusk_sky': ['#7096cb', '#7f9fd2', '#96b0da', '#b4c6e2', '#d9d4dc', '#f1d2b6', '#f5cc9c', '#f7dca2'],+ 'day_sky': ['#4672b9', '#5f8ac8', '#83a6d6', '#a9c1e2', '#cbd9ec'],+ 'glow': ['#ffefc0', '#ffe39a', '#ffd172', '#fbb757', '#f39a42', '#e67e38'],+ 'water': ['#5d84bf', '#7a9dcf', '#a0bad9', '#d5ccc9', '#efc9a2', '#f4d49a'],+ 'meadow': ['#5f8d3c', '#7d9f40', '#9fb34a', '#bcc25a', '#d8cc76'],+ 'hills': ['#7f86b4', '#9196bd', '#a8a5c3', '#bcb4c6'],+ 'shell': ['#5e3e2b', '#7e5232', '#a06a35', '#c08940', '#d8aa58', '#ecca7d'],+ 'skin': ['#5f5d3c', '#7a7646', '#959054', '#b0a96a', '#cbc287'],+ 'stone': ['#6f6a62', '#8c857a', '#a79e90', '#c2b8a6', '#dcd1bd'],+ 'autumn': ['#8a5a2c', '#b8742c', '#d9973a', '#e8b84a', '#efd06a', '#b9b84e', '#8ea443'],+}+++def hexc(c):+ """'#rrggbb', a PAINTS name or an RGB triple -> float32 RGB in 0..1"""+ if not isinstance(c, str): return np.asarray(c, np.float32)+ h = PAINTS.get(c, c).lstrip('#')[:6]+ return np.array([int(h[i:i + 2], 16) for i in (0, 2, 4)], np.float32) / 255+++def ramp(spec):+ """a RAMPS name or a list of colours -> (K, 3) array"""+ if isinstance(spec, np.ndarray): return spec.astype(np.float32)+ if isinstance(spec, str): spec = RAMPS[spec]+ return np.stack([hexc(c) for c in spec]).astype(np.float32)+++def ramp_at(R, l):+ """colour at 0..1 positions l along ramp R (vectorised)"""+ l = np.clip(np.asarray(l, np.float32), 0, 1) * (len(R) - 1)+ i = np.minimum(l.astype(np.int32), len(R) - 2)+ f = (l - i)[..., None]+ return R[i] * (1 - f) + R[i + 1] * f+++def hue_rotate(c, theta):+ """rotate RGB colours (N, 3) about the grey axis by theta radians (N,): a real hue shift, value kept"""+ cs, sn = np.cos(theta)[:, None], np.sin(theta)[:, None]+ m = c.mean(1, keepdims=True)+ cr = np.stack([c[:, 2] - c[:, 1], c[:, 0] - c[:, 2], c[:, 1] - c[:, 0]], 1) / np.sqrt(3)+ return (c * cs + cr * sn + m * (1 - cs)).astype(np.float32)+++def _equalise(a):+ """rank-equalise to a uniform 0..1 distribution"""+ flat = a.ravel()+ o = np.argsort(flat, kind='stable')+ out = np.empty(flat.size, np.float32)+ out[o] = np.linspace(0, 1, flat.size, dtype=np.float32)+ return out.reshape(a.shape)+++def _lookup(field, x, y):+ if np.ndim(field) == 0: return np.full(len(x), float(field), np.float32)+ H, W = field.shape[:2]+ return field[np.clip(y.astype(np.int32), 0, H - 1), np.clip(x.astype(np.int32), 0, W - 1)]+++def _resample(P, step):+ P = np.asarray(P, np.float32)+ d = np.r_[0, np.cumsum(np.linalg.norm(np.diff(P, axis=0), axis=1))]+ if d[-1] < 1e-3: return P[:1]+ s = np.linspace(0, d[-1], max(2, int(d[-1] / step) + 1))+ return np.stack([np.interp(s, d, P[:, 0]), np.interp(s, d, P[:, 1])], 1).astype(np.float32)+++class PencilStorybook:+ PAINTS = PAINTS+ RAMPS = RAMPS+ LIGHT = (-0.62, -0.58, 0.53) # the default light: upper left, a little in front++ def __init__(self, W=1920, H=1080, seed=0, keep_stages=True, stages_dir=None):+ if W * H > 4096 * 4096: raise ValueError('canvas larger than 4096 x 4096')+ self.W, self.H, self.seed = W, H, seed+ self.rng = np.random.default_rng(seed)+ self.keep_stages, self.stages_dir = keep_stages, stages_dir+ self.stages, self._n_stages = [], 0+ self.YY, self.XX = np.mgrid[0:H, 0:W].astype(np.float32)+ self.P = hexc('paper')+ self.C = np.empty((H, W, 3), np.float32); self.C[:] = self.P+ self.F = np.zeros((H, W), np.float32) # wax already sitting in the tooth+ self.T = None; self.TD = None+ self.EN = None # edge wobble noise+ self.fin = None+ self.floor = 0.34 # wax a pencil still leaves in the pits of the tooth+ self.n_strokes = 0++ def _r(self, seed=None):+ return np.random.default_rng(int(self.rng.integers(1 << 30)) if seed is None else seed)++ # ================================================================== paper+ def paper(self, tone='paper', tooth=1.0, mottle=0.028, fibres=160, drag=3, seed=None):+ """warm white drawing paper: equalised tooth, faint low mottling and a few fibres"""+ H, W = self.H, self.W+ r = self._r(seed)+ z = lambda a: (a - a.mean()) / (a.std() + 1e-6)+ g1 = blur(r.random((H, W)).astype(np.float32), 0.55)+ g2 = noise2d(H, W, 2.2, 2, int(r.integers(1 << 30)))+ g3 = noise2d(H, W, 6.5, 2, int(r.integers(1 << 30)))+ g4 = noise2d(H, W, 22.0, 2, int(r.integers(1 << 30)))+ self.T = _equalise(0.8 * z(g1) + 0.38 * z(g2) + 0.12 * z(g3) + 0.05 * z(g4))+ self.P = hexc(tone)+ mot = noise2d(H, W, 180, 4, int(r.integers(1 << 30))) - 0.5+ C = self.P[None, None] * (1 + mottle * mot[..., None] - 0.03 * tooth * (0.5 - self.T[..., None]) * 0.6)+ if fibres:+ im = Image.new('L', (W, H), 0); d = ImageDraw.Draw(im)+ for _ in range(fibres):+ px, py = r.uniform(0, W), r.uniform(0, H)+ a = r.uniform(0, np.pi); L = r.uniform(5, 22)+ pts = [(px + np.cos(a) * L * t + r.normal(0, 1.0), py + np.sin(a) * L * t + r.normal(0, 1.0))+ for t in np.linspace(-0.5, 0.5, 5)]+ d.line(pts, fill=int(r.uniform(30, 90)), width=1)+ fib = blur(np.asarray(im, np.float32) / 255, 0.5)+ C = C * (1 - 0.035 * fib[..., None])+ self.C = C.astype(np.float32)+ self.F[:] = 0+ # tooth dragged along 8 stroke directions+ TD = np.empty((8, H, W), np.float32)+ ks = np.arange(-drag, drag + 1); wk = 1.0 - np.abs(ks) / (drag + 1.0)+ for b in range(8):+ a = np.pi * b / 8+ acc = np.zeros_like(self.T)+ for k, w in zip(ks, wk):+ acc += w * np.roll(self.T, (int(round(k * np.sin(a))), int(round(k * np.cos(a)))), axis=(0, 1))+ TD[b] = _equalise(0.45 * self.T + 0.55 * acc / wk.sum())+ self.TD = TD+ self.EN = noise2d(H, W, 3.5, 2, int(r.integers(1 << 30))) - 0.5+ return self++ def _need(self):+ if self.T is None: self.paper()++ # ================================================================== masks+ def poly(self, pts, smooth=False, ss=2):+ """filled polygon -> canvas-sized float mask (smooth=True runs a closed Catmull-Rom spline through the points)"""+ P = np.asarray(pts, np.float32)+ if smooth:+ Q = np.vstack([P[-1:], P, P[:2]])+ P = spline(Q, 10)[10:-10]+ im = Image.new('L', (self.W * ss, self.H * ss), 0)+ ImageDraw.Draw(im).polygon([(float(x) * ss, float(y) * ss) for x, y in P], fill=255)+ return np.asarray(im.resize((self.W, self.H), Image.BOX), np.float32) / 255++ def ellipse(self, cx, cy, rx, ry=None, rot=0.0):+ """anti-aliased ellipse mask (rot in degrees)"""+ ry = rx if ry is None else ry+ c, s = np.cos(np.deg2rad(rot)), np.sin(np.deg2rad(rot))+ dx, dy = self.XX - cx, self.YY - cy+ u, v = (dx * c + dy * s) / rx, (-dx * s + dy * c) / ry+ d = np.sqrt(u * u + v * v)+ return np.clip((1 - d) * min(rx, ry) + 0.5, 0, 1).astype(np.float32)++ def blob(self, cx, cy, rx, ry=None, rough=0.1, seed=None, rot=0.0):+ ry = rx if ry is None else ry+ return self.poly(blob_pts(cx, cy, rx, ry, rough, 120, int(self._r(seed).integers(1 << 30)), np.deg2rad(rot)))++ @staticmethod+ def tube_pts(path, w0, w1=None, per=8):+ """outline points of a tube of width w0 -> w1 along a path (limbs, trunks, necks)"""+ w1 = w0 if w1 is None else w1+ P = spline(path, per) if len(path) > 2 else _resample(path, 4)+ n = len(P)+ Tg = np.gradient(P, axis=0); Tg /= np.linalg.norm(Tg, axis=1, keepdims=True) + 1e-6+ Nn = np.stack([-Tg[:, 1], Tg[:, 0]], 1)+ w = np.linspace(w0, w1, n)[:, None] * 0.5+ return np.vstack([P + Nn * w, (P - Nn * w)[::-1]])++ def tube(self, path, w0, w1=None):+ return self.poly(self.tube_pts(path, w0, w1))++ def below(self, xs, ys, invert=False):+ """mask of everything below a line through (xs, ys) (spline), or a constant y if xs is None"""+ if xs is None:+ m = np.clip(self.YY - float(ys) + 0.5, 0, 1)+ else:+ x = np.arange(self.W, dtype=np.float32)+ P = spline(np.stack([np.asarray(xs, np.float32), np.asarray(ys, np.float32)], 1), 12)+ o = np.argsort(P[:, 0])+ yl = np.interp(x, P[o, 0], P[o, 1]).astype(np.float32)+ m = np.clip(self.YY - yl[None] + 0.5, 0, 1)+ return (1 - m if invert else m).astype(np.float32)++ def line_y(self, xs, ys):+ """the y of a spline through (xs, ys) at every column"""+ x = np.arange(self.W, dtype=np.float32)+ P = spline(np.stack([np.asarray(xs, np.float32), np.asarray(ys, np.float32)], 1), 12)+ o = np.argsort(P[:, 0])+ return np.interp(x, P[o, 0], P[o, 1]).astype(np.float32)++ def rect(self, x0, y0, x1, y1):+ X, Y = self.XX, self.YY+ return (np.clip(X - x0 + 0.5, 0, 1) * np.clip(x1 - X + 0.5, 0, 1) *+ np.clip(Y - y0 + 0.5, 0, 1) * np.clip(y1 - Y + 0.5, 0, 1)).astype(np.float32)++ def _mask(self, region):+ if isinstance(region, np.ndarray): return region.astype(np.float32, copy=False)+ x0, y0, x1, y1 = (int(round(v)) for v in region)+ M = np.zeros((self.H, self.W), np.float32)+ M[max(0, y0):max(0, y1), max(0, x0):max(0, x1)] = 1+ return M++ @staticmethod+ def _bbox(M, thr=0.004, pad=0, W=None, H=None):+ rows = np.flatnonzero(M.max(1) > thr); cols = np.flatnonzero(M.max(0) > thr)+ if not len(rows) or not len(cols): return None+ H, W = M.shape+ return (max(0, cols[0] - pad), max(0, rows[0] - pad), min(W, cols[-1] + 1 + pad), min(H, rows[-1] + 1 + pad))++ # ================================================================== fields+ def flow(self, angle=0.0, turb=8.0, scale=240.0, seed=None):+ """orientation field: `angle` degrees (screen y down: positive tilts down to the right), +-turb degrees+ of low-frequency wander at `scale` px"""+ n = noise2d(self.H, self.W, scale, 3, int(self._r(seed).integers(1 << 30))) - 0.5+ return np.deg2rad(angle + 2 * turb * n).astype(np.float32)++ def radial(self, cx, cy, offset=0.0, turb=4.0, scale=120.0, seed=None):+ """directions pointing away from (cx, cy), offset in degrees"""+ a = np.arctan2(self.YY - cy, self.XX - cx) + np.deg2rad(offset)+ if turb:+ a = a + np.deg2rad(2 * turb * (noise2d(self.H, self.W, scale, 3, int(self._r(seed).integers(1 << 30))) - 0.5))+ return a.astype(np.float32)++ def contour(self, mask, sigma=8.0, offset=0.0, fallback=None):+ """directions along the iso-lines of a (blurred) shape: strokes that wrap round a dome, a stone, a cheek.+ Where the shape is flat the direction comes from `fallback` (degrees or a field)."""+ d = blur(mask.astype(np.float32), sigma)+ gy, gx = np.gradient(d)+ a = np.arctan2(gy, gx) + np.pi / 2 + np.deg2rad(offset)+ if fallback is not None:+ g = np.hypot(gx, gy)+ w = smoothstep(0.0, 0.25 / max(sigma, 1.0), g)+ fb = np.deg2rad(fallback) if np.ndim(fallback) == 0 else fallback+ a = self.blend(np.broadcast_to(np.float32(fb), a.shape) if np.ndim(fb) == 0 else fb, a, w)+ return a.astype(np.float32)++ @staticmethod+ def blend(f1, f2, w):+ """blend two orientation fields (doubled-angle average, so 0 and pi are the same orientation)"""+ w = np.asarray(w, np.float32)+ c = (1 - w) * np.cos(2 * f1) + w * np.cos(2 * f2)+ s = (1 - w) * np.sin(2 * f1) + w * np.sin(2 * f2)+ return (0.5 * np.arctan2(s, c)).astype(np.float32)++ @staticmethod+ def rotate(field, deg):+ """turn a field (radians array) or a direction in degrees by `deg` degrees; returns the same kind"""+ if np.ndim(field) == 0: return float(field) + deg+ return (field + np.deg2rad(deg)).astype(np.float32)++ def value(self, top=0.0, bottom=1.0, y0=0, y1=None, mottle=0.04, scale=220.0, seed=None):+ """a 0..1 field: a vertical ramp from `top` at y0 to `bottom` at y1, with low-frequency mottling"""+ y1 = self.H if y1 is None else y1+ t = np.clip((self.YY - y0) / max(1, y1 - y0), 0, 1)+ v = top + (bottom - top) * t+ if mottle:+ v = v + 2 * mottle * (noise2d(self.H, self.W, scale, 3, int(self._r(seed).integers(1 << 30))) - 0.5)+ return np.clip(v, 0, 1).astype(np.float32)++ def shading(self, mask, light=(-0.62, -0.58, 0.53), sigma=None, wrap=0.2, flat=0.0):+ """0..1 light on a soft dome raised from the silhouette (sum of blurs), lit from `light` (x, y, z; screen y+ down, default upper left). wrap > 0 lets the light creep round the terminator; flat mixes toward 0.5."""+ bb = self._bbox(mask)+ out = np.zeros((self.H, self.W), np.float32)+ if bb is None: return out+ m = mask.astype(np.float32)+ if sigma is None: sigma = max(4.0, np.sqrt(m.sum()) / 7.0)+ pad = int(sigma * 3) + 4+ x0, y0, x1, y1 = max(0, bb[0] - pad), max(0, bb[1] - pad), min(self.W, bb[2] + pad), min(self.H, bb[3] + pad)+ mm = m[y0:y1, x0:x1]+ h = 0.45 * blur(mm, sigma * 0.33) + 0.35 * blur(mm, sigma * 0.7) + 0.2 * blur(mm, sigma * 1.4)+ gy, gx = np.gradient(h)+ k = sigma * 2.2+ nx, ny, nz = -gx * k, -gy * k, np.ones_like(h)+ nn = np.sqrt(nx * nx + ny * ny + nz * nz)+ L = np.asarray(light, np.float32); L = L / np.linalg.norm(L)+ lam = (nx * L[0] + ny * L[1] + nz * L[2]) / nn+ lam = np.clip((lam + wrap) / (1 + wrap), 0, 1)+ if flat: lam = lam * (1 - flat) + 0.5 * flat+ out[y0:y1, x0:x1] = lam+ return out * (m > 0.001)++ # ================================================================== stroke machinery+ def _sizes(self, spec, x, y, r):+ n = len(x)+ if callable(spec):+ return (np.asarray(spec(x, y), np.float32) * r.uniform(0.8, 1.2, n)).astype(np.float32)+ if np.ndim(spec) == 0: return np.full(n, float(spec), np.float32) * r.uniform(0.85, 1.15, n).astype(np.float32)+ return r.uniform(spec[0], spec[1], n).astype(np.float32)++ def _colours(self, spec, x, y, r):+ """paint | list of paints (picked at random) | (ramp, value field or f(x, y)) | f(x, y) -> (N, 3) | RGB"""+ n = len(x)+ if callable(spec): return np.asarray(spec(x, y), np.float32).reshape(n, 3).copy()+ if isinstance(spec, str): return np.broadcast_to(hexc(spec), (n, 3)).astype(np.float32).copy()+ if isinstance(spec, (tuple, list)) and len(spec) == 2 and (callable(spec[1]) or isinstance(spec[1], np.ndarray)):+ R = ramp(spec[0]); f = spec[1]+ v = f(x, y) if callable(f) else _lookup(f, x, y)+ return ramp_at(R, v).astype(np.float32)+ if isinstance(spec, (tuple, list)) and all(isinstance(c, str) for c in spec):+ R = ramp(list(spec))+ return R[r.integers(0, len(R), n)].astype(np.float32)+ return np.broadcast_to(hexc(spec), (n, 3)).astype(np.float32).copy()++ @staticmethod+ def _field_rad(field):+ return np.float32(np.deg2rad(field)) if np.ndim(field) == 0 else field++ def _centrelines(self, x, y, L, field, jit, bend, k):+ """integrate k points through an orientation field from the centre outward (no flips)"""+ n = len(x)+ P = np.zeros((n, k, 2), np.float32)+ c = k // 2+ P[:, c, 0] = x; P[:, c, 1] = y+ st = L / (k - 1)+ a0 = _lookup(field, x, y) + jit+ d0 = np.stack([np.cos(a0), np.sin(a0)], 1).astype(np.float32)+ for sgn in (1, -1):+ px, py = x.copy(), y.copy()+ prev = d0 * sgn+ for j in range(1, (k - c) if sgn > 0 else (c + 1)):+ a = _lookup(field, px, py) + jit + sgn * bend * j+ v = np.stack([np.cos(a), np.sin(a)], 1).astype(np.float32)+ flip = (v * prev).sum(1) < 0+ v[flip] *= -1+ px = px + v[:, 0] * st; py = py + v[:, 1] * st+ P[:, c + sgn * j, 0] = px; P[:, c + sgn * j, 1] = py+ prev = v+ return P++ def _seed_points(self, M, bb, n_cells, r):+ """stratified (jittered-grid) candidate points over a box, accepted with probability M"""+ x0, y0, x1, y1 = bb+ bw, bh = x1 - x0, y1 - y0+ cell = max(1.0, np.sqrt(bw * bh / max(1, n_cells)))+ nx, ny = max(1, int(np.ceil(bw / cell))), max(1, int(np.ceil(bh / cell)))+ gx, gy = np.meshgrid(np.arange(nx, dtype=np.float32), np.arange(ny, dtype=np.float32))+ x = x0 + (gx.ravel() + r.random(nx * ny).astype(np.float32)) * cell+ y = y0 + (gy.ravel() + r.random(nx * ny).astype(np.float32)) * cell+ ok = (x < x1) & (y < y1)+ x, y = x[ok], y[ok]+ keep = r.random(len(x)) < _lookup(M, x, y)+ return x[keep], y[keep]++ def hatch(self, region, field=-35.0, colour='cobalt', length=(18, 46), width=(1.7, 2.6), density=1.5,+ pressure=0.74, opacity=0.3, alpha=0.62, jitter=0.07, bend=0.035, value=0.045, hue=0.025,+ taper=(0.45, 0.15), passes=2, clip='auto', avoid=None, fade='auto', k=5, seed=None):+ """lay pencil strokes over `region` (a 0..1 landing-probability mask or a box) following `field` (a+ direction in degrees or a radians field). density ~ how many times the strokes would tile the region;+ length / width: (lo, hi), a number or f(x, y); colour: a paint, a list of paints (picked at random), (ramp,+ value field or f(x, y)) or f(x, y) -> (N, 3); pressure: how deep the wax reaches into the tooth (1 = solid);+ opacity: how much a light pencil covers what is under it; value / hue: per-stroke jitter; taper: pressure+ at the (start, end) of the stroke; passes: sub-passes that build up on each other; clip: a mask the strokes+ are cut to ('auto' = the region's support with a soft, wandering edge; None = no clip); fade: a 0..1 field+ that eases the pressure off pixel by pixel ('auto' = region ** 0.65, so a shadow field gives a smooth+ gradation rather than scattered dark dashes); avoid: a mask of things to colour round (the strokes neither+ land nor run there). Returns the number of strokes."""+ self._need()+ r = self._r(seed)+ M = self._mask(region)+ if avoid is not None:+ keep = 1 - np.clip(avoid, 0, 1)+ M = M * keep+ bb = self._bbox(M)+ if bb is None: return 0+ x0, y0, x1, y1 = bb+ area = float(M[y0:y1, x0:x1].sum())+ if area < 1: return 0+ # mean stroke footprint from a sample+ sx = r.uniform(x0, x1, 600).astype(np.float32); sy = r.uniform(y0, y1, 600).astype(np.float32)+ Lm = float(self._sizes(length, sx, sy, r).mean()); Wm = float(self._sizes(width, sx, sy, r).mean())+ n_cells = int(density * (x1 - x0) * (y1 - y0) / (0.75 * Lm * Wm)) + 1+ arr = isinstance(region, np.ndarray)+ x, y = self._seed_points(np.sqrt(M) if arr else M, bb, n_cells, r)+ n = len(x)+ if not n: return 0+ o = r.permutation(n); x, y = x[o], y[o]+ L = self._sizes(length, x, y, r); Wd = self._sizes(width, x, y, r)+ cols = self._colours(colour, x, y, r)+ if value: cols *= (1 + value * r.normal(0, 1, n).astype(np.float32))[:, None]+ if hue: cols = hue_rotate(cols, (hue * r.normal(0, 1, n)).astype(np.float32))+ cols = np.clip(cols, 0, 1)+ fld = self._field_rad(field)+ P = self._centrelines(x, y, L, fld, (jitter * r.normal(0, 1, n)).astype(np.float32),+ (bend * r.normal(0.6, 0.6, n)).astype(np.float32), k)+ if isinstance(clip, str) and clip == 'auto':+ clip = smoothstep(0.0, 0.06, M) if arr else None+ if avoid is not None:+ clip = keep if clip is None else clip * keep+ if isinstance(fade, str) and fade == 'auto':+ fade = (M ** 0.65) if arr else None+ pr = np.broadcast_to(np.asarray(pressure, np.float32), (n,)) * r.uniform(0.92, 1.06, n).astype(np.float32)+ al = np.broadcast_to(np.asarray(alpha, np.float32), (n,)) * r.uniform(0.85, 1.0, n).astype(np.float32)+ self._draw(P, Wd, cols, al, pr, taper, opacity, clip, passes, r, fade=fade)+ self.n_strokes += n+ return n++ def strokes(self, paths, colour='umber', width=2.0, pressure=0.7, opacity=0.3, alpha=0.9, taper=(0.4, 0.15),+ value=0.05, hue=0.02, clip=None, passes=1, k=None, seed=None):+ """draw explicit strokes: a list of polylines (each (m, 2)); they are resampled to k points each"""+ self._need()+ r = self._r(seed)+ if not len(paths): return 0+ if k is None: k = max(3, min(9, int(np.median([len(p) for p in paths]))))+ P = np.stack([_resample_k(np.asarray(p, np.float32), k) for p in paths]).astype(np.float32)+ n = len(P)+ mid = P[:, k // 2]+ Wd = self._sizes(width, mid[:, 0], mid[:, 1], r)+ cols = self._colours(colour, mid[:, 0], mid[:, 1], r)+ if value: cols *= (1 + value * r.normal(0, 1, n).astype(np.float32))[:, None]+ if hue: cols = hue_rotate(cols, (hue * r.normal(0, 1, n)).astype(np.float32))+ cols = np.clip(cols, 0, 1)+ pr = np.broadcast_to(np.asarray(pressure, np.float32), (n,)) * r.uniform(0.94, 1.04, n).astype(np.float32)+ al = np.broadcast_to(np.asarray(alpha, np.float32), (n,)) * r.uniform(0.88, 1.0, n).astype(np.float32)+ self._draw(P, Wd, cols, al, pr, taper, opacity, clip, passes, r)+ self.n_strokes += n+ return n++ def _draw(self, P, Wd, cols, al, pr, taper, opacity, clip, passes, r, ss=2, fill=0.4, fade=None):+ n = len(P)+ tp = np.broadcast_to(np.asarray(taper, np.float32), (n, 2))+ passes = max(1, int(passes))+ for g in range(passes):+ sel = np.arange(g, n, passes)+ if len(sel):+ self._raster(P[sel], Wd[sel], cols[sel], al[sel], pr[sel], tp[sel], opacity, clip, ss, fill, fade)++ def _raster(self, P, Wd, cols, al, pr, tp, opacity, clip, ss, fill, fade=None):+ n = len(P)+ lo = P.reshape(-1, 2).min(0) - Wd.max() - 2; hi = P.reshape(-1, 2).max(0) + Wd.max() + 2+ x0, y0 = max(0, int(np.floor(lo[0]))), max(0, int(np.floor(lo[1])))+ x1, y1 = min(self.W, int(np.ceil(hi[0]))), min(self.H, int(np.ceil(hi[1])))+ if x1 <= x0 or y1 <= y0: return+ w, h = x1 - x0, y1 - y0+ im = Image.new('I', (w * ss, h * ss), 0)+ d = ImageDraw.Draw(im)+ Q = ((P - np.array([x0, y0], np.float32)) * ss).reshape(n, -1).tolist()+ wi = np.maximum(1, np.round(Wd * ss)).astype(np.int32).tolist()+ for i in range(n):+ d.line(Q[i], fill=i + 1, width=wi[i])+ flat = np.asarray(im, dtype=np.int32).ravel()+ nz = np.flatnonzero(flat)+ if not len(nz): return+ sid = flat[nz]+ W2 = w * ss+ sy = nz // W2; sx = nz - sy * W2+ # per-stroke tables (index 0 unused)+ s = P[:, 0]; e = P[:, -1]+ dv = e - s+ Ls = np.linalg.norm(dv, axis=1) + 1e-3+ dv = dv / Ls[:, None]+ ang = np.mod(np.arctan2(dv[:, 1], dv[:, 0]), np.pi)+ BIN = np.r_[0, (np.round(ang / np.pi * 8).astype(np.int32) % 8)]+ SX = np.r_[0, s[:, 0]].astype(np.float32); SY = np.r_[0, s[:, 1]].astype(np.float32)+ DX = np.r_[0, dv[:, 0]].astype(np.float32); DY = np.r_[0, dv[:, 1]].astype(np.float32)+ IL = np.r_[0, 1 / Ls].astype(np.float32)+ PR = np.r_[0, pr].astype(np.float32); AL = np.r_[0, al].astype(np.float32)+ T0 = np.r_[0, tp[:, 0]].astype(np.float32); T1 = np.r_[0, tp[:, 1]].astype(np.float32)+ X = x0 + (sx + 0.5) / ss; Y = y0 + (sy + 0.5) / ss+ u = np.clip(((X - SX[sid]) * DX[sid] + (Y - SY[sid]) * DY[sid]) * IL[sid], 0, 1)+ t0 = T0[sid]; t1 = T1[sid]+ prof = np.minimum(np.clip(t0 + (1 - t0) * u / 0.16, 0, 1), np.clip(t1 + (1 - t1) * (1 - u) / 0.5, 0, 1))+ iy = y0 + sy // ss; ix = x0 + sx // ss+ Tt = self.TD[BIN[sid], iy, ix]+ p = PR[sid] * (0.6 + 0.4 * prof)+ catch = np.clip((Tt + fill * self.F[iy, ix] - (1 - p)) * 4.5 + 0.5, 0, 1)+ catch = self.floor + (1 - self.floor) * catch+ A = AL[sid] * catch * (0.45 + 0.55 * prof)+ pix = (sy // ss) * w + (sx // ss)+ npx = w * h+ k2 = 1.0 / (ss * ss)+ a1 = np.bincount(pix, A, npx).astype(np.float32) * k2+ c3 = np.empty((npx, 3), np.float32)+ CL = np.vstack([np.zeros((1, 3), np.float32), cols])+ for ch in range(3):+ c3[:, ch] = np.bincount(pix, A * CL[sid, ch], npx) * k2+ a1 = a1.reshape(h, w); c3 = c3.reshape(h, w, 3)+ if clip is not None:+ cf = clip[y0:y1, x0:x1]+ # a soft, slightly wandering edge+ cf = np.clip((cf - 0.5) * 1.6 + 0.5 + 0.35 * self.EN[y0:y1, x0:x1] * (cf > 0.02) * (cf < 0.98), 0, 1)+ a1 = a1 * cf; c3 = c3 * cf[..., None]+ if fade is not None:+ ff = fade[y0:y1, x0:x1]+ a1 = a1 * ff; c3 = c3 * ff[..., None]+ m = a1 > 1e-4+ if not m.any(): return+ col = c3[m] / a1[m][:, None]+ Cb = self.C[y0:y1, x0:x1]+ old = Cb[m]+ tgt = (1 - opacity) * np.clip(old * col / self.P, 0, 1) + opacity * col+ Cb[m] = old + a1[m][:, None] * (tgt - old)+ Fb = self.F[y0:y1, x0:x1]+ Fb[m] = np.minimum(1.4, Fb[m] + a1[m] * 0.5)++ # ================================================================== lines and edges+ def line(self, path, colour='umber', width=2.0, pressure=0.62, alpha=0.8, opacity=0.3, seg=(36, 90),+ wobble=0.7, taper=(0.3, 0.15), smooth=True, clip=None, gaps=0.0, seed=None):+ """a soft pencil line along a path, drawn as several overlapping sketchy strokes (gaps: the chance that a+ stroke is left out, for a broken line)"""+ r = self._r(seed)+ P = spline(path, 10) if (smooth and len(path) > 2) else np.asarray(path, np.float32)+ P = _resample(P, 2.0)+ if len(P) < 2: return 0+ total = len(P) * 2.0+ paths = []+ i = 0+ while i < len(P) - 1:+ L = r.uniform(*seg) / 2.0+ j = min(len(P), int(i + L))+ q = P[i:j].copy()+ if len(q) >= 2:+ nn = np.array([-(q[-1, 1] - q[0, 1]), q[-1, 0] - q[0, 0]], np.float32)+ nn /= np.linalg.norm(nn) + 1e-6+ q += nn * (r.normal(0, wobble) + fbm1d(len(q), max(3, len(q) / 2), 2, int(r.integers(1 << 30)))[:, None] * wobble * 0.6)+ if not (gaps and r.random() < gaps): paths.append(q)+ i = max(i + 1, int(j - r.uniform(0.15, 0.35) * L))+ if total < 3 or not paths: return 0+ return self.strokes(paths, colour, width, pressure, opacity, alpha, taper, clip=clip, k=7, seed=int(r.integers(1 << 30)))++ def edge(self, mask, colour='umber', width=(1.3, 2.0), density=0.7, pressure=0.55, alpha=0.75, band=2.2,+ length=(14, 34), opacity=0.3, where=None, seed=None):+ """a faint, broken pencil contour in the local colour: short strokes along the outline of a mask+ (`where` restricts it, e.g. to the shadow side)"""+ m = blur(mask.astype(np.float32), band)+ b = smoothstep(0.12, 0.45, m) * smoothstep(0.88, 0.5, m)+ if where is not None: b = b * where+ b = b * (0.55 + 0.45 * smoothstep(0.3, 0.7, noise2d(self.H, self.W, 40, 2, int(self._r(seed).integers(1 << 30)))))+ return self.hatch(b, self.contour(mask, 2.5), colour, length, width, density, pressure, opacity, alpha,+ jitter=0.04, bend=0.02, clip=None, passes=1, seed=seed)++ # ================================================================== modelling+ def form(self, mask, colours, field=-35.0, light=(-0.62, -0.58, 0.53), cross=26.0, length=(16, 38),+ width=(1.6, 2.5), density=1.2, pressure=0.74, warm=None, cool=None, edge=None, lit=None,+ opacity=0.3, sigma=None, wrap=0.2, deep_from=0.62, avoid=None, passes=2, seed=None):+ """model a shape in layered pencil. colours = (light, local, shadow[, deepest]) of one family; field is the+ form's own stroke direction (degrees or a field); layers cross at +-cross degrees. warm: a glaze on the lit+ side (a paint), cool: a glaze in the shadow. lit: a precomputed 0..1 light field (else shading(mask, light)).+ Returns the light field."""+ r = self._r(seed)+ if lit is None: lit = self.shading(mask, light, sigma, wrap)+ sh = 1 - lit+ f0 = self._field_rad(field)+ f1 = self.rotate(f0, cross); f2 = self.rotate(f0, -cross * 0.7)+ sd = lambda: int(r.integers(1 << 30))+ cl = smoothstep(0.02, 0.5, mask)+ kw = dict(clip=cl, avoid=avoid, passes=passes)+ self.hatch(mask, f0, colours[0], length, width, density * 0.9, pressure * 0.9, opacity, seed=sd(), **kw)+ self.hatch(mask * (0.3 + 0.7 * smoothstep(0.05, 0.6, sh)), f1, colours[1], length, width, density,+ pressure, opacity, seed=sd(), **kw)+ self.hatch(mask * smoothstep(0.3, 0.85, sh), f2, colours[2], length, width, density * 0.95,+ min(0.95, pressure * 1.05), opacity, seed=sd(), **kw)+ if len(colours) > 3:+ sl = (length[0] * 0.8, length[1] * 0.8) if not np.isscalar(length) and not callable(length) else length+ self.hatch(mask * smoothstep(deep_from, 1.05, sh) ** 1.1, f0, colours[3], sl, width, density * 0.8,+ min(0.95, pressure * 1.08), opacity, seed=sd(), **kw)+ if warm is not None:+ self.hatch(mask * smoothstep(0.4, 1.0, lit), f1, warm, length, width, density * 0.75, pressure * 0.92,+ max(opacity, 0.5), alpha=0.8, seed=sd(), **kw)+ if cool is not None:+ self.hatch(mask * smoothstep(0.45, 1.0, sh) * 0.75, f2, cool, length, width, density * 0.55,+ pressure * 0.88, opacity, alpha=0.75, seed=sd(), **kw)+ if edge is not None:+ self.edge(mask, edge, where=0.35 + 0.65 * smoothstep(0.3, 0.8, sh), seed=sd())+ return lit++ # ================================================================== hair, grass, leaves+ def fur(self, region, field, colour, length=(14, 30), width=(1.0, 1.6), density=0.9, tuft=(5, 12), spread=0.3,+ curl=0.12, converge=1.0, pressure=0.74, opacity=0.32, alpha=0.6, taper=(0.75, 0.04), clip='auto',+ value=0.05, hue=0.025, k=7, avoid=None, fade='auto', side=0.14, light=(-0.62, -0.58), seed=None):+ """tufts of fine strokes following the lie of the hair. Each tuft: `tuft` strands whose roots spread+ across the clump (spread x length) and whose tips converge (converge 1) or fan out (converge -1),+ curling `curl` the same way, pressed at the root and lifting off at the tip. side: the strands on the+ side of a tuft away from `light` are darker by this much (each lock has a lit and a shadowed flank).+ density ~ how many times the tufts tile the region."""+ self._need()+ r = self._r(seed)+ M = self._mask(region)+ if avoid is not None: M = M * (1 - np.clip(avoid, 0, 1))+ bb = self._bbox(M)+ if bb is None: return 0+ x0, y0, x1, y1 = bb+ sx = r.uniform(x0, x1, 400).astype(np.float32); sy = r.uniform(y0, y1, 400).astype(np.float32)+ Lm = float(self._sizes(length, sx, sy, r).mean())+ tw = spread * Lm+ n_cells = int(density * (x1 - x0) * (y1 - y0) / (0.8 * Lm * max(tw, 2.0))) + 1+ arr = isinstance(region, np.ndarray)+ cx, cy = self._seed_points(np.sqrt(M) if arr else M, bb, n_cells, r)+ nt = len(cx)+ if not nt: return 0+ fld = self._field_rad(field)+ a = _lookup(fld, cx, cy) + r.normal(0, 0.09, nt).astype(np.float32)+ # flip so that a field given mod pi still points the same way locally: keep as is (hair direction given)+ L = self._sizes(length, cx, cy, r)+ cnt = r.integers(tuft[0], tuft[1] + 1, nt)+ cv = (curl * r.normal(1.0, 0.5, nt) * np.sign(r.normal(0, 1, nt) + 0.6)).astype(np.float32)+ paths = []; tcol = []; lat = []+ L2 = np.asarray(light[:2], np.float32); L2 = L2 / (np.linalg.norm(L2) + 1e-6)+ for i in range(nt):+ d = np.array([np.cos(a[i]), np.sin(a[i])], np.float32)+ nrm = np.array([-d[1], d[0]], np.float32)+ m = int(cnt[i])+ off = (np.linspace(-0.5, 0.5, m) + r.normal(0, 0.12, m)) * spread * L[i]+ base = np.array([cx[i], cy[i]], np.float32)+ tip = base + d * L[i]+ sgn = 1.0 if float(nrm @ L2) > 0 else -1.0+ for j in range(m):+ lj = L[i] * r.uniform(0.7, 1.08)+ root = base + nrm * off[j] - d * r.uniform(0, 0.25) * L[i]+ end = tip + nrm * off[j] * (1 - converge * 0.85) + d * (lj - L[i]) + r.normal(0, 0.06 * L[i], 2)+ ctrl = (root + end) / 2 + nrm * cv[i] * lj + r.normal(0, 0.03 * L[i], 2)+ t = np.linspace(0, 1, k)[:, None]+ paths.append(((1 - t) ** 2 * root + 2 * t * (1 - t) * ctrl + t * t * end).astype(np.float32))+ tcol.append(i); lat.append(sgn * off[j] / max(1e-3, spread * L[i]))+ P = np.stack(paths).astype(np.float32)+ n = len(P)+ tcol = np.asarray(tcol)+ mid = P[:, k // 2]+ Wd = self._sizes(width, mid[:, 0], mid[:, 1], r)+ tc = self._colours(colour, cx, cy, r)+ cols = tc[tcol] * (1 + 0.5 * value * r.normal(0, 1, n).astype(np.float32))[:, None]+ cols *= (1 + value * r.normal(0, 1, nt).astype(np.float32))[tcol][:, None]+ if side: cols *= (1 + side * 2 * np.clip(np.asarray(lat, np.float32), -0.6, 0.6))[:, None]+ if hue: cols = hue_rotate(cols, (hue * r.normal(0, 1, n)).astype(np.float32))+ cols = np.clip(cols, 0, 1)+ if isinstance(clip, str) and clip == 'auto':+ clip = None+ if avoid is not None:+ keep = 1 - np.clip(avoid, 0, 1)+ clip = keep if clip is None else clip * keep+ if isinstance(fade, str) and fade == 'auto':+ fade = blur(M, 3.0) ** 0.6 if arr else None+ pr = np.broadcast_to(np.asarray(pressure, np.float32), (n,)) * r.uniform(0.9, 1.06, n).astype(np.float32)+ al = np.broadcast_to(np.asarray(alpha, np.float32), (n,)) * r.uniform(0.85, 1.0, n).astype(np.float32)+ o = r.permutation(n)+ self._draw(P[o], Wd[o], cols[o], al[o], pr[o], taper, opacity, clip, 2, r, fade=fade)+ self.n_strokes += n+ return n++ def grass(self, region, colour=('grass', 'leaf', 'yellowgreen'), height=(26, 60), lean=-90.0, sway=14.0,+ width=(1.3, 2.1), density=0.5, tuft=(3, 7), fan=0.5, curl=0.1, pressure=0.74, opacity=0.32,+ clip=None, avoid=None, seed=None):+ """tufts of grass: blades rising from the region (lean = direction in degrees, -90 = up), fanning out"""+ f = self.flow(lean, sway, 160)+ return self.fur(region, f, colour, height, width, density, tuft, spread=0.18, curl=curl, converge=-fan,+ pressure=pressure, opacity=opacity, taper=(0.85, 0.02), clip=clip, avoid=avoid, seed=seed)++ def leaves(self, region, colour, size=(8, 16), density=0.9, field=None, curl=0.35, pressure=0.74,+ opacity=0.32, width=(1.4, 2.2), clip=None, avoid=None, seed=None):+ """a crown laid as clumps of short curved leaf strokes (3-6 per clump, fanned)"""+ f = self.flow(-60, 70, 50) if field is None else field+ return self.fur(region, f, colour, size, width, density, (3, 6), spread=0.6, curl=curl, converge=0.2,+ pressure=pressure, opacity=opacity, taper=(0.55, 0.2), clip=clip, avoid=avoid, seed=seed)++ def pelt(self, mask, colours, field, light=(-0.62, -0.58, 0.53), length=(12, 26), width=(1.0, 1.6),+ density=1.0, tuft=(5, 11), spread=0.3, curl=0.12, lit=None, under=True, avoid=None, seed=None):+ """a whole fur coat: a soft pencil under-layer, dark short locks in the shadow, locks of the local colour+ all over, light-tipped locks on the lit side. colours = (light, local, shadow[, deepest]). Returns light."""+ r = self._r(seed)+ sd = lambda: int(r.integers(1 << 30))+ if lit is None: lit = self.shading(mask, light)+ if under:+ self.form(mask, colours, field, light, length=(length[0] * 1.3, length[1] * 1.6), density=0.8 * density,+ lit=lit, avoid=avoid, seed=sd())+ dark = colours[3] if len(colours) > 3 else colours[2]+ kw = dict(width=width, tuft=tuft, spread=spread, curl=curl, avoid=avoid, light=light[:2])+ self.fur(mask * smoothstep(0.3, 0.9, 1 - lit), field, dark, (length[0] * 0.8, length[1] * 0.85),+ density=0.8 * density, pressure=0.8, seed=sd(), **kw)+ self.fur(mask * (0.4 + 0.6 * smoothstep(0.1, 0.7, 1 - lit)), field, colours[2], length, density=0.8 * density,+ seed=sd(), **kw)+ self.fur(mask, field, colours[1], length, density=density, seed=sd(), **kw)+ self.fur(mask * smoothstep(0.35, 0.95, lit), field, colours[0], (length[0] * 0.8, length[1] * 0.85),+ density=0.75 * density, opacity=0.5, seed=sd(), **kw)+ return lit++ def scales(self, mask, size=16.0, colours=('sand', 'tan'), groove='umber', field=0.0, light=(-0.62, -0.58),+ lit=None, density=1.0, pressure=0.72, seed=None):+ """overlapping reptile scales: a staggered grid of small domes along `field` (degrees or a field), each+ filled with a few short strokes, lighter on its lit side, with a darker crease along its shadowed rim"""+ r = self._r(seed)+ bb = self._bbox(mask)+ if bb is None: return 0+ x0, y0, x1, y1 = bb+ cs = []+ row = 0+ yy = y0 + r.uniform(0, size * 0.5)+ while yy < y1 + size:+ xx = x0 + (size * 0.5 if row % 2 else 0) + r.uniform(-0.15, 0.15) * size+ while xx < x1 + size:+ cs.append((xx + r.normal(0, 0.1 * size), yy + r.normal(0, 0.1 * size)))+ xx += size * r.uniform(0.92, 1.08)+ yy += size * 0.78; row += 1+ cs = np.asarray(cs, np.float32)+ inside = _lookup(mask, cs[:, 0], cs[:, 1]) > 0.6+ cs = cs[inside]+ if not len(cs): return 0+ fld = self._field_rad(field)+ ang = _lookup(fld, cs[:, 0], cs[:, 1])+ L2 = np.asarray(light[:2], np.float32); L2 = L2 / (np.linalg.norm(L2) + 1e-6)+ fills, rims, fc, li = [], [], [], []+ lv = _lookup(lit, cs[:, 0], cs[:, 1]) if lit is not None else np.full(len(cs), 0.6, np.float32)+ for (cx, cy), a, l in zip(cs, ang, lv):+ s_ = size * r.uniform(0.42, 0.55)+ d = np.array([np.cos(a), np.sin(a)], np.float32); nrm = np.array([-d[1], d[0]], np.float32)+ nst = max(2, int(4 * density))+ for j in range(nst):+ o = (j / (nst - 1) - 0.5) * 1.4 * s_+ ln = s_ * np.sqrt(max(0.05, 1 - (o / s_) ** 2)) * 0.9+ c = np.array([cx, cy], np.float32) + nrm * o+ fills.append(np.stack([c - d * ln, c, c + d * ln]))+ fc.append(1.0 + 0.12 * np.sign(float(nrm @ L2)) * (o / s_))+ li.append(l)+ # the crease on the side away from the light+ t = np.linspace(-1.1, 1.1, 7) + np.arctan2(-L2[1], -L2[0])+ rims.append(np.stack([cx + s_ * 1.02 * np.cos(t), cy + s_ * 0.86 * np.sin(t)], 1))+ R = ramp(list(colours))+ li = np.asarray(li, np.float32)+ base = ramp_at(R, li) * np.asarray(fc, np.float32)[:, None]+ self.strokes(fills, lambda x, y, c=np.clip(base, 0, 1): c, (1.2, 1.7), pressure, 0.32, 0.7, (0.6, 0.4),+ clip=mask, k=3, seed=int(r.integers(1 << 30)))+ self.strokes(rims, groove, (1.2, 1.6), pressure, 0.3, 0.55, (0.2, 0.2), clip=mask, k=7,+ seed=int(r.integers(1 << 30)))+ return len(cs)++ FLOWERS = {'daisy': ('white', 'butter'), 'buttercup': ('lemon', 'ochre'), 'poppy': ('vermilion', 'umber'),+ 'forgetmenot': ('cornflower', 'butter'), 'pink': ('pink', 'gold'), 'clover': ('rose', 'mauve'),+ 'cornflower': ('cobalt', 'indigo'), 'marigold': ('orange', 'amber')}++ def flowers(self, region, kinds=('daisy', 'buttercup', 'poppy', 'forgetmenot'), n=40, size=(4.0, 8.0),+ petals=(5, 6), stems=None, seed=None):+ """little wildflowers: petals as short rounded strokes round a centre dot; `stems` (a paint) draws a thin+ stem below each. kinds are FLOWERS names."""+ r = self._r(seed)+ M = self._mask(region)+ bb = self._bbox(M)+ if bb is None: return 0+ x, y = self._seed_points(M, bb, n * 4, r)+ if len(x) > n:+ pick = r.choice(len(x), n, replace=False); x, y = x[pick], y[pick]+ if not len(x): return 0+ if stems:+ sp = [np.array([[xi, yi + 1], [xi + r.normal(0, 1.5), yi + r.uniform(2.5, 4.5) * sz]], np.float32)+ for xi, yi, sz in zip(x, y, r.uniform(*size, len(x)))]+ self.strokes(sp, stems, (1.0, 1.4), 0.7, 0.3, 0.7, (0.5, 0.3), k=3, seed=int(r.integers(1 << 30)))+ P, C, D, DC = [], [], [], []+ for xi, yi in zip(x, y):+ kind = kinds[int(r.integers(len(kinds)))]+ pc, cc = self.FLOWERS.get(kind, (kind, 'butter'))+ s_ = r.uniform(*size)+ np_ = int(r.integers(petals[0], petals[1] + 1))+ a0 = r.uniform(0, 2 * np.pi); sq = r.uniform(0.6, 0.95) # seen a little from the side+ for j in range(np_):+ a = a0 + 2 * np.pi * j / np_ + r.normal(0, 0.12)+ for k_ in (-0.18, 0.18):+ b = a + k_+ p0 = (xi + np.cos(b) * s_ * 0.2, yi + np.sin(b) * s_ * 0.2 * sq)+ p1 = (xi + np.cos(b) * s_, yi + np.sin(b) * s_ * sq)+ P.append(np.array([p0, ((p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2), p1], np.float32))+ C.append(hexc(pc))+ D.append((xi, yi, s_)); DC.append(hexc(cc))+ cols = np.asarray(C, np.float32)+ self.strokes(P, lambda xx, yy, c=cols: c, (1.4, 2.0), 0.8, 0.6, 0.85, (0.9, 0.55), k=3,+ seed=int(r.integers(1 << 30)))+ cp = []+ for (xi, yi, s_) in D:+ q = s_ * 0.22+ cp += [np.array([[xi - q, yi], [xi + q, yi]], np.float32), np.array([[xi, yi - q], [xi, yi + q]], np.float32)]+ cc = np.repeat(np.asarray(DC, np.float32), 2, 0)+ self.strokes(cp, lambda xx, yy, c=cc: c, (1.5, 2.0), 0.85, 0.6, 0.9, (0.9, 0.8), k=2,+ seed=int(r.integers(1 << 30)))+ return len(x)++ def stone(self, cx, cy, rx, ry, colours=('pebble', 'stone', 'warmgrey', 'umber'), moss=None, flat=0.35,+ light=(-0.62, -0.58, 0.53), warm='sand', cool='periwinkle', avoid=None, seed=None):+ """a rounded stone with a flattish top: contour-hatched, lit from `light`, an optional mossy cap+ (moss = list of paints). Returns its mask."""+ r = self._r(seed)+ sd = lambda: int(r.integers(1 << 30))+ pts = blob_pts(cx, cy, rx, ry, 0.07, 60, sd())+ pts[:, 1] = np.where(pts[:, 1] < cy, cy - (cy - pts[:, 1]) * (1 - flat * 0.5), pts[:, 1])+ m = self.poly(pts, smooth=True)+ if avoid is not None: m = m * (1 - avoid)+ self.form(m, colours, self.contour(m, max(2.0, ry * 0.15), fallback=-20), light, length=(rx * 0.12, rx * 0.35),+ width=(1.4, 2.1), warm=warm, cool=cool, sigma=max(3.0, ry * 0.5), seed=sd())+ self.edge(m, colours[-1], density=0.5, where=smoothstep(cy - ry * 0.2, cy + ry, self.YY), seed=sd())+ if moss:+ top = m * smoothstep(cy - ry * 0.1, cy - ry * 0.7, self.YY)+ self.fur(top, -90, list(moss), (3, 7), (1.0, 1.4), 1.1, (3, 6), 0.4, 0.15, seed=sd())+ return m++ def cottage(self, x, y, w, h, wall=('cream', 'ivory', 'sand', 'tan'), roof=('peach', 'terracotta', 'brick', 'sienna'),+ windows=((0.25, 0.35, 0.22, 0.3),), door=(0.62, 0.24, 0.5), chimney=0.72, roof_h=0.75,+ light=(-0.7, -0.5, 0.5), glow=1.0, avoid=None, seed=None):+ """a small storybook cottage standing on y (bottom), x = left, w wide, walls h high, a pitched roof+ roof_h x w tall; windows are (fx, fy, fw, fh) fractions of the wall, lit; door (fx, fw, fh) or None.+ Returns its mask."""+ r = self._r(seed)+ sd = lambda: int(r.integers(1 << 30))+ top = y - h+ wallm = self.rect(x, top, x + w, y)+ rf = [(x - w * 0.09, top + 2), (x + w * 0.5, top - roof_h * w), (x + w * 1.09, top + 2)]+ roofm = self.poly(rf)+ chm = None+ if chimney:+ cxp = x + w * chimney+ yr = top - roof_h * w * (1 - abs(chimney - 0.5) * 2) + 4+ chm = self.rect(cxp - w * 0.06, yr - roof_h * w * 0.38, cxp + w * 0.06, yr + 6) * (1 - roofm * 0)+ whole = np.clip(wallm + roofm + (chm if chm is not None else 0), 0, 1)+ if avoid is not None:+ wallm = wallm * (1 - avoid); roofm = roofm * (1 - avoid); whole = whole * (1 - avoid)+ sl = (max(4, w * 0.08), max(8, w * 0.22))+ self.form(wallm, wall, 92, light, length=sl, width=(1.3, 1.9), density=1.4, sigma=w * 0.4, seed=sd())+ # shadow under the eaves+ self.hatch(wallm * smoothstep(top + h * 0.3, top, self.YY), 0, wall[-1], sl, (1.3, 1.8), 0.9, 0.7,+ alpha=0.5, seed=sd())+ a = np.rad2deg(np.arctan2(roof_h * w, w * 0.59))+ rfld = np.where(self.XX < x + w * 0.5, np.deg2rad(-a), np.deg2rad(a)).astype(np.float32)+ self.form(roofm, roof, rfld, light, length=sl, width=(1.3, 1.9), density=1.4, sigma=w * 0.3, seed=sd())+ self.line([rf[0], rf[1], rf[2]], roof[-1], 1.5, 0.66, 0.6, 0.35, seg=(w * 0.3, w * 0.6), smooth=False, seed=sd())+ if chm is not None:+ cm = chm * (1 - roofm * 0.0)+ self.form(cm, roof[1:] if len(roof) > 3 else roof, 90, light, length=(4, 10), width=(1.2, 1.7),+ density=1.4, seed=sd())+ for (fx, fy, fw, fh) in windows:+ self.window(x + w * fx, top + h * fy, x + w * (fx + fw), top + h * (fy + fh), glow=glow, seed=sd())+ if door:+ fx, fw, fh = door+ dm = self.rect(x + w * fx, y - h * fh, x + w * (fx + fw), y)+ self.form(dm, ('tan', 'brown', 'umber'), 90, light, length=(4, 10), width=(1.2, 1.7), density=1.4, seed=sd())+ self.edge(wallm, wall[-1], density=0.4, seed=sd())+ return whole++ def tree_plan(self, x, y, h, r, clumps=7, lean=0.0, seed=0):+ """the layout of tree(): (crown mask, trunk mask, per-clump light, blobs) -- deterministic for a seed, so a+ background can be coloured round a tree before the tree itself is drawn"""+ rr = np.random.default_rng(seed)+ top = (x + lean * h, y - h)+ tm = self.tube([(x, y + 4), (x + lean * h * 0.4, y - h * 0.45), top], max(4.0, r * 0.16), max(2.5, r * 0.07))+ cx, cy = top[0], top[1] - r * 0.25+ blobs = []+ for k in range(clumps):+ a = 2 * np.pi * k / clumps + rr.normal(0, 0.25)+ d = r * rr.uniform(0.42, 0.7)+ blobs.append((cx + np.cos(a) * d * 1.12, cy + np.sin(a) * d * 0.78, r * rr.uniform(0.3, 0.44),+ int(rr.integers(1 << 30))))+ for k in range(max(2, clumps // 3)):+ a = rr.uniform(0, 2 * np.pi)+ blobs.append((cx + np.cos(a) * r * 0.2, cy + np.sin(a) * r * 0.15, r * rr.uniform(0.36, 0.48),+ int(rr.integers(1 << 30))))+ crown = np.zeros((self.H, self.W), np.float32)+ for (bx, by, br, bs) in blobs:+ crown = np.maximum(crown, self.blob(bx, by, br, br * 0.86, 0.14, seed=bs))+ return crown, tm, blobs, top++ def tree(self, x, y, h, r, colours=('lemon', 'gold', 'amber', 'olive'), trunk=('tan', 'brown', 'umber'), clumps=7,+ leaf=(7, 14), light=(-0.62, -0.58, 0.53), lean=0.0, avoid=None, branches=True, seed=0):+ """a storybook tree: a trunk from (x, y) rising h px, a crown of `clumps` rounded clumps of radius ~r,+ each lit from `light` and laid as short curved leaf strokes (dark clump under-layer, local, light tops),+ branches showing in the gaps. Returns the crown mask (same layout as tree_plan with the same seed)."""+ crown, tm, blobs, top = self.tree_plan(x, y, h, r, clumps, lean, seed)+ rr = np.random.default_rng(seed + 1)+ sd = lambda: int(rr.integers(1 << 30))+ lits = np.zeros_like(crown)+ for (bx, by, br, bs) in sorted(blobs, key=lambda b: -b[1]):+ m = self.blob(bx, by, br, br * 0.86, 0.14, seed=bs)+ lits = lits * (1 - m) + self.shading(m, light, br * 0.5) * m+ if avoid is not None:+ crown = crown * (1 - avoid); tm = tm * (1 - avoid)+ self.form(tm, trunk, 90, light, length=(max(5, r * 0.12), max(10, r * 0.3)), width=(1.3, 1.9), density=1.4,+ seed=sd())+ if branches:+ for k in range(4):+ a = np.deg2rad(-90 + rr.uniform(-70, 70))+ L = r * rr.uniform(0.5, 0.95)+ p1 = (top[0] + np.cos(a) * L, top[1] + np.sin(a) * L * 0.8)+ bm = self.tube([(top[0], top[1] + r * 0.3), ((top[0] + p1[0]) / 2, (top[1] + p1[1]) / 2 + 3), p1],+ max(2.5, r * 0.07), 1.5)+ self.hatch(bm, a * 180 / np.pi, trunk[2], (6, 14), (1.2, 1.6), 1.6, 0.8, 0.35, alpha=0.7, seed=sd())+ cfield = self.flow(-55, 60, max(20, r * 0.4), seed=sd())+ self.form(crown, colours, cfield, light, length=(leaf[0] * 1.4, leaf[1] * 1.8), width=(1.4, 2.0),+ density=0.9, lit=lits, seed=sd())+ dk = colours[3] if len(colours) > 3 else colours[2]+ self.leaves(crown * smoothstep(0.45, 0.9, 1 - lits), dk, leaf, 0.9, pressure=0.8, seed=sd())+ self.leaves(crown * (0.2 + 0.8 * smoothstep(0.2, 0.7, 1 - lits)), colours[2], leaf, 0.8, seed=sd())+ self.leaves(crown * (0.3 + 0.7 * smoothstep(0.25, 0.7, lits)), colours[1], leaf, 0.9, seed=sd())+ self.leaves(crown * smoothstep(0.5, 0.95, lits), colours[0], leaf, 0.85, opacity=0.6, seed=sd())+ return crown++ # ================================================================== light+ def glow(self, x, y, r, colours='glow', strength=1.0, density=1.3, length=(10, 26), width=(1.5, 2.3),+ halo=0.45, squash=1.0, clip=None, opacity=0.7, pressure=0.72, field=None, seed=None):+ """warm light as strokes radiating from (x, y): white-yellow near the source, orange further out, thinning+ into the surroundings, over a soft tooth-textured lift of the paper (halo)"""+ R = ramp(colours)+ d = np.sqrt((self.XX - x) ** 2 + ((self.YY - y) / squash) ** 2) / r+ if halo:+ hm = (halo * strength * np.exp(-d * d * 1.6) * (0.7 + 0.3 * self.T))+ if clip is not None: hm = hm * clip+ col = ramp_at(R, np.clip(d * 0.55, 0, 1))+ self.C += hm[..., None] * (col - self.C)+ prob = np.clip(strength * np.exp(-d * d * 0.9), 0, 1) * (d < 2.6)+ if clip is not None: prob = prob * clip+ fld = self.flow(-25, 35, 30) if field is None else field+ return self.hatch(prob, fld, (R, lambda xx, yy: np.clip(np.sqrt((xx - x) ** 2 + ((yy - y) / squash) ** 2) / r * 0.55, 0, 1)),+ length, width, density, pressure, opacity, 0.7, jitter=0.12, bend=0.02, value=0.04,+ hue=0.02, taper=(0.6, 0.1), clip=clip, seed=seed)++ def lift(self, mask, colour='cream', amount=0.6, tooth=0.5):+ """kneaded-eraser / white-pencil lift: pull an area toward a light colour, more on the tooth peaks"""+ a = np.clip(mask * amount * (1 - tooth + tooth * self.T * 1.4), 0, 1)+ self.C += a[..., None] * (hexc(colour) - self.C)++ def window(self, x0, y0, x1, y1, panes=(2, 2), frame='umber', light=('glow', 'lantern', 'flame'), sill=True,+ glow=0.9, seed=None):+ """a lit window: butter-yellow at the centre, orange toward the frame, a few muntins, a small glow"""+ r = self._r(seed)+ sd = lambda: int(r.integers(1 << 30))+ m = self.rect(x0, y0, x1, y1)+ cx, cy = (x0 + x1) / 2, (y0 + y1) / 2+ rr = max(x1 - x0, y1 - y0) * 0.6+ d = np.clip(np.sqrt(((self.XX - cx) / (x1 - x0)) ** 2 + ((self.YY - cy) / (y1 - y0)) ** 2) * 1.6, 0, 1)+ R = ramp(light)+ self.lift(m, 'cream', 0.85, 0.2)+ s = max(4.0, (x1 - x0) * 0.35)+ self.hatch(m, 80, (R, lambda xx, yy: d[yy.astype(int).clip(0, self.H - 1), xx.astype(int).clip(0, self.W - 1)] * 0.9),+ (s * 0.6, s * 1.3), (1.4, 2.0), 2.2, 0.8, 0.7, clip=m, seed=sd())+ self.hatch(m * smoothstep(0.55, 1.0, d), 20, light[-1], (s * 0.5, s), (1.3, 1.8), 0.9, 0.7, 0.5, clip=m, seed=sd())+ fw = max(1.4, (x1 - x0) * 0.07)+ for i in range(1, panes[0]):+ xx = x0 + (x1 - x0) * i / panes[0]+ self.line([(xx, y0), (xx, y1)], frame, fw, 0.8, 0.85, 0.5, seg=(200, 300), wobble=0.2, smooth=False)+ for j in range(1, panes[1]):+ yy = y0 + (y1 - y0) * j / panes[1]+ self.line([(x0, yy), (x1, yy)], frame, fw, 0.8, 0.85, 0.5, seg=(200, 300), wobble=0.2, smooth=False)+ fr = [(x0, y0), (x1, y0), (x1, y1), (x0, y1), (x0, y0)]+ self.line(fr, frame, fw * 1.25, 0.8, 0.85, 0.5, seg=(40, 90), wobble=0.3, smooth=False)+ if sill:+ self.line([(x0 - fw * 1.5, y1 + fw), (x1 + fw * 1.5, y1 + fw)], frame, fw * 1.6, 0.8, 0.85, 0.5,+ seg=(200, 300), wobble=0.2, smooth=False)+ if glow:+ self.glow(cx, cy, rr * 1.1, strength=0.5 * glow, density=0.7, length=(6, 14), width=(1.2, 1.8),+ halo=0.25 * glow, seed=sd())++ # ================================================================== water+ def reflect(self, waterline, region, src=None, ripple=6.0, stretch=1.0, darken=0.1, tint='sky', mixw=0.25,+ soft=2.0, length=(30, 80), width=(1.6, 2.4), density=1.2, pressure=0.66, opacity=0.4,+ field=0.0, seed=None):+ """horizontal strokes whose colour is the mirrored picture above the waterline (an int, or a per-column+ array), pushed sideways by ripples and mixed toward `tint`: a reflection made of strokes"""+ S = (self.C if src is None else src)+ S = np.stack([blur(S[..., c], soft) for c in range(3)], -1) if soft else S+ wl = np.broadcast_to(np.asarray(waterline, np.float32), (self.W,)) if np.ndim(waterline) == 0 else \+ np.asarray(waterline, np.float32)+ rr = self._r(seed)+ rx = noise2d(self.H, self.W, 30, 2, int(rr.integers(1 << 30))) - 0.5+ tc = hexc(tint)++ def col(x, y):+ xi = np.clip(x.astype(np.int32), 0, self.W - 1)+ w0 = wl[xi]+ dy = np.maximum(0, y - w0) / stretch+ sy = np.clip(w0 - dy, 0, self.H - 1)+ sx = np.clip(x + ripple * 2 * _lookup(rx, x, y) * (1 + dy / 60), 0, self.W - 1)+ c = S[sy.astype(np.int32), sx.astype(np.int32)]+ return np.clip(c * (1 - darken) * (1 - mixw) + tc * mixw, 0, 1)++ return self.hatch(region, field, col, length, width, density, pressure, opacity, 0.9, jitter=0.03,+ bend=0.01, value=0.04, hue=0.01, taper=(0.4, 0.2), seed=seed)++ def ripples(self, cx, cy, rx, ry, rings=3, colour='cream', width=1.8, pressure=0.7, opacity=0.6, gap=0.4,+ grow=1.35, seed=None):+ """broken elliptical pencil rings round something standing in the water"""+ r = self._r(seed)+ paths = []+ for k in range(rings):+ sx, sy = rx * grow ** k, ry * grow ** k+ a = r.uniform(0, 2 * np.pi)+ while a < 2 * np.pi + r.uniform(0, 1):+ L = r.uniform(0.5, 1.3)+ t = np.linspace(a, a + L, 9)+ if np.sin((a + L / 2)) > -0.65: # mostly the near half of the ring+ paths.append(np.stack([cx + sx * np.cos(t), cy + sy * np.sin(t)], 1))+ a += L + r.uniform(0.15, 0.5) * (1 + gap)+ if not paths: return 0+ return self.strokes(paths, colour, width, pressure, opacity, 0.85, (0.3, 0.2), k=9, seed=int(r.integers(1 << 30)))++ # ================================================================== small things and people+ def dots(self, region, colours, n=60, size=(2.0, 4.0), pressure=0.8, opacity=0.6, seed=None):+ """little pencil dabs (wildflowers far off, seeds): tiny tight scribbles"""+ r = self._r(seed)+ M = self._mask(region)+ bb = self._bbox(M)+ if bb is None: return 0+ x, y = self._seed_points(M, bb, n * 3, r)+ if len(x) > n:+ pick = r.choice(len(x), n, replace=False); x, y = x[pick], y[pick]+ paths = []; cl = []+ for i in range(len(x)):+ s = r.uniform(*size)+ a = r.uniform(0, np.pi)+ for j in range(3):+ b = a + j * np.pi / 3+ d = np.array([np.cos(b), np.sin(b)]) * s+ paths.append(np.array([[x[i] - d[0], y[i] - d[1]], [x[i], y[i]], [x[i] + d[0], y[i] + d[1]]], np.float32))+ cl.append(i)+ if not paths: return 0+ C = self._colours(colours, x, y, r)+ cols = C[np.asarray(cl)]+ return self.strokes(paths, lambda xx, yy, c=cols: c, (1.5, 2.2), pressure, opacity, 0.95, (0.8, 0.6), k=3,+ seed=int(r.integers(1 << 30)))++ def eye(self, x, y, r=4.0, colour='eye', lid=None, look=(0.0, 0.0), glint=True, seed=None):+ """a gentle dot eye (soft-edged, pencil-dark, never black), optional heavy lid line above it"""+ m = self.ellipse(x + look[0], y + look[1], r, r * 1.12)+ self.hatch(m, 60, colour, (r * 0.8, r * 1.6), (1.1, 1.5), 3.0, 0.92, 0.6, clip=m, seed=seed)+ self.hatch(m, -30, colour, (r * 0.8, r * 1.6), (1.1, 1.5), 2.0, 0.9, 0.6, clip=m, seed=seed)+ if glint:+ g = self.ellipse(x + look[0] - r * 0.3, y + look[1] - r * 0.35, max(0.9, r * 0.28))+ self.lift(g, 'white', 0.85, 0.15)+ if lid is not None:+ w, sag, col = lid+ self.line([(x - w * 0.55, y - r * 0.9 + sag * 0.3), (x, y - r * 1.25 - sag), (x + w * 0.55, y - r * 0.8)],+ col, 1.6, 0.66, 0.8, 0.35, seg=(200, 300), wobble=0.2)++ def blush(self, x, y, r=10.0, colour='cheek', amount=0.8, seed=None):+ """a rosy cheek: a soft round patch of fine circular strokes"""+ m = self.ellipse(x, y, r, r * 0.82)+ mm = blur(m, r * 0.35) * amount+ self.hatch(mm, self.contour(m, r * 0.3), colour, (r * 0.4, r * 0.9), (1.2, 1.7), 1.6, 0.6, 0.4, 0.75,+ clip=None, seed=seed)++ def lantern(self, x, y, size=26.0, body='lantern', ribs='tangerine', cap='umber', handle=True, glow=None,+ seed=None):+ """a small round paper lantern hanging with its top at (x, y): warm ribs, a glowing middle, dark caps.+ Returns its centre. glow=r draws its light now (otherwise call glow() later)."""+ r = self._r(seed)+ sd = lambda: int(r.integers(1 << 30))+ s = size+ cx, cy = x, y + s * 0.62+ bodym = self.ellipse(cx, cy, s * 0.5, s * 0.46)+ self.lift(bodym, 'sun', 0.85, 0.1)+ self.hatch(bodym, 90, ('glow', np.clip(self.value(0.15, 0.75, cy - s * 0.45, cy + s * 0.45, 0), 0, 1)),+ (s * 0.3, s * 0.6), (1.3, 1.8), 2.2, 0.8, 0.8, clip=bodym, seed=sd())+ d = np.sqrt(((self.XX - cx) / (s * 0.5)) ** 2 + ((self.YY - cy) / (s * 0.46)) ** 2)+ self.hatch(bodym * smoothstep(0.25, 1.0, d), 90, body, (s * 0.25, s * 0.5), (1.3, 1.8), 2.0, 0.82, 0.65,+ clip=bodym, seed=sd())+ self.hatch(bodym * smoothstep(0.7, 1.05, d), 90, ribs, (s * 0.2, s * 0.4), (1.2, 1.6), 1.0, 0.8, 0.45,+ clip=bodym, seed=sd())+ for k in (-0.6, -0.2, 0.2, 0.6): # ribs: vertical arcs+ xs = cx + k * s * 0.5+ ww = np.sqrt(max(0.0, 1 - k * k))+ self.line([(cx + k * s * 0.35, cy - s * 0.4 * ww), (xs, cy), (cx + k * s * 0.35, cy + s * 0.4 * ww)],+ ribs, 1.3, 0.7, 0.7, 0.4, seg=(200, 300), wobble=0.15)+ for yy, w in ((cy - s * 0.46, s * 0.42), (cy + s * 0.46, s * 0.38)):+ cm = self.rect(cx - w / 2, yy - s * 0.07, cx + w / 2, yy + s * 0.07)+ self.hatch(cm, 0, cap, (s * 0.15, s * 0.3), (1.3, 1.8), 3.0, 0.85, 0.5, clip=cm, seed=sd())+ if handle:+ self.line([(cx, cy - s * 0.52), (cx, y)], cap, 1.4, 0.7, 0.8, 0.4, seg=(200, 300), wobble=0.1)+ self.line([(cx, cy + s * 0.53), (cx + 0.5, cy + s * 0.75)], ribs, 1.6, 0.7, 0.8, 0.4, seg=(200, 300), wobble=0.1)+ if glow: self.glow(cx, cy, glow, seed=sd())+ return cx, cy++ def child(self, x, y, h=160.0, facing=1, coat=('cream', 'raincoat', 'raincoat_shade', 'raincoat_deep'),+ hair=('hair_light', 'hair', 'umber'), boots=('pink', 'boot', 'brick'), legs=('cornflower', 'denim', 'indigo'),+ skin=('pink', 'skin', 'skin_shade'), look=(0.0, 0.0), light=(-0.62, -0.58, 0.53), arm='lantern',+ paint=True, seed=0):+ """a small storybook child in a raincoat with the hood down, standing with feet at (x, y), `h` px tall,+ facing +1 (right) or -1. Returns anchors: hand (lantern grip), head (cx, cy, r), eye, mask.+ paint=False only plans it (the mask, to colour a background round it); the same seed gives the same child."""+ r = np.random.default_rng(seed)+ sd = lambda: int(r.integers(1 << 30))+ f = float(facing)+ X = lambda dx: x + dx * h * f+ Y = lambda dy: y - dy * h+ legm = np.maximum(self.tube([(X(-0.06), Y(0.27)), (X(-0.065), Y(0.1))], h * 0.07, h * 0.065),+ self.tube([(X(0.05), Y(0.27)), (X(0.06), Y(0.1))], h * 0.07, h * 0.065))+ bootm = np.maximum(self.poly([(X(-0.105), Y(0.15)), (X(-0.025), Y(0.15)), (X(-0.02), Y(0.02)), (X(0.0), Y(0.0)),+ (X(-0.13), Y(0.0)), (X(-0.12), Y(0.04))], smooth=True),+ self.poly([(X(0.015), Y(0.15)), (X(0.095), Y(0.15)), (X(0.10), Y(0.04)), (X(0.15), Y(0.02)),+ (X(0.15), Y(-0.005)), (X(0.01), Y(0.0)), (X(0.012), Y(0.05))], smooth=True))+ back = self.tube([(X(-0.05), Y(0.66)), (X(-0.12), Y(0.52)), (X(-0.13), Y(0.42))], h * 0.085, h * 0.075)+ coatpts = [(X(-0.08), Y(0.72)), (X(0.03), Y(0.73)), (X(0.11), Y(0.68)), (X(0.17), Y(0.45)), (X(0.22), Y(0.27)),+ (X(0.13), Y(0.24)), (X(0.0), Y(0.235)), (X(-0.14), Y(0.24)), (X(-0.22), Y(0.27)), (X(-0.15), Y(0.47))]+ coatm = self.poly(coatpts, smooth=True)+ hood = self.blob(X(-0.06), Y(0.73), h * 0.1, h * 0.06, 0.12, seed=sd(), rot=-15 * f)+ hr = h * 0.12+ hx, hy = X(0.035), Y(0.86)+ head = self.ellipse(hx, hy, hr * 0.98, hr)+ ear = self.ellipse(X(0.015), Y(0.85), hr * 0.17, hr * 0.22)+ nose = self.ellipse(hx + f * hr * 0.92, hy + hr * 0.18, hr * 0.16, hr * 0.15)+ cap = self.poly([(hx - f * hr * 1.08, hy + hr * 0.62), (hx - f * hr * 1.12, hy - hr * 0.2),+ (hx - f * hr * 0.6, hy - hr * 1.02), (hx + f * hr * 0.25, hy - hr * 1.1),+ (hx + f * hr * 0.85, hy - hr * 0.72), (hx + f * hr * 1.0, hy - hr * 0.32),+ (hx + f * hr * 0.7, hy - hr * 0.38), (hx + f * hr * 0.3, hy - hr * 0.48),+ (hx + f * hr * 0.05, hy - hr * 0.1), (hx - f * hr * 0.2, hy + hr * 0.3),+ (hx - f * hr * 0.45, hy + hr * 0.66)], smooth=True)+ sh_ = (X(0.06), Y(0.66))+ hand = (X(0.2), Y(0.43)) if arm == 'lantern' else (X(0.14), Y(0.42))+ elbow = (X(0.15), Y(0.53))+ armm = self.tube([sh_, elbow, hand], h * 0.088, h * 0.074)+ hm = self.ellipse(hand[0] + f * h * 0.012, hand[1] + h * 0.018, h * 0.03, h * 0.032)+ eyex, eyey = hx + f * hr * 0.55 + look[0], hy - hr * 0.02 + look[1]+ out = dict(hand=(hand[0] + f * h * 0.014, hand[1] + h * 0.04), head=(hx, hy, hr), eye=(eyex, eyey),+ mask=np.clip(legm + bootm + back + coatm + hood + head + cap + armm + hm + nose, 0, 1),+ coat=coatm)+ if not paint: return out+ st = dict(length=(h * 0.05, h * 0.12), width=(1.2, 1.8), density=1.25)+ self.form(legm, legs, 90, light, length=st['length'], width=st['width'], density=st['density'], seed=sd())+ self.form(bootm, boots, 0, light, length=st['length'], width=st['width'], density=1.4, seed=sd())+ self.form(back, coat[1:], 80, light, length=st['length'], width=st['width'], density=1.2, seed=sd())+ cf = self.blend(np.full((self.H, self.W), np.deg2rad(95 - 12 * f), np.float32), self.contour(coatm, 6), 0.25)+ self.form(coatm, coat, cf, light, length=(h * 0.06, h * 0.15), width=(1.3, 1.9), density=1.3,+ warm='lemon', cool='lavender', seed=sd())+ for k in range(4): # soft folds down from the chest+ fx = -0.12 + 0.08 * k + r.normal(0, 0.01)+ self.line([(X(fx * 0.6), Y(0.55)), (X(fx * 0.85), Y(0.42)), (X(fx * 1.1), Y(0.27))], coat[2], 1.4, 0.55,+ 0.6, 0.3, seg=(h * 0.12, h * 0.3), seed=sd())+ self.line([(X(-0.215), Y(0.27)), (X(0.0), Y(0.245)), (X(0.215), Y(0.275))], coat[3], 1.5, 0.6, 0.7, 0.3,+ seg=(h * 0.15, h * 0.3), seed=sd())+ for k in range(3): # toggles+ bx, by = X(0.115 - 0.01 * k), Y(0.6 - 0.1 * k)+ self.hatch(self.ellipse(bx, by, h * 0.012, h * 0.014), 0, coat[3], (2, 4), (1.2, 1.5), 2.5, 0.9, 0.5,+ clip=None, seed=sd())+ self.edge(coatm, coat[3], density=0.7, seed=sd())+ # the arm's soft shadow on the coat+ dx, dy = 3 * f, 5+ ash = np.roll(np.roll(blur(armm, 2.5), int(dy), 0), int(dx), 1) * coatm * (1 - armm)+ self.hatch(ash, 95 - 12 * f, (coat[2], coat[3]), (h * 0.03, h * 0.08), (1.2, 1.6), 1.6, 0.8, 0.35, seed=sd())+ self.form(hood, coat, self.contour(hood, 3), light, length=(h * 0.04, h * 0.09), width=(1.2, 1.7), density=1.3,+ seed=sd())+ self.form(head, skin, self.contour(head, 4), light, length=(hr * 0.3, hr * 0.7), width=(1.2, 1.6), density=1.6,+ pressure=0.74, seed=sd())+ self.edge(np.clip(head + nose, 0, 1), skin[2], (1.1, 1.5), 1.1, 0.7, 0.8, band=1.4, length=(4, 10), seed=sd())+ self.hatch(ear, 60, skin[2], (3, 6), (1.2, 1.5), 1.8, 0.72, 0.35, clip=ear, seed=sd())+ self.hatch(nose, 60, skin[1], (3, 6), (1.2, 1.5), 1.6, 0.7, 0.35, clip=nose, seed=sd())+ self.blush(hx + f * hr * 0.52, hy + hr * 0.36, hr * 0.2, amount=0.6, seed=sd())+ self.eye(eyex, eyey, max(1.6, hr * 0.1), seed=sd())+ hlit = self.shading(cap, light, hr * 0.5)+ # hair falls from the crown in smooth locks (a bob): strokes from a point above the forehead+ hf = self.radial(hx + f * hr * 0.15, hy - hr * 1.6, 0, 3, 40)+ self.hatch(cap, hf, hair[1], (hr * 0.5, hr * 1.0), (1.2, 1.6), 1.6, 0.76, 0.35, bend=0.01, clip=cap, seed=sd())+ kw = dict(spread=0.22, curl=0.03, converge=0.6, light=light[:2], clip=cap)+ self.fur(cap, hf, hair[1], (hr * 0.6, hr * 1.1), (1.1, 1.5), 1.3, (4, 7), pressure=0.78, seed=sd(), **kw)+ self.fur(cap * smoothstep(0.3, 0.8, 1 - hlit), hf, hair[2], (hr * 0.5, hr * 0.9), (1.1, 1.4), 1.0, (3, 6),+ pressure=0.8, seed=sd(), **kw)+ self.fur(cap * smoothstep(0.45, 0.95, hlit), hf, hair[0], (hr * 0.5, hr * 0.9), (1.0, 1.4), 0.7, (3, 5),+ pressure=0.7, opacity=0.5, seed=sd(), **kw)+ self.form(armm, coat, self.contour(armm, 3), light, length=(h * 0.04, h * 0.09), width=(1.2, 1.7),+ density=1.3, warm='lemon', seed=sd())+ self.edge(armm, coat[3], density=0.9, seed=sd())+ self.form(hm, skin, 60, light, length=(3, 6), width=(1.2, 1.5), density=1.6, seed=sd())+ return out++ # ================================================================== finish and output+ def finish(self, soft=0.3, grain=1.0, vignette=0.6, warmth=0.5):+ """record the finishing (applied in render, so every stage snapshot matches the final look)"""+ self.fin = dict(soft=soft, grain=grain, vignette=vignette, warmth=warmth)+ return self++ def render(self):+ out = self.C+ f = self.fin+ if f:+ if f['soft']:+ b = np.stack([blur(out[..., c], 0.8) for c in range(3)], -1)+ out = out * (1 - f['soft']) + b * f['soft']+ if f['vignette']:+ if not hasattr(self, '_vig'):+ dx = (self.XX / self.W - 0.5) * 2; dy = (self.YY / self.H - 0.5) * 2+ self._vig = smoothstep(0.75, 1.55, np.sqrt(dx * dx * 0.8 + dy * dy)).astype(np.float32)+ v = self._vig[..., None] * f['vignette'] * 0.12+ out = out * (1 - v) + out * hexc('#d9b48a') * v+ if f['warmth']:+ out = out * (1 + f['warmth'] * np.array([0.012, 0.0, -0.02], np.float32))+ if f['grain']:+ if not hasattr(self, '_grain'):+ r = np.random.default_rng(self.seed + 7)+ g = r.normal(0, 1, (self.H, self.W)).astype(np.float32)+ self._grain = (0.011 * (0.7 * g + 0.3 * blur(g, 0.8) * 2.0)).astype(np.float32)+ out = out * (1 + f['grain'] * self._grain[..., None])+ return np.clip(out, 0, 1)++ def composite(self):+ return Image.fromarray((self.render() * 255 + 0.5).astype(np.uint8))++ def stage(self, name):+ if not self.keep_stages: return+ im = self.composite()+ if self.stages_dir:+ os.makedirs(self.stages_dir, exist_ok=True)+ im.save(f'{self.stages_dir}/{self._n_stages:02d}_{name}.png', compress_level=1)+ else:+ b = io.BytesIO(); im.save(b, 'PNG', compress_level=1)+ self.stages.append((name, b.getvalue()))+ self._n_stages += 1++ def save(self, path, stages_dir=None, quality=88):+ img = self.composite()+ if str(path).lower().endswith(('.jpg', '.jpeg')): img.save(path, quality=quality, subsampling=0)+ else: img.save(path)+ sd = stages_dir or self.stages_dir+ if sd and self.keep_stages:+ os.makedirs(sd, exist_ok=True)+ for i, (name, b) in enumerate(self.stages):+ with open(f'{sd}/{i:02d}_{name}.png', 'wb') as f: f.write(b)+ img.save(f'{sd}/{self._n_stages:02d}_final.png', compress_level=1)+ return img+++def _resample_k(P, k):+ """resample a polyline to exactly k points by arc length"""+ if len(P) == 1: return np.repeat(P, k, 0)+ d = np.r_[0, np.cumsum(np.linalg.norm(np.diff(P, axis=0), axis=1))]+ if d[-1] < 1e-4: return np.repeat(P[:1], k, 0)+ s = np.linspace(0, d[-1], k)+ return np.stack([np.interp(s, d, P[:, 0]), np.interp(s, d, P[:, 1])], 1).astype(np.float32)