Skip to content

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.

Add pastel vignette style (76 total): a woman wearing her ginger cat as a scarf

cloveric1f564738c402
diff --git a/README.md b/README.md
index 87d17b9..927f937 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Claude Drawing · Claude 绘图
-**Claude paints with code — no image model.** Seventy-five 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, a warm coloured-pencil storybook spread and a colour town of gouache houses strung with bunting.
-**不用生图模型,Claude 用代码一笔一笔作画。** 七十五种画风,从水墨、油画到黏土、蓝晒、彩色玻璃花窗、罗马马赛克、代尔夫特蓝瓷砖、赛博朋克、光线追踪的小球海、低多边形 3D、热成像、X 光片、VHS 录像带、Synthwave 落日、产品发布片式的粉彩界面、红笔批改的答题卡、油灯下的皮影戏、钢笔淡彩的速写小卡、复古水粉的绘本大头像、蓝调绘本的雨天跨页、江南园林的春水园景、干刷色块的 mid-century 海报、暮色微缩绘本里转入星空的黄昏、排线夜景里流进海里的熔岩、深色笔记应用里渲染出的流程图、卡片铺开的无限白板、Flexoki 暖纸上的五图图解、暖调彩铅叠出来的绘本跨页和挂满彩旗的水粉彩色小镇。
+**Claude paints with code — no image model.** Seventy-six 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, a warm coloured-pencil storybook spread, a colour town of gouache houses strung with bunting and a soft-pastel vignette of a woman wearing her ginger cat as a scarf.
+**不用生图模型,Claude 用代码一笔一笔作画。** 七十六种画风,从水墨、油画到黏土、蓝晒、彩色玻璃花窗、罗马马赛克、代尔夫特蓝瓷砖、赛博朋克、光线追踪的小球海、低多边形 3D、热成像、X 光片、VHS 录像带、Synthwave 落日、产品发布片式的粉彩界面、红笔批改的答题卡、油灯下的皮影戏、钢笔淡彩的速写小卡、复古水粉的绘本大头像、蓝调绘本的雨天跨页、江南园林的春水园景、干刷色块的 mid-century 海报、暮色微缩绘本里转入星空的黄昏、排线夜景里流进海里的熔岩、深色笔记应用里渲染出的流程图、卡片铺开的无限白板、Flexoki 暖纸上的五图图解、暖调彩铅叠出来的绘本跨页、挂满彩旗的水粉彩色小镇和把橘猫当围巾的色粉小像。
[English](#english) · [中文](#中文)
@@ -56,8 +56,10 @@
| ![drybrush](examples/drawing_drybrush_noodle_counter.gif) | ![twilight](examples/drawing_twilight_paper_kite.gif) | ![nocturne](examples/drawing_nocturne_lava_sea.gif) |
| **Obsidian UI · 笔记应用界面** | **Canvas board · 白板卡片** | **Flexoki paper · Flexoki 纸面** |
| ![obsidianui](examples/drawing_obsidianui_reading_notes.gif) | ![canvasboard](examples/drawing_canvasboard_moving_plan.gif) | ![flexoki](examples/drawing_flexoki_pour_over.gif) |
-| **Warm pencil storybook · 暖调彩铅绘本** | **Ink wash · 水墨(月印万川)** | **Watercolour · 水彩(底纹)** |
-| ![pencilbook](examples/drawing_pencilbook_tortoise_crossing.gif) | ![moonriver](examples/drawing_moon_river.gif) | ![washes](examples/drawing_watercolor_washes.gif) |
+| **Warm pencil storybook · 暖调彩铅绘本** | **Pastel vignette · 色粉小像** | **Ink wash · 水墨(月印万川)** |
+| ![pencilbook](examples/drawing_pencilbook_tortoise_crossing.gif) | ![pastelvignette](examples/drawing_pastelvignette_marmalade_scarf.gif) | ![moonriver](examples/drawing_moon_river.gif) |
+| **Watercolour · 水彩(底纹)** | | |
+| ![washes](examples/drawing_watercolor_washes.gif) | | |
<p align="center"><img src="examples/drawing_colortown_festival_steps.gif" width="45%"><br><sub><b>Colour town · 彩色小镇</b> — portrait 3:4 · 竖幅</sub></p>
@@ -141,10 +143,10 @@
| <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%"> |
-| **雨后的节日台阶街** · *Festival Steps After the Rain*<br><sub>Colour town · 彩色小镇</sub> | |
-| <img src="examples/colortown_festival_steps.jpg" width="100%"> | |
+| **雨后的节日台阶街** · *Festival Steps After the Rain*<br><sub>Colour town · 彩色小镇</sub> | **橘猫围巾** · *The Marmalade Scarf*<br><sub>Pastel vignette · 色粉小像</sub> |
+| <img src="examples/colortown_festival_steps.jpg" width="100%"> | <img src="examples/pastelvignette_marmalade_scarf.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, a night sea laid stroke by stroke under the one warm light of lava meeting the water, and a hill town of gouache houses, inked line by line and slate by slate, strung with bunting and mirrored in a wet square. 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.
+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, a night sea laid stroke by stroke under the one warm light of lava meeting the water, a hill town of gouache houses, inked line by line and slate by slate, strung with bunting and mirrored in a wet square, and a woman and her cat in soft pastel, the faces rubbed smooth, the hair and fur laid strand by strand, the coat breaking up into dry strokes on white paper. 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.
---
@@ -152,7 +154,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-five styles:
+A [Claude Code](https://claude.com/claude-code) skill and a small painting library with seventy-six styles:
| Style | Module | What makes it read as the real medium |
|---|---|---|
@@ -231,6 +233,7 @@ A [Claude Code](https://claude.com/claude-code) skill and a small painting libra
| **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 |
| **Colour town (彩色小镇)** | `lib/colortown.py` · `ColorTown` | a dense, cheerful storybook hill town in opaque gouache and a fine ink line — tall narrow houses in tomato, mustard, teal, mint, coral and cream piled up a slope under blue-grey slate mansards, a white clock tower, strings of bunting across the street at several depths, climbing roses, window boxes and a wet square that mirrors it all. Every coat of colour is a polygon: tens of thousands are filled at once, each with its own id, into a 2× supersampled integer map, and numpy looks every id up in a table of colour, alpha and texture weights and box-averages back to pixels, so edges are anti-aliased and painter's order is id order. Three fields precomputed for the whole canvas — vertical brush streaks, horizontal streaks and an isotropic scumble — plus a low mottle vary each coat by a few percent: walls are mostly scumble with a little vertical brushwork, the sky and the paving horizontal, and light colours get less of it, so a white wall stays clean. Edges are resampled and pushed sideways by a smooth wobble, so nothing is ruler-straight and the colour never quite registers with its line. The ink is a dark warm brown laid after each group's colour. Every line is its own id in a 3× map (no beads where lines cross), split into pieces of slightly different width, and the corners of boxes are separate strokes that sometimes overshoot. The ink is half-transparent, so it reads red-brown on a red wall and near-black on glass. `house()` builds a townhouse from a few numbers. The walls are plaster with bare-stone patches, string courses and a cornice, a thin glaze toward the foot and a band of shade under the eaves. The ground floor is a door, a shopfront with lettering and a striped awning, or an archway. Above it sits a grid of windows that are each a little different: cream frames, dark teal glass with a pale reflection, glazing bars, sills, slatted shutters on some and curtains on others. Window boxes overflow with leaves and flower dabs, and iron balconies hold pots. Then comes the roof: slate laid tile by tile in staggered courses, each slate its own blue-grey, clipped to the roof with the joints inked, as a mansard, hip, side gable or pointy gable, with dormers, chimneys with pots and TV aerials. `plane()` lays a flat facade onto a quad through a homography, so a whole canyon wall recedes to the vanishing point with its windows, boxes and roses. Depth is haze, scale and overlap, painted back to front; there are almost no cast shadows. Roses are irregular cups with a darker heart and inked petal arcs among paired leaves; trees are clumps of leaf dabs, each lit as a dome from the upper left; bunting sags as a parabola, with pennants hanging off it that each have a darker fold. The wet street mirrors the picture about each column's base line, rippled and smeared down more the further it gets, darkened and streaked into pale flagstones, with the joints re-inked on top; `mirror()` reflects whatever is painted after it (people, a lamp post). It comes with a clock tower with an onion dome and a louvred belfry, steps that shrink as they climb, parapets, railings, lamps, hanging signs, posters, café tables, a cat and small faceless people |
+| **Pastel vignette (色粉小像)** | `lib/pastelvignette.py` · `PastelVignette` | a whimsical picture-book vignette in soft chalk pastel and a little gouache on pure white paper — a person and an animal companion, half-length, with no background panel and no frame: the painting simply stops and its edges break up into the white in dry strokes. The colour is soft and powdery (powder blue, cream, warm skin) with one warm accent family (ginger, tangerine); faces are rubbed smooth, with big round eyes, very large rosy cheeks and a red-tipped nose; hair and fur are hundreds of fine strands. The paper has an equalised tooth, and the same tooth is pre-dragged along 8 directions (stored as uint8), so pastel catches where the tooth rises above 1 − pressure and the pits it skips are drawn out along each stroke. Every *segment* of every stroke gets its own id in a 2× supersampled integer map, and numpy looks each covered sub-pixel up to its segment. From there it recovers the position along the stroke, for a pressure profile with rounded ends, and across it, for soft sides and bristle lanes that open up as the stroke runs dry. Pigment is laid where the pressure reaches the tooth and summed back with bincount, so tens of thousands of strokes cost about one Pillow line per segment. Pastel is nearly opaque, so pale dry strokes sit on a darker coat. `wash()` is pastel rubbed in with a finger: a smooth coat whose colour can come from a light field, with the deepest pits left a touch lighter and an edge that breaks into the tooth. `model()` washes a dark → light ramp over a soft dome light. A coat fades out through a smooth field, and its dry strokes run on past it, drying out pixel by pixel. `strands()` traces hair through a flow field and groups it into locks that share a root area, a wander, a curl and a shade; it paints dark first and lets a few fly loose. `fur()` lays tufts that are darker on the side away from the light, and `fluff()` grows short strands out of a silhouette, coloured from the paint just inside, so fur melts into what is behind it. Faces come from `eye()` (an off-white ball shaded blue-grey under the lid, a rayed iris with a pupil and two catchlights, a soft lid line flicking out at the outer corner), `blush()`, `nose()` (a side shadow and a red tip), `mouth()` and `brow()`. It also has a faint pencil line for background sketches, and leaves and sprigs |
Ask Claude to *"draw it yourself"*, *"paint this with code"*, or *"claude绘图"*, and name a style if you like. Claude then:
@@ -416,6 +419,14 @@ Every style has a complete example: `python3 examples/<name>.py out.png --stages
- a mirrored figure that isn't smeared leaves a dark ball under its feet — reflect what was painted, smeared and fading;
- paving stones with strong value variation turn into a chessboard under the reflection.
Keep the people tiny and faceless.
+- **Pastel vignette**: paint one or two characters, half-length, slightly off-centre, on pure white — no background panel, no frame. Keep the colour soft and powdery and let one warm family (orange, ginger, tangerine) be the only saturated thing. Rub faces smooth and keep the texture for the clothes (broad dry strokes along the folds) and the hair and fur (hundreds of strands in locks). Ink almost nothing: a lid line, a nostril, a soft warm contour on the shadow side. Work out what is in front of what once, and paint every layer only into its visible part. Watch for accidental reads:
+ - a cat lying across both shoulders as one even band is a feather boa — thicken its chest and its haunch, let the belly sag, and show a hind paw and the tail on the far side;
+ - a fringe whose edge follows the face outline leaves a bald egg of a forehead — cut it across the forehead, lower on the far side, and sweep the other side from the parting to the temple;
+ - fine bright strands all over the fur make a hedgehog — lay broad soft strokes first, keep the fine locks at half strength and the silhouette fluff sparse;
+ - short narrow square-ended strokes on a pale coat are rain, and strong bristle lanes in dark strokes are claw marks — round the ends, make the strokes broad and long, keep the lanes weak in the darks;
+ - a coat that ends in a torn edge or a band of speckles reads as torn paper or frost, and dry strokes dragged straight down are drips — fade the rubbed colour smoothly and let a few dry strokes run on past it along the drape;
+ - separate lashes are a comb, and white all round the iris is a stare — use a thick lid line with a flick and let the lid cover the top of the iris;
+ - eyes low in a round face make a child — for an adult, put the eye line at the middle of the head and narrow the jaw.
### Roadmap
@@ -427,7 +438,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,加上一个小巧的绘图库,内置七十六种画风:
| 画风 | 模块 | 为什么看起来像真的 |
|---|---|---|
@@ -506,6 +517,7 @@ Every style has a complete example: `python3 examples/<name>.py out.png --stages
| **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()` 照彩铅画家的方式塑形——浅色底层、固有色、同色系的暗部、核心最深处,再在受光一侧罩暖色、阴影里罩冷色——每层绕着形体自己的方向错开几度:沿着穹顶的等值线、绕着龟壳每块盾片、横过脖子的褶、顺着雨衣的衣褶。毛一绺一绺地画:根部散开、尖端聚拢、一起微弯,背光一侧暗一点;草反过来往上散开;树冠是一团团分别打光的短弯叶片笔触。暖光是顺着表面的一层层橙黄笔触加一层纸面提亮——不放射、也不是平滑光晕;倒影是取水线以上镜像颜色的横排线。附带绘本部件(树、亮灯的小房子、石头、鳞片、野花、纸灯笼、穿雨衣的波波头小孩,点点眼和腮红),收尾是轻微柔化、细颗粒和很淡的暖色暗角。没有墨线,没有黑色 |
| **彩色小镇** | `lib/colortown.py` · `ColorTown` | 不透明水粉平涂加细细的深棕墨线画的童话山城:番茄红、芥末黄、青绿、薄荷、珊瑚、奶白的窄高房子一排压一排堆上山坡,深蓝灰的石板曼莎屋顶,一座白色钟楼,好几层三角彩旗斜穿街道,爬藤玫瑰、窗台花箱,前景的湿广场把这一切倒映下来。每一块颜色都是一个多边形:几万块一次画完,Pillow 把每块按序号填进 2 倍超采样的整数 id 图,numpy 对每个 id 查一张颜色、不透明度、纹理权重表,再 box 平均回像素,所以边是抗锯齿的,画的先后就是序号的先后。整张画布预先算好三张纹理场(竖向笔刷条纹、横向笔刷条纹、各向同性的擦笔)加一层低频斑驳,每块颜色只差百分之几:墙以擦笔为主、带一点竖向笔刷,天空和铺地偏横向,浅色的纹理少一些,白墙才干净。边缘重采样后沿法线推一点平滑的抖动,没有尺子画的直线,颜色和描线也不完全对齐。墨线是深暖棕,每组颜色画完再画这一组的线:每条线在 3 倍 id 图里有自己的序号(交叉处不叠出墨珠),分成几段、粗细略有变化,方框四边分开画、转角偶尔出头;墨半透明,在红墙上是深红棕,在玻璃上近乎黑。`house()` 用几个数搭出一栋联排房子。墙是带裸石斑块的灰泥,有腰线、檐口,墙脚一层薄罩染,檐下一道淡阴影。底层是门、带字招牌和条纹遮阳篷的店面,或者拱门。楼上的窗格子每扇都略有不同:奶油色窗框,深青绿玻璃上一道浅色反光,窗棂、窗台,部分窗户有带横条的百叶窗,部分挂窗帘。窗台花箱的花叶溢出来,铁艺阳台后面摆着花盆。屋顶的石板一片片错缝铺上去,每片蓝灰各不相同,裁进屋顶、描出缝;有曼莎、四坡、侧山墙、尖山墙,带老虎窗、带赤陶帽的烟囱和电视天线。`plane()` 用透视单应把一块平摊的立面贴到四边形上,整面峡谷墙连窗、花箱、玫瑰一起往消失点收。远近靠雾化、尺度和从后往前的遮挡,几乎没有投影。玫瑰是成对小叶里的不规则杯形,花心深一点、描几道花瓣弧线;树冠是一团团叶片,每团按左上来光当穹顶打光;彩旗绳按抛物线下垂,三角旗挂在绳上,每面有一道深一点的折痕。湿街按每一列的墙脚线把画面镜像下来,加涟漪,离墙脚越远竖向拖得越长,压暗后拖成竖条混进浅色石板,再淡淡地重描石板缝;`mirror()` 把之后画的东西(人、路灯)也倒映下来。附带洋葱顶、木百叶钟楼开口的钟楼,越往上越小的台阶、石墙、铁栏杆、路灯、吊挂店招、海报、咖啡桌、猫和不画脸的小人 |
+| **色粉小像** | `lib/pastelvignette.py` · `PastelVignette` | 白纸上的绘本角色小像,软色粉加一点水粉:一个人和他的小动物,半身,不画背景色块、不加边框,画到边上就停,颜色干笔散进白纸。颜色柔和、粉粉的(粉蓝、奶油、暖肤色),只有一组暖橙饱和;脸揉得平滑,大圆眼、一大圈腮红、红鼻尖;头发和毛是成百上千根细丝。纸纹直方图均衡过,另外预先算好沿 8 个方向拖开的纸纹(存成 uint8):色粉挂在纸纹高于 1 − 压力的地方,漏掉的纸坑顺着笔拉成短道。每一笔的每一段在 2 倍超采样的整数 id 图里有自己的序号,numpy 对被盖住的子像素查回这一段,算出沿笔位置(两头收圆的压力曲线)和横向位置(两侧软边、越干越开的鬃毛条纹),压力够得着纸纹才上色,bincount 汇回像素,几万笔只要每段一次 Pillow 画线。色粉近乎不透明,浅色干笔能压在深色上。`wash()` 是手指揉开的色粉:平滑的一层,颜色可以按受光场取,最深的纸坑留一点浅,边缘按纸纹断开;`model()` 按软穹顶光把暗 → 亮的色阶揉上去。大衣用一张平滑的渐隐场收掉,干笔在它下面再走一段、逐像素变干。`strands()` 沿流向场画发丝,按绺分组(同一绺共用起点、偏移、弯曲和明暗),暗先亮后,几根飞出轮廓;`fur()` 是背光一侧暗的毛簇;`fluff()` 从轮廓里侧往外长短丝,颜色取它里面的颜料,毛茸茸的边融进后面的东西。五官:`eye()`(米白眼球、眼皮下灰蓝的影子、带放射纹的虹膜、瞳孔、两点白高光、外眼角挑出的软眼线)、`blush()`、`nose()`(鼻梁软影加红鼻尖)、`mouth()`、`brow()`。附带背景草稿用的淡铅笔线、叶子和枝条 |
对 Claude 说「claude绘图」「你自己画」「用代码画」,也可以指定画风。它会:
1. **先定构图**:层次、焦点、留白,而且画面要图解内容本身;
@@ -610,6 +622,7 @@ 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/ # 暖调彩铅绘本:大龟过河
python3 examples/colortown_festival_steps.py out.jpg --stages stages/ # 彩色小镇:雨后的节日台阶街
+python3 examples/pastelvignette_marmalade_scarf.py out.jpg --stages stages/ # 色粉小像:橘猫围巾
```
### 作画要点(Claude 交图前逐条自查)
@@ -744,6 +757,14 @@ python3 examples/colortown_festival_steps.py out.jpg --stages stages/ # 彩色
- 没有拖尾的镜像小人,会在脚下留一个深色圆球——镜像实际画出来的像素,竖向拖尾、往下渐淡;
- 明暗差太大的石板,在倒影下面会变成棋盘格。
小人要很小、不画脸。
+- **色粉小像**:画一两个角色,半身、略偏一边,放在纯白纸上——不画背景色块、不加边框。颜色要柔和、粉粉的,只让一组暖色(橙、橘、橘黄)饱和。脸揉平滑,质感留给衣服(顺着衣褶的宽干笔)和头发、毛(成百上千根、一绺一绺)。几乎不描线:眼线、鼻翼、背光一侧一道暖色软轮廓就够了。先把谁挡着谁一次算好,每一层只画在自己看得见的部分上。小心看错:
+ - 横趴在两边肩上、粗细均匀的猫是一条羽毛围巾——胸口和胯部要粗、肚子往下垂,另一边露出一只后爪和尾巴;
+ - 刘海的下沿顺着脸的轮廓走,露出来的额头就是一个秃的蛋——让它横过额头、远侧低,另一边从分缝扫到太阳穴;
+ - 满身又亮又细的毛是刺猬——先铺宽的软笔触,细毛减半,轮廓的绒毛要稀;
+ - 浅色大衣上又短又窄、方头的笔触是雨,深色笔触里的鬃毛条纹太强是抓痕——两头收圆,笔要宽要长,深色里的条纹弱一点;
+ - 大衣收在一条撕纸边或一圈白点上,就是撕纸或结霜,干笔直直往下拖是流下来的颜料——揉色平滑地淡掉,再让几笔干笔顺着衣摆多走一段;
+ - 一根根的睫毛是一把梳子,眼白一圈包着虹膜是瞪眼——用一道粗的眼线在外眼角挑出去,上眼皮盖住虹膜上沿;
+ - 圆脸里眼睛偏下就是小孩——画大人要把眼线放在头的正中间,下巴收窄。
### 计划
diff --git a/SKILL.md b/SKILL.md
index 9599893..d9e056e 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 的橙、红、蓝、绿、紫、青只放在有意义的地方,橙色聚焦框、黑底胶囊、字距收紧的大数字;能做成图一边一边画出来、数字滚动的动图)、暖调彩铅绘本 · Warm Pencil Storybook(暖白、有齿纹的纸上一层层叠涂的彩色铅笔绘本页:天空、山坡、草、水、一只大而温柔的生物和一个小小的孩子,全由顺着形体走向的细铅笔线叠成——天空横向长排线,山坡顺着坡势,龟壳绕着每块盾片的生长纹,脖子横过褶皱,雨衣顺着衣褶,苔藓和头发一簇簇顺毛;每块先铺一层浅色底,再上固有色、背光处叠同色系的深色,受光处罩一层暖色、阴影里罩一层冷色,每层角度错开一点、笔触交叉;蜡只挂在纸齿的峰上,同一批纸坑一层层都透出细白点,压得重、叠得多的地方才慢慢合上;后画的东西先留白再铺背景,颜色不互相混;毛是一绺一绺的:根部散开、尖端聚拢、顺着毛向,每绺受光一侧亮、背光一侧暗;没有墨线、没有黑色,只有很淡的同色轮廓;黄昏的暖光:灯笼和窗灯是一层层橙黄的发光叠涂(不是一团光晕,也不是放射线),低低的太阳给受光一侧一道暖边;水里的倒影也是一笔笔横排线;附带树、小房子、石头、鳞片、野花、纸灯笼和穿雨衣提灯笼的小孩等绘本部件)、彩色小镇 · Colour Town(不透明水粉平涂加细细的深棕墨线画的童话山城街景:高高窄窄的房子漆成番茄红、芥末黄、青绿、薄荷、珊瑚、奶白,一排压一排堆上山坡,近大远小、前后遮挡;深蓝灰的石板曼莎屋顶是一片片瓦错缝铺出来的,带老虎窗、烟囱和赤陶烟囱帽、电视天线;白色钟楼、淡蓝的天和奶白的云;三角彩旗串在好几层深度上斜穿街道,远处的小、近处的大,每面旗有一道深一点的折痕;红色爬藤玫瑰、溢出来的窗台花箱、铁艺阳台、石头台阶和扶手、路灯、吊挂的店招、拱门和彩色木门、写着字的店面和条纹遮阳篷;前景是湿亮的街面,把整条街倒映成一道道竖向的笔触;每块颜色都是带一点笔刷纹理的不透明平涂,边缘像手画的那样微微抖,和描线不完全对齐;墨线分成几段、粗细略有变化,方框的转角偶尔出头;墨是半透明的,压在红墙上是深红棕,压在玻璃上近乎黑;窗户排得整齐,但每扇都略有不同;一整面墙可以用透视单应贴成往消失点收的峡谷墙;几乎没有投影;附带钟楼、台阶、矮墙、栏杆、树、花盆、彩旗、路灯、店招、海报、咖啡桌、猫和概括的小人等部件)。用户说「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 / colour town / colorful European town / storybook street / fairy-tale town / candy-coloured houses / hill town / bunting / pennant flags / festival street / clock tower / onion dome / slate mansard roofs / dormers / chimney pots / TV aerials / climbing roses / window boxes / wrought-iron balconies / stepped lane / wet street reflection / gouache and ink cityscape" 时使用;也用于需要逐步画出(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,剖面和施工图仍用蓝图工程图。「暖调彩铅绘本 / 彩铅绘本 / 彩铅童书插画 / 巨物与小孩 / 大龟过河 / 纸齿白点 / 层层叠涂」指暖调彩铅绘本(暖白纸上满画面顺形体的彩铅叠涂、纸齿透出细白点、毛发成簇顺毛,大而温柔的生物和小小的孩子,黄昏暖光和橙黄的灯,没有墨线和黑色);单说「彩铅」仍指韩国彩铅(明亮可爱的甜品小物、粉嫩高光),黑白石墨仍用铅笔素描,软蓝限色、刮擦墨线加蜡笔颗粒的绘本跨页仍用蓝调绘本,粉彩黄昏转入星空、满坡小野花仍用暮色微缩绘本,不透明水粉的特写大头像仍用复古水粉,深蓝夜色里只有一个暖光的排线小版画仍用排线夜景;单说「绘本」仍指绘本角色动画。「彩色小镇 / 彩色房子 / 童话小镇 / 童话街景 / 彩旗街 / 钟楼小镇 / 水粉加描线的街景 / 有被这彩色小镇治愈到」指彩色小镇(水粉平涂加细墨线,密密的彩色房子堆上山坡,石板曼莎屋顶、白色钟楼、好几层三角彩旗、爬藤玫瑰和窗台花、湿街倒影);中式园林和古镇仍用江南园林,锡釉蓝砖上的运河小镇仍用代尔夫特蓝瓷砖,黑白刻版的雪村仍用黑白麻胶版画,彩纸剪出来的热气球小镇仍用剪纸拼贴,系统的微缩模型和小岛仍用等轴 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(暖白、有齿纹的纸上一层层叠涂的彩色铅笔绘本页:天空、山坡、草、水、一只大而温柔的生物和一个小小的孩子,全由顺着形体走向的细铅笔线叠成——天空横向长排线,山坡顺着坡势,龟壳绕着每块盾片的生长纹,脖子横过褶皱,雨衣顺着衣褶,苔藓和头发一簇簇顺毛;每块先铺一层浅色底,再上固有色、背光处叠同色系的深色,受光处罩一层暖色、阴影里罩一层冷色,每层角度错开一点、笔触交叉;蜡只挂在纸齿的峰上,同一批纸坑一层层都透出细白点,压得重、叠得多的地方才慢慢合上;后画的东西先留白再铺背景,颜色不互相混;毛是一绺一绺的:根部散开、尖端聚拢、顺着毛向,每绺受光一侧亮、背光一侧暗;没有墨线、没有黑色,只有很淡的同色轮廓;黄昏的暖光:灯笼和窗灯是一层层橙黄的发光叠涂(不是一团光晕,也不是放射线),低低的太阳给受光一侧一道暖边;水里的倒影也是一笔笔横排线;附带树、小房子、石头、鳞片、野花、纸灯笼和穿雨衣提灯笼的小孩等绘本部件)、彩色小镇 · Colour Town(不透明水粉平涂加细细的深棕墨线画的童话山城街景:高高窄窄的房子漆成番茄红、芥末黄、青绿、薄荷、珊瑚、奶白,一排压一排堆上山坡,近大远小、前后遮挡;深蓝灰的石板曼莎屋顶是一片片瓦错缝铺出来的,带老虎窗、烟囱和赤陶烟囱帽、电视天线;白色钟楼、淡蓝的天和奶白的云;三角彩旗串在好几层深度上斜穿街道,远处的小、近处的大,每面旗有一道深一点的折痕;红色爬藤玫瑰、溢出来的窗台花箱、铁艺阳台、石头台阶和扶手、路灯、吊挂的店招、拱门和彩色木门、写着字的店面和条纹遮阳篷;前景是湿亮的街面,把整条街倒映成一道道竖向的笔触;每块颜色都是带一点笔刷纹理的不透明平涂,边缘像手画的那样微微抖,和描线不完全对齐;墨线分成几段、粗细略有变化,方框的转角偶尔出头;墨是半透明的,压在红墙上是深红棕,压在玻璃上近乎黑;窗户排得整齐,但每扇都略有不同;一整面墙可以用透视单应贴成往消失点收的峡谷墙;几乎没有投影;附带钟楼、台阶、矮墙、栏杆、树、花盆、彩旗、路灯、店招、海报、咖啡桌、猫和概括的小人等部件)、色粉小像 · Pastel Vignette(白纸上的绘本角色小像,软色粉加一点水粉:一个人和他的小动物,半身、略偏一边,四周大片留白,不画背景色块、不加边框,画面在边上用干笔散开、融进白纸;颜色柔和、粉粉的——浅粉蓝的衣服上看得见顺着衣褶的干笔、奶油色的毛衣、暖肤色——只有一组暖橙饱和(橘猫、绒球、蝴蝶结这类);脸是揉开的平滑色粉:大圆眼、深色虹膜和两点白高光、一大圈腮红、红鼻尖、小嘴;头发和毛是成百上千根细丝,一绺一绺,有几根飞出轮廓,毛的轮廓蓬松地融进后面的东西;几乎不描线,只有眼皮、鼻翼、脸的背光侧几道细的软线;背后至多一枝叶子和一层很淡的铅笔小镇;附带圆眼、眉毛、腮红、鼻子、嘴、发丝、毛簇、蓬松轮廓、叶子和枝条等部件)。用户说「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 图、图表渲染器、灰底圆角框、小三角箭头、橙色聚焦框、数字滚动、计时器大数字、配方图解、步骤图解、手冲咖啡图解、菜谱图解、工作流程图解、暖调彩铅绘本、暖调彩铅、彩铅绘本、彩铅童书、彩铅童书插画、彩色铅笔绘本、彩色铅笔童书、软彩铅、彩铅叠涂、层层叠涂的彩铅、顺着形体排线、纸齿白点、纸纹透白、怀旧童书、翻绘本的感觉、温暖怀旧的绘本、暖色绘本页、巨物与小孩、大动物和小孩、巨大温柔的生物、温柔的巨兽、大乌龟、巨龟、老乌龟、背着花园的乌龟、龟背上的小花园、大龟过河、过河、小溪、踏脚石、提灯笼的小孩、黄色雨衣、纸灯笼、亮灯的窗、亮灯的小房子、黄昏小镇、成簇的毛、顺毛、毛一绺一绺、苔藓、金黄的树、彩色小镇、彩色房子、彩色街景、童话小镇、童话街景、治愈小镇、理想的生活环境、欧洲小镇、山城小镇、钟楼小镇、彩虹小镇、彩旗、三角彩旗、彩旗串、彩旗街、节日街道、节日早晨、钟楼、白色钟楼、洋葱顶、石板屋顶、曼莎屋顶、老虎窗、烟囱帽、电视天线、风向标、爬藤玫瑰、窗台花箱、铁艺阳台、台阶街、石头台阶、拱门下的台阶、湿街倒影、雨后街道、雨后的广场、水粉街景、水粉加描线、水粉平涂加细线、细节多到看不完、小红书彩色小镇、色粉小像、色粉画、软色粉、色粉笔触、色粉质感、色粉加水粉、粉彩笔触、粉彩质感、绘本角色、绘本人物、绘本小像、角色小像、人物小像、半身像、人和宠物、人和猫、人和狗、主人和宠物、抱着猫、抱着狗、橘猫、大橘、毛茸茸的猫、毛茸茸的狗、狐狸、猫围巾、把猫当围巾、白底插画、留白插画、不画背景、边缘散开、干笔散开、画到边上就散了、大眼睛、大圆眼、大腮红、红鼻头、红鼻尖、发丝、一根根头发、头发丝、飞丝、毛绒绒、蓬松的毛、温柔的小像、治愈系角色、Midjourney 色粉风),或 "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 / colour town / colorful European town / storybook street / fairy-tale town / candy-coloured houses / hill town / bunting / pennant flags / festival street / clock tower / onion dome / slate mansard roofs / dormers / chimney pots / TV aerials / climbing roses / window boxes / wrought-iron balconies / stepped lane / wet street reflection / gouache and ink cityscape / pastel vignette / soft pastel character / chalk pastel portrait / pastel textures and painterly brushstrokes / whimsical character design / picture-book character on white / person with a pet / girl and her cat / ginger cat / cat scarf / big round eyes / rosy cheeks / red-tipped nose / wispy hair strands / fluffy fur / feathered edges / vignette on white paper / Midjourney sref 455581803 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,剖面和施工图仍用蓝图工程图。「暖调彩铅绘本 / 彩铅绘本 / 彩铅童书插画 / 巨物与小孩 / 大龟过河 / 纸齿白点 / 层层叠涂」指暖调彩铅绘本(暖白纸上满画面顺形体的彩铅叠涂、纸齿透出细白点、毛发成簇顺毛,大而温柔的生物和小小的孩子,黄昏暖光和橙黄的灯,没有墨线和黑色);单说「彩铅」仍指韩国彩铅(明亮可爱的甜品小物、粉嫩高光),黑白石墨仍用铅笔素描,软蓝限色、刮擦墨线加蜡笔颗粒的绘本跨页仍用蓝调绘本,粉彩黄昏转入星空、满坡小野花仍用暮色微缩绘本,不透明水粉的特写大头像仍用复古水粉,深蓝夜色里只有一个暖光的排线小版画仍用排线夜景;单说「绘本」仍指绘本角色动画。「彩色小镇 / 彩色房子 / 童话小镇 / 童话街景 / 彩旗街 / 钟楼小镇 / 水粉加描线的街景 / 有被这彩色小镇治愈到」指彩色小镇(水粉平涂加细墨线,密密的彩色房子堆上山坡,石板曼莎屋顶、白色钟楼、好几层三角彩旗、爬藤玫瑰和窗台花、湿街倒影);中式园林和古镇仍用江南园林,锡釉蓝砖上的运河小镇仍用代尔夫特蓝瓷砖,黑白刻版的雪村仍用黑白麻胶版画,彩纸剪出来的热气球小镇仍用剪纸拼贴,系统的微缩模型和小岛仍用等轴 2.5D,针管笔速写加淡彩的小卡仍用钢笔淡彩,水粉画的人物大头像仍用复古水粉,彩铅叠出来的黄昏小镇和巨物仍用暖调彩铅绘本,没有描线、没有笔触的几何色块仍用扁平矢量。「色粉小像 / 色粉画 / 绘本角色小像 / 人和宠物 / 猫围巾 / 白底不画背景、边上干笔散开的角色 / 大眼睛大腮红红鼻尖」指色粉小像(白纸上的半身角色小像,软色粉加一点水粉,大圆眼、大腮红、红鼻尖、一根根的发丝和蓬松的毛,柔和的粉蓝和奶油色里只有一组暖橙,边缘散进白纸);背后刷一块单色、看得见毛衣针脚的复古童书大头像仍用复古水粉,满画面彩铅叠涂、带天空和场景的黄昏绘本页仍用暖调彩铅绘本,软蓝限色、乱线墨线的绘本跨页仍用蓝调绘本,针管笔线稿加淡彩的速写小卡仍用钢笔淡彩,明亮可爱的彩铅甜品小物仍用韩国彩铅;「色粉夜景」仍指排线夜景,「粉彩界面」仍指产品界面。
---
# Claude 绘图
@@ -89,6 +89,7 @@ description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型
| 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 秒 |
| 彩色小镇 · Colour Town | `lib/colortown.py` · `ColorTown` | `examples/colortown_festival_steps.py` 雨后的节日台阶街 · Festival Steps After the Rain(1500×2000 的竖幅童话街景,不透明水粉平涂加细细的深棕墨线:节日的早晨,刚下过一阵雨,一条石头台阶从湿漉漉的小广场爬上山,从一栋薄荷绿房子底下的拱门里穿过去,接着往上走;番茄红、芥末黄、青绿、薄荷、珊瑚、奶白、天蓝的房子一排压一排堆上山坡,越往上越小、越淡,有尖尖的山墙、窄窄的塔楼式房子和几片赤陶瓦,深蓝灰的石板曼莎屋顶一片片错缝铺出来,带老虎窗、烟囱和赤陶烟囱帽、电视天线;山顶左边一座白色钟楼,铜绿洋葱顶、三扇木百叶钟楼开口、指着九点零几分的钟面、顶上一面红旗;淡蓝的天,奶白的云,几只小鸟;左边是一面往消失点收的峡谷墙(浅粉、白、浅黄三栋,整面墙按透视单应贴上去),右边是一栋离我们很近的白房子,有几扇浅蓝百叶窗、铁艺阳台、窗台花箱,底层是青绿色的咖啡馆,条纹遮阳篷,外面摆两张小咖啡桌;三角彩旗挂在四个深度上:远处山上两串很小的,上排房子前一串,广场上两串,最近四串大的斜穿过整个画面,每面旗有一道深一点的折痕,绳子从钟面下面过;红玫瑰和粉玫瑰爬满墙角,窗台花箱里花叶溢出来,还有花店 FLEURS 门口一排花桶、面包店 PAIN、吊挂的咖啡杯和钥匙店招、壁灯、墙脚的海报和盆栽、台阶两侧的石墙和铁栏杆、台阶上一只猫、两棵圆圆的绿树;广场是湿的,把房子、彩旗和人倒映成一道道竖向的笔触,石板缝淡淡地透出来;几个很小、不画脸的人:打红伞的、牵红气球的孩子、一对并肩走的、提一篮花的;照插画师的顺序画:空纸 → 天空和云 → 远处的小镇和钟楼 → 上面两排房子和树 → 拱门房子、台阶和广场边的房子 → 两侧的峡谷墙 → 玫瑰、花盆和店招 → 近处的彩旗 → 湿广场和倒影 → 行人、路灯和咖啡桌;`--stages` 出 9 个阶段加成品) | 约 7 秒 |
+| 色粉小像 · Pastel Vignette | `lib/pastelvignette.py` · `PastelVignette` | `examples/pastelvignette_marmalade_scarf.py` 橘猫围巾 · The Marmalade Scarf(1920×1080 的白底角色小像,软色粉加一点水粉:冷天的早上,一个年轻女人把她的大橘猫当围巾围在脖子上——猫头和两只前爪从她一边肩上垂下来,一只后爪和带深色环纹的尾巴从另一边垂在大衣前面;她朝猫歪着头、斜眼看它、抿着嘴笑,猫用一双圆圆的琥珀色眼睛抬头看她;蓝黑色的长波浪发,侧分的刘海斜过额头,大圆眼、深棕虹膜和白高光,两大圈腮红,红鼻尖,小嘴;浅粉蓝的大衣看得见顺着衣褶和袖子的干笔,大衣下摆在白纸上干笔散开,里面是奶油色的罗纹毛衣;猫毛先铺一层宽的软笔触,再一簇簇细毛、受光处的浅色毛尖、额头几道深色虎纹,轮廓蓬松地融进后面的头发和大衣,奶白的嘴套和爪子、粉色的耳朵里、白胡子;背后左边一枝桉树叶(夹几片赭黄的),右边一层很淡的铅笔小镇(几栋房子和一座圆顶塔),其余都是白纸;照色粉插画师的顺序画:空纸 → 铅笔起稿 → 桉树枝和铅笔小镇 → 平涂大块 → 塑形(揉开的脸、大衣的干笔)→ 猫毛 → 一绺绺的头发 → 五官 → 干笔高光和飞出来的几根头发;`--stages` 出 8 个阶段加成品) | 约 9 秒 |
各画风共用 `lib/core.py` 里的底层工具:噪声、模糊、样条曲线、多边形遮罩、有机轮廓 `blob_pts`、毛笔 `bristle_stroke`、中文字体查找;新四种还用到补零平移 `shift`、文字遮罩 `text_mask`、西文字体查找 `latin_font`/`load_font`,以及高度图打光 `height_normals`、`height_shadow`(沿光线步进的投影)、`ambient_occlusion`。
@@ -167,7 +168,8 @@ description: Claude 绘图 / Claude Drawing —— 不借助任何生图模型
- 计划和想法之间的关系,「把几张卡片摆在一块白板上、用箭头连起来」的整理:旅行 / 搬家 / 活动计划、读书和研究笔记的脉络、头脑风暴、项目拆解、评论区里的一问一答,讲解片里「白板上一步步摆出来、镜头跟着移过去」的页 → 白板卡片(要笔记正文、文件列表和关系图谱用笔记应用界面;要暖白纸上的流程图和图表用 Flexoki 纸面;要明亮的粉彩产品界面用粉彩界面;要一层层叠起来的图解用描图纸叠层);
- 讲解片、文档、教程里的「图表页」:步骤和流程、时间线上的往来、占比、对比,要像文档站或技术博客里的图——暖白纸、墨黑字、浅灰圆角卡片,图像 Mermaid 渲染出来那样干净(灰边框、墨线小三角箭头、普通标签),一页放几张图讲清一件事(一份配方、一个工作流程、一次部署、一组产品数字),还能做成「图一边一边画出来、数字滚动」的动图 → Flexoki 纸面(要手写粉笔的示意图用黑板板书;要铅笔图表和便利贴的实验记录用实验笔记本;要彩色粉彩底和 macOS 窗口的产品界面用粉彩界面;要深色笔记应用窗口用笔记应用界面;要点阵白板上的卡片和连线用白板卡片;要系统的微缩模型用等轴 2.5D);
- 温暖、怀旧、像翻开一本童书的一页:一只大而温柔的生物陪着一个小小的孩子(巨龟、大熊、温柔的怪兽陪孩子过河、等车、看日落),午后和黄昏的暖光、亮灯的窗和灯笼、草地、小溪和小镇,要满画面看得见彩色铅笔的笔触和纸齿,讲解片里「温柔的陪伴 / 慢慢来 / 一起走一段」的页,童书封面和插页 → 暖调彩铅绘本(要明亮可爱的彩铅甜品小物用韩国彩铅;要软蓝限色、乱线墨线的绘本跨页用蓝调绘本;要粉彩黄昏转入星空、满坡野花用暮色微缩绘本;要黑白石墨写生用铅笔素描;要不透明水粉的特写大头像用复古水粉);
-- 治愈、明亮、「细节多到看不完」的童话街景:一座彩色的欧洲小镇、节日的街道、雨后的广场、钟楼和台阶,满街彩旗、玫瑰、花箱和阳台,要一眼就是「手画的水粉插画加细细的描线」,竖幅海报、小红书封面、旅行 / 城市 / 节日 / 「理想的生活」的配图,讲解片里「一个地方 / 一个社区 / 很多人一起生活」的页 → 彩色小镇(要中式园林、古镇和春水用江南园林;要锡釉蓝砖上的运河小镇用代尔夫特蓝瓷砖;要彩纸剪出来的小镇用剪纸拼贴;要系统的微缩模型用等轴 2.5D;要针管笔速写加淡彩的小卡用钢笔淡彩;要没有描线的几何色块用扁平矢量;要彩铅叠涂的黄昏小镇用暖调彩铅绘本)。
+- 治愈、明亮、「细节多到看不完」的童话街景:一座彩色的欧洲小镇、节日的街道、雨后的广场、钟楼和台阶,满街彩旗、玫瑰、花箱和阳台,要一眼就是「手画的水粉插画加细细的描线」,竖幅海报、小红书封面、旅行 / 城市 / 节日 / 「理想的生活」的配图,讲解片里「一个地方 / 一个社区 / 很多人一起生活」的页 → 彩色小镇(要中式园林、古镇和春水用江南园林;要锡釉蓝砖上的运河小镇用代尔夫特蓝瓷砖;要彩纸剪出来的小镇用剪纸拼贴;要系统的微缩模型用等轴 2.5D;要针管笔速写加淡彩的小卡用钢笔淡彩;要没有描线的几何色块用扁平矢量;要彩铅叠涂的黄昏小镇用暖调彩铅绘本);
+- 一两个讨喜的角色的小像:一个人和他的小动物(猫、狗、狐狸)、温柔的一刻(抱着、依偎、对视)、人设卡和头像,要一眼就是「绘本里的色粉加一点水粉」——白纸上不画背景,画到边上就干笔散开,大圆眼、大腮红、红鼻尖,一根根的发丝和蓬松的毛,柔和的粉彩色里只有一种暖橙,讲解片里「这个人 / 这只宠物 / 陪伴」的页,小红书头像和封面 → 色粉小像(要复古童书味、背后刷一块单色、看得见毛衣针脚的大头像用复古水粉;要满画面彩铅叠涂、有天空有场景的黄昏绘本页用暖调彩铅绘本;要软蓝限色、乱线墨线的绘本跨页用蓝调绘本;要针管笔线稿加淡彩的速写小卡用钢笔淡彩;要明亮可爱的彩铅甜品小物用韩国彩铅)。
每种画风一幅范例作为质量基准(范例都不用禅意主题);水墨另加一幅「月印万川」(留白托月、水面倒影)。
@@ -1299,6 +1301,28 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask
- 收尾:`finish(soft, grain, warmth, vignette)`;`render()`、`composite()`、`stage(name)`、`save(path, stages_dir)`;`save('x.jpg')` 默认 quality 88、4:4:4 色度。
- 颜色用 `PAINTS` 里的名字(paper ink ink_soft iron;sky_top sky sky_low haze cloud cloud_shade;tomato red brick coral salmon pink blush rose_wall mustard ochre yellow butter pale_yellow orange apricot teal teal_deep jade mint pale_mint aqua turquoise blue cobalt powder cerulean green sage lavender cream ivory white stone stone_mid stone_dark warmgrey;slate slate_dark slate_light slate_blue tile tile_dark verdigris copper;glass glass_light glass_dark curtain wood wood_dark gold;leaf_dark leaf leaf_mid leaf_light leaf_pale trunk rose rose_dark rose_light rose_pink rose_pink_dark blossom_white blossom_yellow blossom_orange blossom_purple blossom_pink terracotta pot_dark;street cobble cobble_dark wet;skin hair hair_light)或 '#rrggbb';彩旗的颜色是 `BUNTING`,石板和瓦是 `SLATE_RAMP`、`TILE_RAMP`。
+**色粉小像 `PastelVignette`**:
+- 思路:照色粉插画师的顺序画一张白底小像(空纸 → 铅笔起稿 → 背景的一枝叶子和很淡的铅笔小镇 → 平涂大块 → 塑形 → 毛 → 头发 → 五官 → 干笔高光和飞丝),画到边上就停:没有背景色块、没有边框,颜色在边上干笔散进白纸。
+ - 纸:白纸,直方图均衡过的纸纹 `T`(0–1 均匀分布),所以「色粉挂在纸纹高于 1 − 压力的地方」直接就是覆盖率;预先算好沿 8 个方向拖开的纸纹(存成 uint8),每一笔按自己的方向取,漏掉的纸坑顺着笔拉成短道。颜料缓冲 `F` 记录纸坑里已经有多少色粉,后面的层能压得深一点。空白纸上的纸纹只差 0.6%,白纸才干净。
+ - 一笔:中心线在方向场里积分出来(方向按 mod π 处理),带一点手腕的弧度。几万笔一次画完:Pillow 把每一笔的每一段按各自的序号画进 2 倍超采样的整数 id 图(每段略微加长,转弯处不缺口),numpy 对被盖住的子像素查回这一段,算出沿笔的位置(落笔重、收笔挑的压力曲线,两头收圆,不是尺子画的方头)和横向位置(两侧软边,加几道鬃毛条纹——笔越用越干,条纹越开),压力够得着的纸纹才挂上色粉,再用 bincount 汇回像素。同一批里最上面那笔说了算,层次靠多遍叠;一批太大就按 y 分成几条带(省内存)。
+ - 颜料:色粉近乎不透明:新 = 旧 + 覆盖 ×(目标 − 旧),目标 =(1 − opacity)× 旧 × 颜色 / 纸色 + opacity × 颜色。所以浅色的干笔能压在深色上(粉蓝上的白笔触),薄的一层只是染一下。
+ - 揉开:`wash()` 是用手指揉开的色粉(或一层薄水粉):平滑、不透明,颜色可以是一张场(按受光查色阶),最深的纸坑留一点浅,边缘在软边里按纸纹断开,不是矢量边;`model()` 给形状一个软穹顶光,按光把色阶揉上去(脸、毛的底色、大衣)。
+ - 散开:小像没有边框。大衣的揉色用一张平滑的渐隐场收掉(不要在边上断成纸纹白点),干笔在它下面再走一段,按渐隐场(`fade`)逐像素减压、变干,停在不同的地方;`ragged()` 给一块颜色一条低频游走的边(只在原形状附近游走,不会在远处长出孤岛)。
+ - 头发和毛:`strands()` 沿流向场画几百到几千根细丝,每根有自己的偏移和稳定的弯(`curl`),按光泽场从暗到亮分档,暗的先画;`lock=(根数, 宽)` 把它们分成一绺绺(同一绺共用起点区域、偏移、弯曲和明暗),头发才是卷成绺的,不是梳过的直线;少数不裁切、飞出轮廓。`fur()` 是一簇簇的毛:根部散开、尖端聚拢,背光一侧暗一点。`fluff()` 在轮廓里侧种短丝、往外长,颜色取它里面几 px 的颜料(受光一侧提亮一点),所以毛茸茸的边融进后面的东西。
+ - 五官:`eye()` 大圆眼:米白眼球、上眼皮下一层灰蓝的影子、深色虹膜(下半亮、外圈暗、有放射细纹)、瞳孔、上眼皮盖住一点虹膜、一道深色的软眼线在外眼角挑出去、很淡的双眼皮和下眼线、两点白高光;`blush()` 一大圈粉状腮红,越往外越只挂在纸纹上;`nose()` 鼻梁背光一侧一道软影子加红鼻尖和一点高光;`mouth()` 小嘴;`brow()` 一条软的色粉带加几根细毛。
+ - 收尾:`finish()` 只记参数、在 render 里加(每张阶段快照都和成品一致,要在画第一笔之前调用):轻微柔化、细颗粒、上了色的地方一点暖色,白纸不变。
+- 构造:`PastelVignette(W, H, seed, keep_stages=True, stages_dir=None)`(总像素不超过 4096²),先 `finish()` 再 `paper(tone, tooth)`。坐标是整张画布的像素;给方向场传一个数就是角度(度,0 向右、90 向下),方向场数组是弧度;`LIGHT` 是默认光(左上、略朝前)。
+- 遮罩:`poly(pts, smooth)`、`ellipse(cx, cy, rx, ry, rot)`、`blob(cx, cy, rx, ry, rough)`、`tube(path, w0, w1)`(`w0` 可以是一串沿路径的宽度;`tube_pts()` 给轮廓点)、`rect(x0, y0, x1, y1)`、`below(xs, ys, invert)` 返回画布大小的浮点遮罩;`ragged(mask, amp, scale, edge)` 给一块颜色一条没画完的干边。
+- 方向场:`flow(角度, 扰动, 尺度)`、`field(f(x, y) → 度)`、`radial(cx, cy, offset)`、`contour(mask, sigma, offset, fallback)`(只在形状附近算)、`blend(f1, f2, w)`(双倍角混合)、`rotate()`;`value(top, bottom, y0, y1)` 竖向的 0–1 场;`shading(mask, light, sigma, wrap)` 软穹顶的受光。
+- 笔触:`strokes(region, field, colour, length, width, density, pressure, opacity, alpha, streak, soft, taper, passes, clip, avoid, fade)`。`region` 是落笔概率遮罩或 (x0, y0, x1, y1);`colour` 给颜料、一串颜料(随机取)、(色阶, 场或 f(x, y)) 或 f(x, y) → (N, 3);`streak` 鬃毛条纹的强弱,`soft` 两侧软边占半宽的比例;`fade` 默认是区域^0.65,区域淡出的地方笔触变干、断开。`lines(paths, …)` 画给定的折线;`pencil(path, colour, width, alpha)` 很淡的铅笔线(几笔叠成、有的断开)。
+- 色层:`wash(mask, colour, alpha, grain, edge, dry, clip, opacity)`;`model(mask, colours, light, lit, sigma, wrap, gamma, lo, hi)` 返回受光场;`glaze(mask, colour, alpha, mode)`(multiply / screen / normal);`dab(x, y, r, colour, alpha, soft)` 一小点(高光);`line(path, width, colour, alpha, taper, dry)` 平滑的细圆笔线(眼线、胡子、软轮廓)。
+- 头发和毛:`strands(region, flow, colours 暗→亮, n, length, width, curl, jitter, shade, spread, alpha, clip, roots, lock)`(`flow` 是度数、弧度场或 f(x, y) → 度);`fur(region, field, colour, length, width, density, tuft, spread, curl, converge, side, light)`;`fluff(mask, length, n, width, out, field, alpha, lift, light)`。
+- 五官:`eye(cx, cy, rx, ry, iris, iris_light, iris_r, look, lid, lid_skin, line_colour, line_w, flick, lashes, crease, lower, rot, side)`(`side` 是外眼角朝哪边,`look` 取 -1..1);`brow(path, width, colour)`;`blush(cx, cy, rx, ry, colour, strength)`;`nose(x, y, size, side, tip, bridge, shade)`;`mouth(x, y, w, smile, colour, dark)`。
+- 植物:`leaf(base, tip, width, colours, bend)` 一片叶子(受光一侧浅、浅色叶脉、几笔干笔);`sprig(path, n, size, colours, width, round_, spread, fade)` 一枝带叶的枝条(`fade(y)` 让叶子往根部淡下去)。
+- 收尾:`finish(soft, grain, warmth)`;`render()`、`composite()`、`stage(name)`、`save(path, stages_dir)`;`save('x.jpg')` 默认 quality 88、4:4:4 色度。
+- 颜色用 `PAINTS` 里的名字(paper white chalk pencil pencil_light graphite;skin skin_light skin_pale skin_shade skin_deep blush nose lip lip_dark lid brow crease;eye_white eye_shade iris iris_light pupil amber amber_light olive_eye;hair_black hair_dark hair hair_blue hair_grey hair_light;powder_deep powder_shade powder powder_light powder_pale cream cream_shade cream_deep ivory;ginger_deep ginger_dark ginger orange tangerine apricot peach butter mustard fur_cream fur_white ear_pink;eucalyptus_deep eucalyptus eucalyptus_light sage olive ochre stem mist umber)或 '#rrggbb';色阶用 `RAMPS` 里的名字(skin neck powder cream ginger hair eucalyptus ochre mist,都是暗 → 亮)或自己给一串颜色。
+- 范例的场景脚本先把所有形状的遮罩算好(`plan()`),再按从前往后的遮挡算出每块「看得见的部分」(刘海 > 猫 > 脸 > 脖子 > 猫身后的那绺头发 > 毛衣 > 大衣 > 后面的头发),每一层只往自己看得见的部分上画;留着的 37 张画布大小的遮罩和受光场存成 float16。
+
**顺序**:都是先远后近、先大后小,文字最后叠加。水墨的雾要画在它该吞没的东西之后;水彩的叶梗要先画,并且只画在叶子外面。
## 三、毛病清单(都真实出现过)
@@ -2519,6 +2543,31 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask
| 换了一个参数,行生成器的随机序列整个变了,一栋房子正好挡住钟楼下半截 | 钟楼前面那一段(x 300–520)单独一行,压低高度、不出尖山墙 |
| 清理代码时修掉了一个把石块整体推出画面的坐标错误,石块露出来,每块明暗差 7%,在倒影下面成了棋盘格 | 石块明暗差 7% → 2.5%,缝的颜色接近石色(#a29f98),倒影下面才是一片湿石板 |
+**色粉小像**
+
+| 问题 | 改法 |
+|---|---|
+| 大衣上的笔触是一粒粒米、一道道雨:短、窄、一样宽,方头 | 笔的两头按沿笔位置收窄(落笔圆、收笔挑),宽度 18–34 px、长 70–180 px,两侧软边占半宽的 0.6,颜色只在受光色阶上下浮动(加一张 46 px 尺度的噪声),不是一深一浅地跳 |
+| `ragged()` 在大衣外面远处长出一个个蓝色孤岛 | 原来是把噪声加到模糊遮罩上再取阈值,遮罩是 0 的地方也会过线:改成阈值本身在 0.14–0.86 之间游走,边只在原形状附近摆动 |
+| 大衣下摆是一条撕纸边;改成渐隐后又成了一条白点的霜带;再把笔触往下拖,成了一道道往下流的颜料 | 揉开的底色用一张平滑的渐隐场收掉,边上少断成纸纹白点(平涂那层 `edge` 0.9 → 0.15,塑形那层 0.5);干笔的落笔区比底色多走约 45 px,按同一张渐隐场逐像素减压变干;下摆的笔触按衣摆的褶往中线斜(左半边从左上到右下、右半边从右上到左下,最多偏 32°),不再垂直往下 |
+| 大衣的深色笔触像一道道抓痕:亮的鬃毛条纹在深色上特别显 | 深色笔触加宽到 20–34 px、拉长到 90–180 px,软边 0.85,条纹 0.2,alpha 0.45 |
+| 猫身在她脖子前面是一块没有毛的橙色平涂 | 平涂、塑形、画毛用的遮罩不一致(平涂包括脖子那段,后面两步把它扣掉了):先按从前往后的遮挡把每块「看得见的部分」一次算好,每一层都只用它 |
+| 猫趴在她肩上像一条均匀的橙色长管(羽毛围巾),脖子是一根长长的粉色柱子 | 猫身改成从前面绕过她脖子:靠猫头的胸口和另一头的胯部粗(130 px),中间的肚子细(88 px)、往下垂;另一边加一只垂下来的后腿和爪子,和尾巴一起垂在大衣前面;脖子只露下巴下面一小段 |
+| 猫毛像刺猬:满身又亮又硬的细刺,轮廓一圈硬毛 | 先按受光色阶铺一层宽的软笔触(5–10 px、alpha 0.55),主体的细毛簇 alpha 0.5–0.55、密度 0.45–0.6;轮廓的 `fluff()` 定数量(头 900 根、身子 900 根)、alpha 0.45–0.5,颜色取它里面几 px 的颜料 |
+| 猫的眼睛上沿被一条橙色眼皮压平,像在生气;尾巴尖是平切的管子口 | 猫眼 `lid=0`,只留深色的眼眶;尾巴末端加一个圆,再铺奶白的毛尖 |
+| 头发是一顶头盔,中分;右半边额头一直秃到头顶 | 侧分:分缝右边补一片从分缝扫到太阳穴的头发;头发外轮廓按低频起伏推出去(振幅 12 px),下面是一绺绺的波浪 |
+| 刘海的下沿顺着脸的轮廓走,露出来的额头还是一个完整的蛋形 | 刘海的下沿横过额头:分缝那头高、远侧那头低,在眉毛上方 20–30 px 处斜着收过去 |
+| 头发是一根根梳过的平行细线 | `strands(lock=(14, 10))`:每 14 根一绺,共用起点区域、偏移、弯曲和明暗,下摆的流向按 sin 起伏 ±24° |
+| 头顶飞出来一把长直线,像划痕 | 头发边上的飞丝只留 50 根(刘海另 14 根),弯曲 2.0、偏移 20°、alpha 0.6 |
+| 睫毛是一把梳子;眼白一圈包着虹膜,像在瞪眼 | 不画单根睫毛,眼线在外眼角挑出去(`flick` 0.32–0.38);上眼皮盖住虹膜上沿(`lid` 0.12 → 0.2) |
+| 眉毛又细又碎、内高外低,一脸担心 | 眉毛先铺一条软的色粉带(宽 1.25 倍、alpha 0.35),再一条 0.7 倍宽的(alpha 0.55),细毛 40 → 24 根、alpha 0.7 → 0.45;眉峰放中间,内端不抬高 |
+| 腮红太淡太小,不是参考图那种「一大圈」 | 半径加到 60–76 px,强度 0.6 → 0.72 |
+| 她看起来像个小孩 | 眼睛放在圆脸里偏下就是小孩的比例:眼线挪到头的正中间(脸的局部坐标 v 20 → 2),下巴收窄变尖,眼睛小一圈,鼻子拉长;单靠变小眼睛不够 |
+| 鼻子只是一个红点 | `nose()` 加 `shade`:鼻梁背光一侧那道软影子从 0.28 加到 0.5,再加红鼻尖 |
+| 背后的铅笔小镇是一块灰色的污渍 | 灰色的揉色只留 0.16,往下、往两边淡掉,大部分只是铅笔线 |
+| 第二枝桉树枝和主枝交叉成一个 X;叶子排成一架梯子 | 去掉第二枝;叶子沿枝条的位置随机错开 ±0.3 个间距,角度的随机偏差 8° → 14°,大小 56–108 px |
+| 峰值内存 0.92 GB | 光栅化的子像素数组从 int64 / float64 改成 int32 / float32,一批笔的包围盒超过 250 万个子像素就按 y 分带;8 个方向的纸纹存成 uint8(66 MB → 17 MB);`contour()` 只在形状附近算;场景里留着的 37 张画布大小的遮罩和受光场一赋值就转成 float16:0.74–0.77 GB;和改之前的成品比,p99 差 0 级,只有猫头附近 1141 个像素差 10 级以上,看不出来 |
+
## 四、做成动画
- 各画风都有 `stage(name)` 和 `save(path, stages_dir)`,按阶段依次淡入叠化,就是「一幅画被逐步画出来」。README 里的动图就是这样做的。
@@ -2606,6 +2655,12 @@ from core import spline, curve, blob_pts, fbm1d, blur, polygon_mask
- 调色板:240 色中值切分,取样时末帧 ×3、饱和色 ×3(彩旗、玫瑰、红门)、暗色 ×2(墨线、玻璃、石板暗部),再加每段叠化中间一帧的样本;另从末帧误差超过 14 级的像素里切 15 色;最后 1 色是纯品红,当「和上一帧相同」的透明占位色。
- 固定 4×4 Bayer(约 ±2.4 级)。和屏上已显示颜色差不到 5 级(叠化帧)或 3 级(关键帧)的像素沿用上一帧,末帧精确发送;整帧都没变的叠化帧不单独发,时长并到上一帧。
- 结果:46 帧,14.75 秒,约 1.33 MB,按解码结果逐帧自检,末帧误差中位数 6、p99 27。颜色很多,255 色不够细,比暖调彩铅绘本的 p99 20 差一点,肉眼看不出。
+- 色粉小像的动图(脚本在 `workspace_projects/arte2/work/make_gif_pastelvignette.py`):
+ - 阶段:空白纸 → 铅笔起稿(人的轮廓、猫耳、肩膀,右边很淡的小镇)→ 桉树枝和小镇的一点灰 → 平涂大块 → 塑形(揉开的脸和脖子、头发的光泽、大衣的干笔和猫投下的影子、毛衣、猫的底色)→ 猫毛 → 一绺绺的头发 → 五官(眼、眉、腮红、鼻、嘴,猫的眼睛、鼻子和胡子)→ 成品(大衣受光处的浅色干笔、飞出来的头发、猫毛的亮尖)。每段 900 毫秒加 5 帧叠化,末帧停 2600 毫秒。
+ - 叠化一片片铺上去,和彩色小镇的做法一样:每个像素只在 5 帧中的约 2 帧里完成过渡,先后由柔和的低频噪声加从上往下的扫过决定。
+ - 调色板:第一帧是空白纸,只给 12 色;228 色只从和空白纸不同的像素里切(末帧 ×3、饱和色 ×3——橘猫、腮红、琥珀色的眼睛、赭黄的叶子,暗色 ×2——头发、瞳孔、眼线,浅粉蓝 ×1.5,大衣的软笔触才不出色带);再留 15 色,其中 3 个是强制的(最深的头发 / 瞳孔、纸白、猫的橘色),另外 12 色只从末帧误差超过 14 级的像素里切;最后 1 色是纯品红,当「和上一帧相同」的透明占位色。
+ - 固定 4×4 Bayer(约 ±2.4 级),末帧不加抖动、精确发送(差 0.5 级以上就重发)。和屏上已显示颜色差不到 5 级(叠化帧)或 3 级(关键帧)的像素沿用上一帧;整帧都没变的叠化帧不单独发,时长并到上一帧。
+ - 结果:40 帧,13.40 秒,约 0.54 MB,按解码结果逐帧自检(和应显示的画面最大差 0),末帧误差中位数 0、p99 14。四周大片是白纸,所以比满画面的画风小得多。
- 绘本角色动画的动图是真动画,不是阶段叠化:`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 遮罩按顺序显现。这个还没做成现成接口。
@@ -2689,6 +2744,7 @@ lib/canvasboard.py 白板卡片(保留式绘制:所有形状按白板坐
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);半透明的蜡混色与压光;软穹顶受光和照彩铅画家顺序的分层塑形:浅色底、固有色、同色系暗部、最深处、暖色和冷色罩染、交叉角度;漂移、等值线、放射方向场与双倍角混合;根部散开尖端聚拢、有亮面暗面的毛绺,整张毛皮,散开的草丛,树冠的叶簇;顺着表面的暖色发光笔触与带纸纹的提亮,亮灯的窗,提亮;镜像取样的横排线倒影、断开的涟漪圈;分别打光的团块树冠、小房子、石头、鳞片、野花、纸灯笼、雨衣小孩、点点眼和腮红;很淡的同色轮廓、几笔叠成的软线;轻微柔化、细颗粒、暖色暗角)
lib/colortown.py 彩色小镇(id 图光栅化的不透明色块:Pillow 按序号填多边形、2 倍超采样,numpy 查颜色 / 不透明度 / 纹理权重表、box 平均回像素;整张预算的竖向、横向笔刷条纹和擦笔纹理加低频斑驳,按块取权重,浅色少一点;边缘重采样后沿法线抖动;深棕半透明墨线:3 倍 id 图、带圆角接头的折线,分段变粗细,方框四边分开画、转角偶尔出头,按底色乘出深红棕或近黑;远近雾化与细线;把平摊布局贴到四边形上的透视单应;联排房子生成器:灰泥墙、裸石斑块、腰线、檐口、墙脚罩染和檐下阴影,门、带字招牌和条纹遮阳篷的店面、拱门,每扇略不同的窗(窗框、带反光的玻璃、窗棂、窗台、带横条的百叶窗、窗帘、圆窗和拱窗),溢出来的窗台花箱,铁艺阳台和花盆;一片片错缝铺、裁切、描缝的石板和赤陶瓦,曼莎、四坡、侧山墙、尖山墙,老虎窗、烟囱和烟囱帽、电视天线、风向标;带隅石、钟面、木百叶钟楼开口、洋葱顶、灯笼亭、尖顶和旗的钟楼;越往上越小的台阶、石墙、铁栏杆;杯形花瓣的爬藤玫瑰,按穹顶打光的叶簇树冠,花盆;抛物线下垂、带折痕的三角彩旗串;路灯和壁灯、吊挂店招、海报、咖啡桌、猫、不画脸的小人(伞、气球、花篮);透视石板、逐列镜像并竖向拖尾的湿街倒影、重描的石板缝和反光,把之后画的东西也倒映下来的 mirror;轻微柔化、细颗粒、暖色、淡暗角)
+lib/pastelvignette.py 色粉小像(直方图均衡的白纸纸纹与存成 uint8、沿 8 个方向拖开的纸纹,颜料缓冲;按段编号的 id 图光栅化:Pillow 把每一笔的每一段按序号画进 2 倍超采样的整数 id 图,numpy 查回这一段,算出沿笔压力曲线(两头收圆)、两侧软边和越干越开的鬃毛条纹,色粉只挂在压力够得着的纸纹上,bincount 汇回像素,大批按 y 分带;近乎不透明的色粉混色;揉开的平滑色层(按场取色、纸坑留浅、边缘按纸纹断开)和按软穹顶光取色阶的塑形;干边与不长孤岛的游走边、按渐隐场逐像素减压变干的散开;漂移、函数、放射、等值线(只在形状附近算)方向场与双倍角混合;按流向场积分、成绺(共用起点、偏移、弯曲和明暗)、暗先亮后的发丝和飞丝;根散尖聚、背光侧暗的毛簇;从轮廓里侧取色往外长的蓬松边;带灰蓝眼皮影、放射纹虹膜、外眼角挑出眼线和双高光的大圆眼,色粉带加细毛的眉毛,粉状大腮红,鼻梁软影加红鼻尖,小嘴;平滑的细圆笔线、几笔叠成的淡铅笔线;受光一侧浅、带浅色叶脉的叶子和带叶的枝条;轻微柔化、细颗粒、只上在颜色上的一点暖色)
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_pastelvignette_marmalade_scarf.gif b/examples/drawing_pastelvignette_marmalade_scarf.gif
new file mode 100644
index 0000000..c827f2f
Binary files /dev/null and b/examples/drawing_pastelvignette_marmalade_scarf.gif differ
diff --git a/examples/pastelvignette_marmalade_scarf.jpg b/examples/pastelvignette_marmalade_scarf.jpg
new file mode 100644
index 0000000..71440aa
Binary files /dev/null and b/examples/pastelvignette_marmalade_scarf.jpg differ
diff --git a/examples/pastelvignette_marmalade_scarf.py b/examples/pastelvignette_marmalade_scarf.py
new file mode 100644
index 0000000..1cdf70c
--- /dev/null
+++ b/examples/pastelvignette_marmalade_scarf.py
@@ -0,0 +1,449 @@
+"""Example (pastel vignette): 橘猫围巾 · The Marmalade Scarf -- a whimsical picture-book vignette in soft chalk pastel
+and a little gouache on white paper.
+
+A cold morning. A young woman in a powder-blue coat over a cream sweater wears her big fluffy ginger cat like a
+scarf: it lies round her neck, its head and front paws hanging over one shoulder, a hind paw and its striped tail
+down the other side of her coat. She has tilted her head toward it and looks at it sideways, smiling; the cat looks
+back up at her with round amber eyes. Long, dark blue-black wavy hair with a side-swept
+fringe, big round eyes, very rosy cheeks, a red-tipped nose. Behind them only a sprig of eucalyptus on one side and
+a faint pencil sketch of rooftops on the other; everything else is white paper, and the coat simply dissolves into
+it in dry strokes.
+
+Painted the way a pastel illustrator works: paper -> a light pencil sketch -> the sprig and the faint rooftops ->
+flat colour blocked in -> soft modelling (blended faces, dry directional strokes in the coat) -> the cat's fur ->
+the hair, lock by lock -> faces (eyes, cheeks, nose, mouth, whiskers) -> pale dry highlights and a few loose
+hairs. --stages writes those steps as snapshots for the draw-on. No image model.
+python3 pastelvignette_marmalade_scarf.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 core import blur, smoothstep, noise2d, fbm1d
+from pastelvignette import PastelVignette
+
+W, H = 1920, 1080
+HC = np.array([1000.0, 392.0]) # centre of her face
+TILT = np.deg2rad(-7.0) # head tilted toward the cat
+CS, SN = np.cos(TILT), np.sin(TILT)
+NOSE_C = (770.0, 640.0) # the cat's nose: its fur grows away from here
+
+
+def F(u, v):
+ """face-local (u right, v down, before the tilt) -> canvas"""
+ return (HC[0] + u * CS - v * SN, HC[1] + u * SN + v * CS)
+
+
+def FL(pts):
+ return [F(u, v) for u, v in pts]
+
+
+def to_local(x, y):
+ dx, dy = x - HC[0], y - HC[1]
+ return dx * CS + dy * SN, -dx * SN + dy * CS
+
+
+def wavy(pts, amp, wl=6, seed=0):
+ """a closed outline resampled and pushed in and out a little (hair, fur masses are never smooth ovals)"""
+ P = np.asarray(pts, np.float32)
+ Q = np.vstack([P, P[:1]])
+ d = np.r_[0, np.cumsum(np.linalg.norm(np.diff(Q, axis=0), axis=1))]
+ s = np.linspace(0, d[-1], 240, endpoint=False)
+ R = np.stack([np.interp(s, d, Q[:, 0]), np.interp(s, d, Q[:, 1])], 1)
+ Tg = np.roll(R, -1, 0) - np.roll(R, 1, 0); Tg /= np.linalg.norm(Tg, axis=1, keepdims=True) + 1e-6
+ Nn = np.stack([Tg[:, 1], -Tg[:, 0]], 1)
+ return R + Nn * (amp * fbm1d(240, 240 / wl, 3, seed))[:, None]
+
+
+class Scene:
+ def __init__(self, p):
+ self.p = p
+ self.plan()
+
+ def __setattr__(self, k, v):
+ # some forty canvas-sized masks and light fields are kept: float16 is plenty for 0..1 coverage and halves
+ # them, which keeps the peak well under 1 GB
+ if isinstance(v, np.ndarray) and v.dtype == np.float32 and v.shape == (H, W):
+ v = v.astype(np.float16)
+ object.__setattr__(self, k, v)
+
+ # ------------------------------------------------------------------ shapes, planned before any paint
+ def plan(self):
+ p = self.p
+ # adult proportions: the eye line near the middle of the head, a narrower jaw and a small pointed chin
+ self.face = p.poly(FL([(-8, -176), (-80, -162), (-126, -122), (-146, -58), (-146, 8), (-134, 62), (-110, 112),
+ (-76, 152), (-40, 176), (-6, 186), (28, 178), (72, 152), (112, 108), (142, 46),
+ (152, -24), (146, -96), (108, -150), (52, -174)]), smooth=True)
+ self.neck = p.tube([F(-10, 140), (996, 600), (998, 700)], [96, 104, 116])
+ crown = FL([(-196, 40), (-200, -50), (-178, -132), (-118, -196), (-36, -224), (52, -222), (124, -198),
+ (174, -140), (194, -60), (198, 40)])
+ falls = [(1214, 470), (1236, 516), (1226, 562), (1250, 612), (1270, 652), (1254, 700), (1262, 738), (1222, 772),
+ (1180, 752), (1140, 700), (1090, 650),
+ (1000, 628), (910, 640), (856, 640), (826, 590), (812, 520)]
+ self.hairm = p.poly(wavy(crown + falls, 12, 11, seed=3))
+ # a side-swept fringe: from the parting it crosses the forehead, lower on the far side
+ self.fringe = p.poly(wavy(FL([(48, -218), (-30, -218), (-104, -194), (-160, -134), (-188, -52), (-184, 30),
+ (-160, 76), (-150, 12), (-128, -26), (-94, -54), (-46, -72), (6, -86),
+ (58, -104), (104, -124), (136, -150), (104, -194), (66, -212)]), 5, 9, seed=4))
+ self.temple = np.maximum(
+ p.tube(FL([(60, -206), (122, -178), (162, -110), (176, -30), (172, 50)]), [44, 52, 50, 44, 30]),
+ p.poly(wavy(FL([(40, -224), (112, -208), (166, -162), (188, -80), (182, 4), (162, -32), (148, -92),
+ (116, -128), (72, -142), (42, -152)]), 3, 6, seed=5)))
+ self.lock = p.tube([(1176, 470), (1200, 560), (1190, 640), (1204, 700)], [62, 66, 60, 56])
+ # the cat: head with a cheek ruff, ears, the body wrapped round the front of her neck (thick at the chest
+ # and the haunch, a narrower sagging belly), front legs on one side, a hind leg and the tail on the other
+ hd = p.poly(wavy([(768 + 116 * np.cos(t), 604 + 98 * np.sin(t)) for t in np.linspace(0, 2 * np.pi, 40,
+ endpoint=False)], 4, 8, 5))
+ ruff = np.maximum(p.ellipse(700, 652, 74, 52, -14), p.ellipse(838, 652, 74, 52, 14))
+ self.cat_head = np.maximum(hd, ruff)
+ self.ears = np.maximum(p.poly([(672, 548), (664, 482), (680, 452), (708, 470), (742, 518)], smooth=True),
+ p.poly([(796, 514), (836, 466), (862, 452), (874, 484), (864, 548)], smooth=True))
+ self.inner_ears = np.maximum(p.poly([(686, 530), (682, 486), (692, 470), (712, 490), (726, 518)], smooth=True),
+ p.poly([(814, 510), (840, 480), (855, 472), (860, 494), (850, 530)], smooth=True))
+ self.cat_body = p.poly(wavy(p.tube_pts([(716, 690), (850, 712), (970, 724), (1070, 714), (1160, 690),
+ (1222, 668)], [130, 104, 88, 92, 118, 130]), 6, 16, seed=7))
+ self.haunch = p.poly(wavy([(1130, 640), (1186, 606), (1250, 618), (1290, 664), (1282, 716), (1220, 728),
+ (1150, 712)], 5, 6, seed=6), smooth=False)
+ self.legs = np.maximum.reduce([p.tube([(732, 690), (738, 760), (744, 824)], [54, 48, 46]),
+ p.tube([(806, 698), (812, 772), (816, 834)], [54, 48, 46]),
+ p.tube([(1170, 700), (1176, 770), (1180, 818)], [62, 48, 44])])
+ self.paws = np.maximum.reduce([p.ellipse(745, 834, 29, 21), p.ellipse(817, 842, 29, 21),
+ p.ellipse(1182, 828, 28, 20)])
+ self.tail_path = [(1240, 700), (1268, 780), (1258, 866), (1230, 940), (1240, 1006)]
+ self.tail = np.maximum(p.tube(self.tail_path, [66, 64, 60, 56, 44]), p.ellipse(1240, 1004, 22, 24))
+ self.muzzle = np.maximum(np.maximum(p.ellipse(752, 652, 30, 22), p.ellipse(790, 652, 30, 22)),
+ p.ellipse(771, 676, 28, 18))
+ self.cat_front = np.clip(np.maximum.reduce([self.cat_head, self.ears, self.legs, self.paws]), 0, 1)
+ self.cat = np.clip(np.maximum.reduce([self.cat_front, self.cat_body, self.haunch, self.tail]), 0, 1)
+ # clothes: a torso and two sleeves; the coat fades out toward the bottom in dry strokes
+ torso = p.poly([(950, 640), (870, 660), (790, 700), (760, 760), (750, 1100), (1290, 1100), (1278, 760),
+ (1240, 700), (1150, 664), (1050, 640)], smooth=False)
+ arm_l = p.tube([(782, 706), (734, 830), (716, 960), (712, 1100)], [120, 150, 156, 160])
+ arm_r = p.tube([(1250, 702), (1300, 830), (1318, 960), (1324, 1100)], [120, 150, 156, 160])
+ self.arms = np.maximum(arm_l, arm_r)
+ coat = np.clip(np.maximum.reduce([torso, arm_l, arm_r]), 0, 1)
+ self.coat_raw = coat
+ xs = np.arange(W, dtype=np.float32)
+ edge_y = 950 + 44 * fbm1d(W, 260, 3, 11) + 0.04 * np.abs(xs - 1010)
+ self.fade_b = smoothstep(edge_y[None] + 80, edge_y[None] - 70, p.YY).astype(np.float32)
+ self.fade_w = smoothstep(edge_y[None] + 30, edge_y[None] - 110, p.YY).astype(np.float32)
+ self.coat = blur(coat, 2.5) * self.fade_w
+ self.sweater = p.poly([(950, 650), (1054, 650), (1084, 704), (1062, 840), (1030, 1000), (990, 1000),
+ (952, 840), (924, 704)], smooth=True) * self.fade_w
+ # visible parts (front to back): the fringe, the cat, the face, the neck, the lock of hair behind the cat,
+ # the sweater, the coat, the hair behind
+ self.v_cat = self.cat * (1 - self.fringe)
+ self.v_face = self.face * (1 - self.fringe) * (1 - self.temple)
+ self.v_neck = self.neck * (1 - self.face) * (1 - self.cat)
+ self.v_lock = self.lock * (1 - self.cat) * (1 - self.face)
+ self.v_sweater = self.sweater * (1 - self.cat) * (1 - self.neck)
+ self.v_coat = self.coat * (1 - self.cat) * (1 - self.sweater) * (1 - self.neck)
+ self.v_hair = self.hairm * (1 - self.face) * (1 - self.neck) * (1 - self.cat) * (1 - coat) * (1 - self.lock)
+ self.front_hair = np.clip(self.fringe + self.temple, 0, 1)
+
+ # ------------------------------------------------------------------ hair flow (degrees)
+ def hair_flow(self, x, y):
+ x = np.asarray(x, np.float32); y = np.asarray(y, np.float32)
+ u, v = to_local(x, y)
+ cu, cv = 30.0, 40.0 # centre of the sweep, below the parting
+ ru, rv = u - cu, v - cv
+ left = np.arctan2(-ru, rv) # tangent (rv, -ru): sweeping to the left and down
+ right = np.arctan2(ru, -rv) # tangent (-rv, ru): to the right and down
+ w = smoothstep(30.0, 66.0, u)
+ a_sweep = 0.5 * np.arctan2((1 - w) * np.sin(2 * left) + w * np.sin(2 * right),
+ (1 - w) * np.cos(2 * left) + w * np.cos(2 * right)) + TILT
+ fall = np.deg2rad(90 + 24 * np.sin((y - 420) / 40.0 + x / 60.0) + 0.05 * (x - 1000))
+ g = np.clip(smoothstep(380, 480, y) * smoothstep(120, 165, np.abs(u)) + smoothstep(560, 620, y), 0, 1)
+ c = (1 - g) * np.cos(2 * a_sweep) + g * np.cos(2 * fall)
+ s = (1 - g) * np.sin(2 * a_sweep) + g * np.sin(2 * fall)
+ a = 0.5 * np.arctan2(s, c)
+ # keep the direction pointing along the sweep / downward (not flipped by the doubled-angle blend)
+ ref = np.where(g > 0.5, fall, np.where(w > 0.5, right, left) + TILT)
+ flip = np.cos(a - ref) < 0
+ return np.degrees(np.where(flip, a + np.pi, a))
+
+ # ------------------------------------------------------------------ 1. pencil sketch
+ def sketch(self):
+ p = self.p
+ r = np.random.default_rng(5)
+ pl = lambda pts, w=1.5, a=0.5, **kw: p.pencil(pts, 'pencil_light', w, a, seed=int(r.integers(1 << 30)), **kw)
+ # faint rooftops on the right
+ for (x0, x1, yb, h, roof) in [(1380, 1462, 780, 150, 'gable'), (1470, 1530, 790, 220, 'flat'),
+ (1630, 1712, 776, 170, 'gable'), (1712, 1768, 786, 110, 'flat')]:
+ yt = yb - h
+ pl([(x0, yb + 10), (x0, yt)]); pl([(x1, yb + 6), (x1, yt)])
+ if roof == 'gable':
+ pl([(x0 - 8, yt + 4), ((x0 + x1) / 2, yt - 42), (x1 + 8, yt + 4)], smooth=False)
+ pl([(x0 + 12, yt - 10), (x0 + 12, yt - 34), (x0 + 22, yt - 34), (x0 + 22, yt - 18)], 1.2, 0.4,
+ smooth=False)
+ else:
+ pl([(x0 - 6, yt), (x1 + 6, yt)])
+ for wy in np.arange(yt + 22, yb - 26, 36):
+ for wx in np.linspace(x0 + 14, x1 - 28, max(1, int((x1 - x0) / 38))):
+ if r.random() < 0.6:
+ pl([(wx, wy), (wx + 12, wy), (wx + 12, wy + 18), (wx, wy + 18), (wx, wy)], 1.2, 0.38,
+ smooth=False, gaps=0.3, seg=(18, 36), wobble=0.4)
+ tx = 1580
+ pl([(tx - 38, 790), (tx - 38, 540)]); pl([(tx + 38, 790), (tx + 38, 540)])
+ pl([(tx - 46, 540), (tx - 38, 494), (tx - 18, 466), (tx, 458), (tx + 18, 466), (tx + 38, 494), (tx + 46, 540)])
+ pl([(tx, 458), (tx, 424)], 1.3, 0.45)
+ for wy in (590, 650, 710):
+ pl([(tx - 9, wy), (tx - 9, wy - 24), (tx, wy - 32), (tx + 9, wy - 24), (tx + 9, wy)], 1.2, 0.4)
+ pl([(1360, 800), (1500, 806), (1640, 798), (1790, 804)], 1.4, 0.4)
+ # the figure, very lightly (most of it is painted over)
+ for path in (FL([(-146, 8), (-134, 62), (-110, 112), (-76, 152), (-40, 176), (-6, 186), (28, 178),
+ (72, 152), (112, 108), (142, 46), (152, -24)]),
+ [(770, 712), (730, 830), (708, 960)], [(1262, 708), (1306, 830), (1326, 960)],
+ [(680, 600), (664, 482), (680, 452), (708, 470), (742, 518), (800, 512), (836, 466),
+ (862, 452), (874, 484), (864, 548), (884, 620)],
+ FL([(-196, 40), (-200, -50), (-178, -132), (-118, -196), (-36, -224), (52, -222), (124, -198),
+ (174, -140), (194, -60), (198, 40)])):
+ p.pencil(path, 'pencil', 1.5, 0.35, seed=int(r.integers(1 << 30)))
+
+ # ------------------------------------------------------------------ 2. background
+ def background(self):
+ p = self.p
+ # a breath of grey behind the rooftops, fading downward and to the sides
+ city = np.maximum.reduce([p.rect(1380, 640, 1462, 790), p.rect(1470, 570, 1530, 800), p.rect(1542, 470, 1618, 800),
+ p.rect(1630, 610, 1712, 786)])
+ fade = smoothstep(830, 660, p.YY) * smoothstep(1780, 1660, p.XX) * smoothstep(1370, 1430, p.XX)
+ cw = p.ragged(city, amp=18, scale=50, seed=7) * fade
+ p.wash(cw, 'mist', 0.16, grain=0.7, edge=1.0, dry=0.5)
+ # a sprig of eucalyptus on the left, dissolving toward its foot
+ fade_y = lambda y: float(np.clip((990 - y) / 300, 0.2, 1))
+ p.sprig([(690, 800), (640, 660), (590, 540), (548, 430), (520, 330), (508, 270)], n=13, size=(56, 108),
+ colours=('eucalyptus', 'eucalyptus', 'ochre', 'eucalyptus'), width=5.0, round_=0.8, spread=58,
+ fade=fade_y, seed=12)
+
+ # ------------------------------------------------------------------ 3. flat colour
+ def block(self):
+ p = self.p
+ p.wash(self.v_hair, 'hair_dark', 1.0, grain=0.2, edge=0.6)
+ p.wash(self.v_coat, 'powder', 1.0, grain=0.4, edge=0.15)
+ p.wash(self.v_sweater, 'cream', 1.0, grain=0.3, edge=0.6)
+ p.wash(self.v_neck, 'skin', 1.0, grain=0.15, edge=0.3)
+ p.wash(self.v_face, 'skin', 1.0, grain=0.15, edge=0.3)
+ p.wash(self.v_cat, 'ginger', 1.0, grain=0.25, edge=0.6)
+ p.wash(self.front_hair, 'hair_dark', 1.0, grain=0.2, edge=0.5)
+ p.wash(self.v_lock, 'hair_dark', 1.0, grain=0.2, edge=0.6)
+
+ # ------------------------------------------------------------------ 4. modelling
+ def model(self):
+ p = self.p
+ # face: a blended dome, warm at the rim, pale at the centre; soft strokes that wrap round it
+ self.face_lit = p.model(self.v_face, 'skin', sigma=46, lo=0.1, hi=1.0, gamma=0.85, grain=0.15, edge=0.3)
+ p.strokes(self.v_face, p.contour(self.face, 20, fallback=-60), ('skin', np.clip(self.face_lit * 0.9 + 0.08, 0, 1)),
+ (24, 54), (7, 13), 0.45, pressure=0.6, opacity=0.8, alpha=0.3, streak=0.3, clip=self.v_face, seed=31)
+ p.glaze(blur(self.front_hair, 12) * self.v_face, '#d89a8e', 0.4, 'multiply')
+ # neck: in shadow under the chin
+ p.model(self.v_neck, 'neck', sigma=24, lo=0.05, hi=0.7, grain=0.15, edge=0.3)
+ sh = blur(np.roll(self.face, 26, axis=0), 12) * self.v_neck
+ p.glaze(sh, '#b9786c', 0.5, 'multiply')
+ # hair masses: dark, a faint sheen on the crown
+ p.model(self.v_hair, 'hair', lit=p.shading(self.hairm, sigma=60), lo=0.0, hi=0.6, grain=0.2, edge=0.6)
+ p.model(self.front_hair, 'hair', lit=p.shading(self.front_hair, sigma=30), lo=0.05, hi=0.75, grain=0.2, edge=0.5)
+ p.model(self.v_lock, 'hair', lit=p.shading(self.lock, sigma=20), lo=0.0, hi=0.6, grain=0.2, edge=0.6)
+ # coat: blended under-colour, the sleeves rounder and darker at their inner edge, broad dry strokes that
+ # wrap the shoulders and fall down the sleeves and the front
+ cl = np.clip(0.55 * p.shading(self.coat_raw, sigma=70) + 0.45 * p.shading(self.arms, sigma=40), 0, 1)
+ self.coat_lit = cl
+ p.model(self.v_coat, 'powder', lit=cl, lo=0.15, hi=0.95, grain=0.4, edge=0.5)
+ # the cat and the hair cast a soft shadow on the coat and the sweater
+ cast = blur(np.roll(np.roll(np.clip(self.cat + self.hairm * 0.6, 0, 1), 14, axis=0), 8, axis=1), 14)
+ p.glaze(cast * (1 - self.cat) * np.clip(self.v_coat + self.v_sweater, 0, 1), '#7f93b8', 0.35, 'multiply')
+ seam = blur(self.arms, 8) * (1 - blur(self.arms, 8)) * 4 * self.v_coat
+ p.glaze(seam * smoothstep(690, 760, p.YY), '#8ea4c6', 0.45, 'multiply')
+ drape = p.field(lambda x, y: -90 + np.clip((x - 1010) / 260, -1, 1) * 32)
+ fld = p.blend(p.contour(self.coat_raw, 30, fallback=-80), p.blend(p.flow(-82, 12, 260, seed=3), drape,
+ smoothstep(820, 960, p.YY)), np.clip(smoothstep(740, 860, p.YY) + self.arms * 0.6, 0, 1))
+ self.coat_field = fld
+ av = np.clip(self.cat + self.sweater + self.neck + self.lock, 0, 1)
+ region = self.coat_raw * self.fade_b
+ var = np.clip(cl + 0.55 * (noise2d(H, W, 46, 2, 17) - 0.5), 0, 1)
+ dry = np.clip(self.fade_b * 1.3, 0, 1)
+ p.strokes(region, fld, ('powder', var), (70, 150), (18, 34), 0.9, pressure=0.76, alpha=0.75, streak=0.35,
+ avoid=av, fade=dry, clip=self.coat_raw, seed=41)
+ p.strokes(region * smoothstep(0.5, 0.15, cl), fld, ('powder_shade', 'powder_deep'), (90, 180), (20, 34),
+ 0.55, pressure=0.7, alpha=0.45, streak=0.2, soft=0.85, avoid=av, fade=dry, clip=self.coat_raw,
+ seed=42)
+ # sweater: cream, ribbed
+ sl = p.shading(self.sweater, sigma=24)
+ p.model(self.v_sweater, 'cream', lit=sl, lo=0.12, hi=0.95, grain=0.3, edge=0.6)
+ p.strokes(self.v_sweater, 90, ('cream', np.clip(sl * 0.8 + 0.1, 0, 1)), (40, 90), (6, 10), 0.8, pressure=0.7,
+ alpha=0.5, streak=0.4, seed=43)
+ ribs = [[(x, 700), (x + (x - 1004) * 0.04, 840), (x + (x - 1004) * 0.1, 990)] for x in np.arange(936, 1086, 17)]
+ p.lines(ribs, 'cream_shade', (4.0, 6.0), 0.55, 0.5, 0.22, clip=self.v_sweater, streak=0.5, seed=44)
+ # cat: blended dome under-colour, cream muzzle and paws, pink inner ears
+ self.cat_lit_head = p.model(np.clip(self.cat_head + self.ears, 0, 1) * (1 - self.fringe), 'ginger', sigma=36,
+ lo=0.12, hi=0.9, grain=0.25, edge=0.6)
+ body = np.clip(self.cat_body + self.haunch + self.legs, 0, 1) * (1 - self.cat_head) * self.v_cat
+ self.cat_lit_body = p.model(body, 'ginger', sigma=30, lo=0.1, hi=0.85, grain=0.25, edge=0.6)
+ self.cat_lit_tail = p.model(self.tail * self.v_cat, 'ginger', sigma=16, lo=0.12, hi=0.88, grain=0.25, edge=0.6)
+ p.model(blur(self.muzzle, 4), 'cream', sigma=12, lo=0.3, hi=1.0, grain=0.2, edge=0.5)
+ p.model(blur(self.paws, 3), 'cream', sigma=10, lo=0.3, hi=1.0, grain=0.2, edge=0.5)
+ tip = self.tail * smoothstep(940, 990, p.YY)
+ p.wash(blur(tip, 6), 'fur_cream', 0.9, grain=0.2, edge=0.5)
+ p.wash(blur(self.inner_ears, 2.5), 'ear_pink', 0.85, grain=0.3, edge=0.5)
+
+ # ------------------------------------------------------------------ 5. the cat's fur
+ def fur(self):
+ p = self.p
+ head = self.cat_head * (1 - self.fringe)
+ rad = p.radial(*NOSE_C, turb=10, scale=60, seed=51)
+ lit = self.cat_lit_head
+ # soft, broad fur strokes first (the pastel), then fine locks on top
+ p.strokes(head * (1 - self.muzzle), rad, ('ginger', np.clip(lit, 0, 1)), (16, 34), (5, 9), 1.0,
+ pressure=0.7, alpha=0.55, streak=0.5, taper=(0.7, 0.05), seed=50)
+ p.fur(head * smoothstep(0.5, 0.15, lit), rad, ('ginger_dark',), (14, 26), (1.4, 2.0), 0.55, alpha=0.5,
+ seed=52)
+ p.fur(head * (1 - self.muzzle), rad, ('ginger', 'orange', 'tangerine'), (14, 28), (1.2, 1.9), 0.6, alpha=0.55,
+ seed=53)
+ p.fur(head * smoothstep(0.5, 0.85, lit) * (1 - self.muzzle), rad, ('apricot', 'peach'), (12, 22), (1.1, 1.6),
+ 0.5, alpha=0.55, seed=54)
+ # forehead stripes: a few darker tufts
+ for (sx, sy, a) in [(752, 552, 100), (771, 546, 90), (790, 552, 80), (730, 564, 118), (812, 564, 62)]:
+ p.fur(p.ellipse(sx, sy, 6, 20, a), a, 'ginger_deep', (14, 22), (1.6, 2.2), 1.6, tuft=(4, 8), alpha=0.6,
+ seed=int(sx + sy))
+ p.fur(self.muzzle, rad, ('fur_cream', 'fur_white'), (8, 16), (1.0, 1.5), 0.8, alpha=0.6, seed=55)
+ ef = p.flow(-90, 20, 40, seed=56)
+ p.fur(self.ears * (1 - self.inner_ears), ef, ('ginger', 'tangerine'), (10, 18), (1.2, 1.8), 0.8, alpha=0.6,
+ seed=57)
+ p.strands(self.inner_ears, lambda x, y: -90 + (x - 770) * 0.6, ('fur_cream', 'fur_white'), n=50,
+ length=(12, 26), width=(0.9, 1.3), clip=False, alpha=0.7, seed=58)
+ # body across her shoulders, legs, haunch: fur follows the body, then the legs down
+ body = np.clip(self.cat_body + self.haunch + self.legs, 0, 1) * (1 - self.cat_head) * self.v_cat
+ bf = p.blend(p.flow(178, 15, 120, seed=59), p.flow(95, 8, 80, seed=60), np.clip(self.legs, 0, 1))
+ bl = self.cat_lit_body
+ p.strokes(body, bf, ('ginger', np.clip(bl, 0, 1)), (20, 44), (5, 10), 1.0, pressure=0.7, alpha=0.55,
+ streak=0.5, taper=(0.7, 0.05), seed=60)
+ p.fur(body * smoothstep(0.5, 0.15, bl), bf, ('ginger_dark',), (16, 30), (1.4, 2.0), 0.55, alpha=0.5, seed=61)
+ p.fur(body, bf, ('ginger', 'orange', 'tangerine'), (16, 32), (1.2, 1.9), 0.6, alpha=0.55, seed=62)
+ p.fur(body * smoothstep(0.5, 0.85, bl), bf, ('apricot', 'peach'), (14, 26), (1.1, 1.6), 0.5, alpha=0.55, seed=63)
+ p.fur(self.paws, 90, ('fur_cream', 'fur_white'), (8, 14), (1.0, 1.5), 1.0, alpha=0.6, seed=64)
+ for (x, y) in [(736, 846), (752, 848), (808, 854), (824, 856)]:
+ p.line([(x, y - 9), (x + 1, y + 2)], 1.5, 'cream_deep', 0.5, taper=(0.4, 0.4))
+ # tail: fur along it, darker rings, a cream tip
+ tl = self.tail * self.v_cat
+ tfield = p.field(lambda x, y: 95 + 12 * np.sin(y / 60.0))
+ p.strokes(tl * (1 - smoothstep(940, 990, p.YY)), tfield, ('ginger', np.clip(self.cat_lit_tail, 0, 1)), (20, 40),
+ (5, 10), 1.0, pressure=0.7, alpha=0.55, streak=0.5, taper=(0.7, 0.05), seed=64)
+ for yb in (752, 826, 898):
+ ring = tl * smoothstep(yb - 14, yb, p.YY) * smoothstep(yb + 24, yb + 6, p.YY)
+ p.strokes(ring, tfield, 'ginger_dark', (16, 28), (5, 8), 1.4, pressure=0.7, alpha=0.5, streak=0.5, seed=yb)
+ p.fur(ring, tfield, ('ginger_dark', 'ginger_deep'), (14, 24), (1.3, 1.9), 0.9, alpha=0.5, seed=yb + 1)
+ p.fur(tl * (1 - smoothstep(940, 990, p.YY)), tfield, ('ginger', 'orange', 'tangerine'), (16, 30), (1.2, 1.8),
+ 0.6, alpha=0.5, seed=65)
+ p.fur(tl * smoothstep(0.5, 0.85, self.cat_lit_tail), tfield, ('apricot', 'peach'), (12, 24), (1.1, 1.6), 0.45,
+ alpha=0.5, seed=66)
+ p.fur(tl * smoothstep(950, 985, p.YY), tfield, ('fur_cream', 'fur_white'), (12, 22), (1.1, 1.6), 1.0, alpha=0.6,
+ seed=67)
+ # a fluffy silhouette everywhere the cat meets something else
+ light = p.LIGHT
+ bm = np.clip(self.cat_body + self.haunch, 0, 1) * (1 - self.cat_head) * self.v_cat
+ p.fluff(head, (10, 24), n=900, width=(1.1, 1.7), out=0.75, field=rad, light=light, alpha=0.5, curl=8, seed=68)
+ p.fluff(bm, (10, 22), n=900, width=(1.0, 1.6), out=0.55, field=bf, light=light, alpha=0.45, curl=8, seed=69)
+ p.fluff(tl, (10, 22), n=520, width=(1.0, 1.6), out=0.55, field=tfield, light=light, alpha=0.5, curl=8, seed=70)
+ p.fluff(self.legs * (1 - self.cat_head), (8, 14), n=300, width=(1.0, 1.4), out=0.5, field=90, light=light,
+ alpha=0.45, curl=8, seed=71)
+
+ # ------------------------------------------------------------------ 6. her hair
+ def hair(self):
+ p = self.p
+ fl = self.hair_flow
+ cols = ('hair_black', 'hair_dark', 'hair', 'hair_blue', 'hair_grey')
+ sheen = np.clip(p.shading(self.hairm, sigma=60) * 0.85 + 0.05, 0, 1)
+ p.strands(self.v_hair, fl, cols[:3], n=1600, length=(70, 220), width=(1.6, 2.8), shade=sheen, spread=0.3,
+ curl=0.4, jitter=5, alpha=0.8, lock=(14, 10), seed=81)
+ p.strands(self.v_hair, fl, cols[2:], n=700, length=(60, 180), width=(1.0, 1.8), shade=sheen, spread=0.22,
+ curl=0.4, jitter=5, alpha=0.7, lock=(10, 7), seed=82)
+ ls = np.clip(p.shading(self.lock, sigma=18) * 0.9 + 0.05, 0, 1)
+ p.strands(self.v_lock, fl, cols[:4], n=520, length=(60, 180), width=(1.3, 2.4), shade=ls, spread=0.3,
+ curl=0.3, jitter=4, alpha=0.85, lock=(12, 8), seed=83)
+ fs = np.clip(p.shading(self.front_hair, sigma=30) * 0.9 + 0.05, 0, 1)
+ p.strands(self.front_hair, fl, cols[:3], n=1100, length=(70, 240), width=(1.4, 2.6), shade=fs, spread=0.3,
+ curl=0.2, jitter=4, alpha=0.85, lock=(14, 9), seed=84)
+ p.strands(self.front_hair, fl, cols[2:], n=460, length=(70, 220), width=(1.0, 1.7), shade=fs, spread=0.22,
+ curl=0.2, jitter=4, alpha=0.75, lock=(10, 6), seed=85)
+
+ # ------------------------------------------------------------------ 7. faces
+ def faces(self):
+ p = self.p
+ # a soft warm contour on the shadow side of her face and under the chin
+ p.line(FL([(150, -20), (144, 40), (120, 100), (80, 148), (32, 178), (-6, 188), (-44, 178)]), 2.4, 'skin_deep',
+ 0.35, taper=(0.5, 0.5), dry=0.4)
+ p.brow(FL([(-106, -46), (-82, -57), (-50, -54)]), 10, 'brow', 0.9, seed=91)
+ p.brow(FL([(14, -52), (52, -62), (90, -53)]), 11, 'brow', 0.9, seed=92)
+ look = (-0.6, 0.12)
+ p.eye(*F(-70, 2), 28, 33, look=look, iris_r=0.72, lid=0.2, rot=-7, side=-1, lashes=0, flick=0.32)
+ p.eye(*F(46, 2), 34, 37, look=look, iris_r=0.72, lid=0.2, rot=-7, side=1, lashes=0, flick=0.38)
+ p.blush(*F(-94, 78), 60, 50, 'blush', 0.72)
+ p.blush(*F(70, 80), 76, 62, 'blush', 0.72)
+ p.nose(*F(-26, 80), 17, side=1, alpha=1.1, bridge=78, shade=0.5)
+ p.mouth(*F(-18, 128), 34, 0.6)
+ # the cat's face
+ look_c = (0.38, -0.3)
+ for (x, y, sd) in ((726, 598, -1), (812, 596, 1)):
+ p.eye(x, y, 23, 24, iris='amber', iris_light='amber_light', iris_r=0.78, look=look_c, lid=0.0,
+ lid_skin='ginger', line_colour='#5a2a16', line_w=3.2, flick=0.0, lashes=0, crease=0, lower=0.3,
+ side=sd)
+ nose = p.poly([(758, 632), (782, 632), (770, 646)], smooth=True)
+ p.wash(blur(nose, 1.2), '#d77d78', 0.95, grain=0.1, edge=0.2)
+ p.line([(770, 646), (770, 656)], 1.8, '#7a3a2c', 0.7)
+ p.line([(770, 656), (762, 662), (754, 660)], 1.8, '#7a3a2c', 0.6, taper=(0.3, 0.5))
+ p.line([(770, 656), (778, 662), (786, 660)], 1.8, '#7a3a2c', 0.6, taper=(0.3, 0.5))
+ p.blush(742, 652, 22, 16, 'blush', 0.22)
+ p.blush(800, 652, 22, 16, 'blush', 0.22)
+ r = np.random.default_rng(93)
+ for sgn, x0 in ((-1, 742), (1, 798)):
+ for k in range(3):
+ y0 = 652 + k * 7
+ L = r.uniform(60, 86)
+ ang = np.deg2rad((180 if sgn < 0 else 0) + sgn * (8 - k * 10))
+ pts = [(x0, y0), (x0 + np.cos(ang) * L * 0.5, y0 + np.sin(ang) * L * 0.5 + 2),
+ (x0 + np.cos(ang) * L, y0 + np.sin(ang) * L + 8)]
+ p.line(pts, 1.4, 'fur_white', 0.7, taper=(0.1, 0.9))
+
+ # ------------------------------------------------------------------ 8. last touches
+ def highlights(self):
+ p = self.p
+ av = np.clip(self.cat + self.sweater + self.neck + self.lock, 0, 1)
+ p.strokes(self.coat_raw * self.fade_b * smoothstep(0.55, 0.85, self.coat_lit), self.coat_field,
+ ('powder_pale', 'white'), (60, 130), (8, 18), 0.45, pressure=0.66, opacity=0.95, alpha=0.75,
+ streak=0.75, avoid=av, seed=101)
+ # loose hairs: a few fly out of the silhouette
+ rim = blur(self.hairm, 3)
+ roots = (smoothstep(0.3, 0.5, rim) * smoothstep(0.9, 0.7, rim)) * (1 - self.cat) * smoothstep(640, 600, p.YY)
+ p.strands(self.hairm, self.hair_flow, ('hair_dark', 'hair', 'hair_blue'), n=50, length=(50, 140),
+ width=(0.8, 1.2), roots=roots, curl=2.0, jitter=20, alpha=0.6, clip=False, seed=102)
+ p.strands(self.fringe, self.hair_flow, ('hair_dark', 'hair_blue'), n=14, length=(60, 160), width=(0.8, 1.1),
+ curl=1.4, jitter=12, alpha=0.55, clip=False, seed=103)
+ head = self.cat_head * (1 - self.fringe)
+ p.strands(head * smoothstep(0.6, 0.9, self.cat_lit_head), p.radial(*NOSE_C, seed=104), ('peach', 'fur_white'),
+ n=50, length=(10, 22), width=(0.8, 1.2), alpha=0.55, clip=True, seed=105)
+
+
+PHASES = ('sketch', 'background', 'block', 'model', 'fur', 'hair', 'faces', 'highlights')
+
+
+def main():
+ out = sys.argv[1] if len(sys.argv) > 1 and not sys.argv[1].startswith('--') else 'pastelvignette_marmalade_scarf.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:10s} {time.time() - T0:5.1f}s')) if os.environ.get('PV_TIMING') else (lambda n: None)
+ p = PastelVignette(W, H, seed=7, keep_stages=bool(stages), stages_dir=stages)
+ p.finish()
+ p.paper()
+ p.stage('paper')
+ sc = Scene(p)
+ tick('setup')
+ for name in PHASES[:-1]:
+ getattr(sc, name)()
+ tick(name)
+ p.stage(name)
+ getattr(sc, PHASES[-1])()
+ tick(PHASES[-1])
+ p.save(out, stages_dir=stages)
+ print('saved', out, f'{time.time() - T0:.1f}s', p.n_strokes, 'strokes')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/lib/pastelvignette.py b/lib/pastelvignette.py
new file mode 100644
index 0000000..4818e8b
--- /dev/null
+++ b/lib/pastelvignette.py
@@ -0,0 +1,1292 @@
+"""pastelvignette — 色粉小像 / Pastel Vignette: a whimsical picture-book character vignette in soft chalk pastel and a
+little gouache on white paper (numpy + Pillow only).
+
+The look: one or two charming characters -- often a person with an animal companion -- painted half-length on pure
+white paper with no background panel and no frame: the painting simply stops, and its edges dissolve into the white
+in dry, feathered strokes. The medium is soft chalk pastel with a little gouache: the colours are soft and powdery
+(pale powder blue, cream, warm skin) with one warm saturated accent family (orange, tangerine, yellow -- a fluffy
+cat, a pom-pom, a bow); you can see the pastel grain and dry, directional, painterly strokes in the clothes, while
+faces are blended smooth. The characters are whimsical: big round eyes with dark irises and white catchlights, very
+large rosy blush circles, a red-tipped nose, a small mouth; hair and fur are hundreds of fine wispy strands, some
+flying loose. Modelling is soft, with no hard ink outline -- only a few thin soft lines (an eyelid, a nostril, the
+shadow side of a cheek). Behind them, at most a sprig of leaves or a faint pencil-grey sketch.
+
+Physical model
+ paper A white drawing sheet with a fine tooth `T`, rank-equalised to a uniform 0..1 so that "the pastel reaches
+ where tooth > 1 - pressure" turns pressure straight into coverage. A stick dragged over the paper rides
+ from peak to peak, so the tooth is also pre-averaged along 8 directions (`TD`) and every stroke reads the
+ one that matches its own direction: the pits it skips are drawn out a little along the stroke. A pigment
+ buffer `F` records how much pastel already sits in the tooth: later layers reach a little deeper.
+ stroke A pastel / dry-brush stroke is a short centreline integrated through an orientation field (angles mod
+ pi) with a slight wrist arc. Tens of thousands go at once: Pillow draws every *segment* of every stroke
+ with its own id into a 2x supersampled integer map (segments are lengthened a little so a bend leaves
+ no notch); for each covered sub-pixel numpy looks up the segment, recovers the position along the
+ stroke (u, for the pressure profile: pressed at the start, lifting off at the end) and across it (v,
+ for a soft edge and the bristle lanes of a dry stick: a few parallel streaks that open up as the stroke
+ runs dry), compares the pressure with the direction-matched tooth and lays the pigment. Sub-pixels are
+ summed back with bincount, so a pass costs about one Pillow line per segment. Within one pass the top
+ stroke wins; layers come from several passes. Big passes are split into horizontal bands (memory).
+ pigment Soft pastel is nearly opaque: new = old + A x (target - old), target = (1 - opacity) x old x colour /
+ paper + opacity x colour -- so a pale stroke covers a dark one (a white dry stroke over powder blue),
+ and a thin one tints what is under it.
+ blending `wash()` is pastel rubbed in with a finger (or a thin gouache layer): a smooth, opaque coat whose colour
+ can be a field (a ramp looked up by a light field), with the deepest pits of the tooth left a touch
+ lighter, and an edge that wanders and breaks up into the tooth instead of being a vector edge.
+ `model()` lays a soft dome light on a shape and washes the ramp over it (faces, fur under-colour).
+ dissolve The vignette has no frame: coats are given a ragged, low-frequency boundary and strokes near a region's
+ border lose pressure (`fade`), so the colour breaks up into tooth speckle and single dry strokes that
+ end at different places before the white.
+ strands `strands()` traces hundreds or thousands of fine hairs through a flow field (each with its own jitter and
+ steady curl), coloured dark to light by a sheen field and painted dark first, light last; a few fly
+ loose outside the silhouette. `fur()` lays tufts (strands whose roots spread and whose tips converge,
+ darker on the side away from the light); `fluff()` sends short strands outward across a silhouette,
+ coloured from the paint just inside it, so a fluffy edge melts into whatever is behind.
+ faces `eye()` a big round eye: an off-white ball shaded grey-blue under the lid, a dark iris with a lighter lower
+ half and a darker rim, a pupil, a soft dark upper-lid line with a flick at the outer corner, a faint
+ crease and lower lid, two white catchlights. `blush()` a big powdery round cheek, `nose()` a soft side
+ shadow and a red tip, `mouth()` small lips, `brow()` a tapered line plus fine hairs.
+ lines `line()` a smooth tapered round-brush line (lid lines, whiskers, a thin soft contour); `pencil()` a faint
+ graphite line laid as several sketchy overlapping strokes (the background sketch).
+ plants `leaf()` a leaf shape modelled lighter on one side with a pale midrib; `sprig()` a stem with leaves.
+ finish `finish()` records a slight softness and a fine grain (applied in render, so every stage snapshot
+ matches the final look); the paper stays white.
+
+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,
+ dark -> light)
+ surface PastelVignette(W, H, seed, keep_stages, stages_dir); paper(tone, tooth); finish(soft, grain, warmth)
+ masks poly(pts, smooth) / ellipse(cx, cy, rx, ry, rot) / blob(cx, cy, rx, ry, rough) / tube(path, w0, w1) /
+ rect(x0, y0, x1, y1) / below(xs, ys) -> canvas-sized float masks; ragged(mask, amp, scale, edge)
+ fields flow(angle, turb, scale); radial(cx, cy, offset); contour(mask, sigma, offset, fallback);
+ blend(f1, f2, w); rotate(field, deg); field(f(x, y) -> degrees); value(top, bottom, y0, y1);
+ shading(mask, light, sigma, wrap)
+ strokes strokes(region, field, colour, length, width, density, pressure, opacity, alpha, streak, soft, taper,
+ passes, clip, avoid, fade); lines(paths, colour, width, ...); pencil(path, colour, width, alpha)
+ layers wash(mask, colour, alpha, grain, edge, dry, clip); model(mask, colours, light, lit, gamma, lo, hi);
+ glaze(mask, colour, alpha, mode); dab(x, y, r, colour, alpha, soft)
+ hair, fur strands(region, flow, colours, n, length, width, curl, jitter, shade, alpha, clip, roots, lock);
+ fur(region, field, colour, length, width, density, tuft, spread, curl, converge, side, light);
+ fluff(mask, length, n, width, out, alpha, lift)
+ faces eye(cx, cy, rx, ry, iris, look, lid, flick, lashes, side, rot); brow(path, width, colour);
+ blush(cx, cy, rx, ry, colour, strength); nose(x, y, size, side, tip, shade); mouth(x, y, w, smile, colour);
+ line(path, width, colour, alpha, taper, dry)
+ plants leaf(base, tip, width, colours, bend); sprig(path, n, size, colours, seed)
+ output render(); composite(); stage(name); save(path, stages_dir) -- save('x.jpg') quality 88, 4:4:4 chroma
+
+ import sys; sys.path.insert(0, 'lib')
+ from pastelvignette import PastelVignette
+ p = PastelVignette(1920, 1080, seed=3); p.finish(); p.paper()
+ face = p.ellipse(960, 420, 150, 175)
+ p.model(face, 'skin')
+ p.eye(900, 430, 34, 38, look=(-0.3, 0)); p.eye(1020, 430, 34, 38, look=(-0.3, 0))
+ p.blush(880, 500, 50); p.blush(1040, 500, 50); p.nose(955, 495, 16)
+ coat = p.ragged(p.poly([(700, 640), (1220, 640), (1300, 1000), (620, 1000)]), 40)
+ p.model(coat, 'powder'); p.strokes(coat, -70, ('powder_light', 'white'), (40, 90), (8, 16), 0.8, streak=0.6)
+ p.save('vignette.jpg')
+"""
+import io
+import os
+import numpy as np
+from PIL import Image, ImageDraw
+from core import blur, fbm1d, spline, noise2d, smoothstep, blob_pts
+
+PAINTS = {
+ # paper and pencil
+ 'paper': '#fcfbf8', 'white': '#ffffff', 'chalk': '#fbf8f1', 'pencil': '#8f8f96', 'pencil_light': '#bdbdc3',
+ 'graphite': '#5d5d66',
+ # skin
+ 'skin': '#f5d6c4', 'skin_light': '#fbe8dc', 'skin_pale': '#fef3ec', 'skin_shade': '#e8b49e', 'skin_deep': '#c9877a',
+ 'blush': '#f0806b', 'nose': '#ea6d5c', 'lip': '#e0624f', 'lip_dark': '#b2443a', 'lid': '#3b2726',
+ 'brow': '#4a3633', 'crease': '#c98e80',
+ # eyes
+ 'eye_white': '#f9f7f2', 'eye_shade': '#b9bccb', 'iris': '#5b3a29', 'iris_light': '#9c6b43', 'pupil': '#161013',
+ 'amber': '#d9a531', 'amber_light': '#f1d06a', 'olive_eye': '#9a8f3c',
+ # hair
+ 'hair_black': '#17151d', 'hair_dark': '#24232e', 'hair': '#33354a', 'hair_blue': '#4a5470', 'hair_grey': '#7f8aa6',
+ 'hair_light': '#aeb8cf',
+ # powder blues and creams (the soft family)
+ 'powder_deep': '#6e88ae', 'powder_shade': '#91a9c9', 'powder': '#b5cae2', 'powder_light': '#d6e3f0',
+ 'powder_pale': '#ecf2f8', 'cream': '#f3e8d4', 'cream_shade': '#dccbb0', 'cream_deep': '#bfa98a', 'ivory': '#faf5ea',
+ # the warm accent family
+ 'ginger_deep': '#a9461c', 'ginger_dark': '#c95a22', 'ginger': '#e7772f', 'orange': '#f08c3e',
+ 'tangerine': '#f5a04f', 'apricot': '#f8bf7e', 'peach': '#fbd9ae', 'butter': '#f5d77a', 'mustard': '#e1ae47',
+ 'fur_cream': '#f7ecd8', 'fur_white': '#fdf8ef', 'ear_pink': '#f1b6a4',
+ # greens and greys for the background
+ 'eucalyptus_deep': '#5f7d73', 'eucalyptus': '#86a196', 'eucalyptus_light': '#b0c5ba', 'sage': '#a7b58c',
+ 'olive': '#8f9a5c', 'ochre': '#d5a24c', 'stem': '#7d7a5a', 'mist': '#d9dadf', 'umber': '#5b4033',
+}
+RAMPS = { # dark -> light
+ 'skin': ('#cf9282', '#e6b19d', '#f2cbb7', '#f8dfd0', '#fdeee5'),
+ 'neck': ('#c48475', '#d9a08c', '#ebbca7', '#f3d2c0', '#f8e1d4'),
+ 'powder': ('#7891b7', '#97afd0', '#b6cae2', '#d2e0ee', '#ebf1f8'),
+ 'cream': ('#c9b596', '#ddcdb2', '#eee3cf', '#f7f0e3', '#fdfaf3'),
+ 'ginger': ('#a7461b', '#cc5f24', '#e9792f', '#f39b4b', '#f9c487'),
+ 'hair': ('#141219', '#1d1c26', '#272836', '#363b50', '#58617d'),
+ 'eucalyptus': ('#5c7a70', '#7a978b', '#9db5a8', '#c0d1c6', '#dfe8e1'),
+ 'ochre': ('#a9752f', '#c69344', '#dcb160', '#ebcc88', '#f6e4b8'),
+ 'mist': ('#b9bbc3', '#cacbd1', '#d9dadf', '#e7e7ea', '#f2f2f3'),
+}
+LIGHT = (-0.55, -0.6, 0.58) # upper left, a little in front
+
+
+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 mix(a, b, t):
+ return hexc(a) * (1 - t) + hexc(b) * t
+
+
+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)
+
+
+def _resample_k(P, k):
+ """resample a polyline to exactly k points by arc length"""
+ P = np.asarray(P, np.float32)
+ 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)
+
+
+class PastelVignette:
+ PAINTS = PAINTS
+ RAMPS = RAMPS
+ LIGHT = LIGHT
+
+ 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) # pigment already sitting in the tooth
+ self.T = None; self.TD = None; self.EN = None
+ self.fin = None
+ self.floor = 0.22 # pigment a stick 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, drag=3, seed=None):
+ """white drawing paper: an equalised fine tooth, shown on the bare sheet only as a whisper"""
+ 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.6)
+ g2 = noise2d(H, W, 2.6, 2, int(r.integers(1 << 30)))
+ g3 = noise2d(H, W, 8.0, 2, int(r.integers(1 << 30)))
+ self.T = _equalise(0.75 * z(g1) + 0.45 * z(g2) + 0.18 * z(g3))
+ self.P = hexc(tone)
+ self.C = (self.P[None, None] * (1 - 0.006 * tooth * (0.5 - self.T[..., None]))).astype(np.float32)
+ self.F[:] = 0
+ # tooth dragged along 8 stroke directions (kept as uint8: 8 canvases of float32 would be 66 MB at 1080p)
+ TD = np.empty((8, H, W), np.uint8)
+ 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] = np.round(_equalise(0.4 * self.T + 0.6 * acc / wk.sum()) * 255).astype(np.uint8)
+ del acc
+ self.TD = TD
+ self.EN = noise2d(H, W, 4.0, 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))
+ x0, x1 = max(0, int(cx - max(rx, ry) - 3)), min(self.W, int(cx + max(rx, ry) + 4))
+ y0, y1 = max(0, int(cy - max(rx, ry) - 3)), min(self.H, int(cy + max(rx, ry) + 4))
+ out = np.zeros((self.H, self.W), np.float32)
+ if x1 <= x0 or y1 <= y0: return out
+ dx, dy = self.XX[y0:y1, x0:x1] - cx, self.YY[y0:y1, x0:x1] - cy
+ u, v = (dx * c + dy * s) / rx, (-dx * s + dy * c) / ry
+ d = np.sqrt(u * u + v * v)
+ out[y0:y1, x0:x1] = np.clip((1 - d) * min(rx, ry) + 0.5, 0, 1)
+ return out
+
+ 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, tails, stems)"""
+ 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) if np.ndim(w0) == 0 else np.interp(np.linspace(0, 1, n), np.linspace(0, 1, len(w0)), w0))
+ w = np.asarray(w, np.float32)[:, None] * 0.5
+ return np.vstack([P + Nn * w, (P - Nn * w)[::-1]])
+
+ def tube(self, path, w0, w1=None):
+ """mask of a tube; w0 may be a list of widths along the path"""
+ return self.poly(self.tube_pts(path, w0, w1))
+
+ 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 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 ragged(self, mask, amp=24.0, scale=60.0, edge=1.0, seed=None):
+ """give a mask an unfinished, dry boundary: the edge is pushed in and out by a low-frequency wander (amp px
+ at `scale` px) and, within a few px of it, breaks up into the paper tooth -- where a vignette stops"""
+ r = self._r(seed)
+ bb = self._bbox(mask, pad=int(amp * 2) + 4)
+ out = np.zeros_like(mask)
+ if bb is None: return out
+ x0, y0, x1, y1 = bb
+ m = mask[y0:y1, x0:x1]
+ h, w = m.shape
+ sd = max(2.0, amp * 0.6)
+ b = blur(m, sd)
+ n = noise2d(h, w, scale, 3, int(r.integers(1 << 30))) - 0.5
+ n2 = noise2d(h, w, scale * 0.25, 2, int(r.integers(1 << 30))) - 0.5
+ # the edge sits where the blurred mask crosses a wandering threshold (never far outside: no islands)
+ th = np.clip(0.5 + 1.1 * n + 0.45 * n2, 0.14, 0.86)
+ core = smoothstep(th - 0.03, th + 0.03, b)
+ if edge:
+ zone = smoothstep(th - 0.22, th, b) * (1 - core)
+ Tt = self.T[y0:y1, x0:x1] if self.T is not None else 0.5
+ core = np.maximum(core, zone * smoothstep(0.55, 0.8, Tt + zone * 0.35) * edge)
+ out[y0:y1, x0:x1] = core
+ return out
+
+ 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):
+ 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 with +-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 field(self, f):
+ """an orientation field from f(x, y) -> degrees, evaluated on the whole canvas"""
+ return np.deg2rad(np.asarray(f(self.XX, self.YY), np.float32)).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 sleeve, a cheek.
+ Only computed round the shape (outside it: `fallback` degrees or 0)."""
+ if isinstance(fallback, np.ndarray): out = fallback.astype(np.float32).copy()
+ else: out = np.full((self.H, self.W), 0 if fallback is None else np.deg2rad(fallback), np.float32)
+ bb = self._bbox(mask, pad=int(3 * sigma) + 4)
+ if bb is None: return out
+ x0, y0, x1, y1 = bb
+ d = blur(mask[y0:y1, x0:x1].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[y0:y1, x0:x1]
+ a = self.blend(np.broadcast_to(np.float32(fb), a.shape) if np.ndim(fb) == 0 else fb, a, w)
+ out[y0:y1, x0:x1] = a
+ return out
+
+ @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):
+ 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=LIGHT, sigma=None, wrap=0.25, 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). 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 strokes(self, region, field=-60.0, colour='powder', length=(30, 70), width=(8, 16), density=1.0,
+ pressure=0.78, opacity=0.85, alpha=0.8, streak=0.45, soft=0.6, jitter=0.07, bend=0.03, value=0.035,
+ hue=0.02, taper=(0.55, 0.1), passes=2, clip='auto', avoid=None, fade='auto', k=5, seed=None):
+ """lay dry pastel / dry-brush strokes over `region` (a 0..1 landing-probability mask or a box) following
+ `field` (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 pigment reaches into the tooth;
+ opacity: how much a pale stroke covers what is under it; streak: how much the bristle lanes open up as
+ the stroke runs dry; soft: the soft fraction of the stroke's half-width; taper: pressure at (start, end);
+ clip: a mask the strokes are cut to ('auto' = the region's support, with a wandering edge); fade: a 0..1
+ field easing the pressure off pixel by pixel ('auto' = region ** 0.65 -- so a region that fades out makes
+ the strokes break up into the tooth); avoid: things to paint round. 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
+ if float(M[y0:y1, x0:x1].sum()) < 1: return 0
+ 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.8 * 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)
+ P = self._centrelines(x, y, L, self._field_rad(field), (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.08, 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.9, 1.06, n).astype(np.float32)
+ al = np.broadcast_to(np.asarray(alpha, np.float32), (n,)) * r.uniform(0.82, 1.0, n).astype(np.float32)
+ st = np.broadcast_to(np.asarray(streak, np.float32), (n,)) * r.uniform(0.6, 1.3, n).astype(np.float32)
+ self._draw(P, Wd, cols, al, pr, taper, opacity, clip, passes, r, fade=fade, streak=st, soft=soft)
+ self.n_strokes += n
+ return n
+
+ def lines(self, paths, colour='graphite', width=2.0, pressure=0.8, opacity=0.85, alpha=0.9, taper=(0.4, 0.2),
+ streak=0.0, soft=0.5, value=0.03, hue=0.0, clip=None, fade=None, passes=1, k=None, seed=None):
+ """draw explicit strokes: a list of polylines (each (m, 2)), resampled to k points each; painted in order
+ (later on top) within each pass"""
+ self._need()
+ r = self._r(seed)
+ if not len(paths): return 0
+ if k is None: k = max(3, min(11, 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.95, 1.04, n).astype(np.float32)
+ al = np.broadcast_to(np.asarray(alpha, np.float32), (n,)).astype(np.float32)
+ st = np.broadcast_to(np.asarray(streak, np.float32), (n,)).astype(np.float32)
+ self._draw(P, Wd, cols, al, pr, taper, opacity, clip, passes, r, fade=fade, streak=st, soft=soft)
+ self.n_strokes += n
+ return n
+
+ def _draw(self, P, Wd, cols, al, pr, taper, opacity, clip, passes, r, ss=2, fill=0.35, fade=None, streak=None,
+ soft=0.45):
+ n = len(P)
+ tp = np.broadcast_to(np.asarray(taper, np.float32), (n, 2))
+ st = np.zeros(n, np.float32) if streak is None else np.asarray(streak, np.float32)
+ so = np.broadcast_to(np.asarray(soft, np.float32), (n,)) * r.uniform(0.8, 1.2, n).astype(np.float32)
+ nb = np.clip(Wd / r.uniform(2.6, 4.2, n), 1.5, 9).astype(np.float32) # bristle lanes per stroke
+ ph = r.uniform(0, 2 * np.pi, (n, 2)).astype(np.float32)
+ passes = max(1, int(passes))
+ my = P[:, P.shape[1] // 2, 1]
+ for g in range(passes):
+ sel = np.arange(g, n, passes)
+ if not len(sel): continue
+ # split a big pass into horizontal bands so the supersampled id map stays small
+ lo = P[sel].reshape(-1, 2).min(0); hi = P[sel].reshape(-1, 2).max(0)
+ area = (hi[0] - lo[0] + 2 * Wd.max()) * (hi[1] - lo[1] + 2 * Wd.max()) * ss * ss
+ nband = int(np.clip(np.ceil(area / 2.5e6), 1, 96))
+ if nband > 1:
+ edges = np.quantile(my[sel], np.linspace(0, 1, nband + 1))
+ groups = [sel[(my[sel] >= edges[b]) & ((my[sel] < edges[b + 1]) | (b == nband - 1))]
+ for b in range(nband)]
+ else:
+ groups = [sel]
+ for gs in groups:
+ if len(gs):
+ self._raster(P[gs], Wd[gs], cols[gs], al[gs], pr[gs], tp[gs], opacity, clip, ss, fill, fade,
+ st[gs], so[gs], nb[gs], ph[gs])
+
+ def _raster(self, P, Wd, cols, al, pr, tp, opacity, clip, ss, fill, fade, st, so, nb, ph):
+ n, k = P.shape[:2]
+ ns = k - 1
+ pad = float(Wd.max()) + 3
+ lo = P.reshape(-1, 2).min(0) - pad; hi = P.reshape(-1, 2).max(0) + pad
+ 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
+ # segment tables (canvas units)
+ A = P[:, :-1]; B = P[:, 1:]
+ seg = B - A
+ sl = np.linalg.norm(seg, axis=2) + 1e-4
+ D = seg / sl[..., None]
+ cum = np.cumsum(sl, axis=1) - sl
+ LT = sl.sum(1)
+ # draw every segment with its own id; segments are lengthened so a bend leaves no notch
+ ext = np.minimum(Wd[:, None] * 0.35, sl * 0.5)[..., None] * D
+ ext[:, -1] = 0
+ A2 = (A - np.array([x0, y0], np.float32)) * ss
+ B2 = (B + ext - np.array([x0, y0], np.float32)) * ss
+ im = Image.new('I', (w * ss, h * ss), 0)
+ d = ImageDraw.Draw(im)
+ a2 = A2.tolist(); b2 = B2.tolist()
+ wi = np.maximum(1, np.round(Wd * ss)).astype(np.int32).tolist()
+ for i in range(n):
+ ai, bi, wv = a2[i], b2[i], wi[i]
+ base = i * ns + 1
+ for j in range(ns):
+ d.line((ai[j][0], ai[j][1], bi[j][0], bi[j][1]), fill=base + j, width=wv)
+ flat = np.asarray(im, dtype=np.int32).ravel()
+ nz = np.flatnonzero(flat).astype(np.int32)
+ del im
+ if not len(nz): return
+ sid = flat[nz]
+ del flat
+ W2 = w * ss
+ sy = nz // W2; sx = nz - sy * W2
+ del nz
+ si = np.r_[0, np.repeat(np.arange(n), ns)] # stroke of each segment (index 0 unused)
+ z1 = lambda a: np.r_[0, np.asarray(a, np.float32).ravel()].astype(np.float32)
+ AX, AY = z1(A[..., 0]), z1(A[..., 1])
+ DX, DY = z1(D[..., 0]), z1(D[..., 1])
+ SL, CU = z1(sl), z1(cum)
+ ang = np.mod(np.arctan2(D[..., 1], D[..., 0]), np.pi).ravel()
+ BIN = np.r_[0, (np.round(ang / np.pi * 8).astype(np.int32) % 8)]
+ stk = si[sid].astype(np.int32)
+ X = (sx.astype(np.float32) + 0.5) * (1.0 / ss) + x0; Y = (sy.astype(np.float32) + 0.5) * (1.0 / ss) + y0
+ rx = X - AX[sid]; ry = Y - AY[sid]
+ t = np.clip(rx * DX[sid] + ry * DY[sid], 0, SL[sid])
+ u = np.clip((CU[sid] + t) / LT[stk], 0, 1)
+ v = np.abs(rx * (-DY[sid]) + ry * DX[sid]) / (0.5 * Wd[stk] + 0.25)
+ # pressure profile along the stroke, soft sides, bristle lanes that open as the stroke runs dry
+ t0 = tp[stk, 0]; t1 = tp[stk, 1]
+ prof = np.minimum(np.clip(t0 + (1 - t0) * u / 0.15, 0, 1), np.clip(t1 + (1 - t1) * (1 - u) / 0.45, 0, 1))
+ # the ends are rounded off (a blunt start, a narrowing lift-off), not the square caps of a ruled line
+ wf = 0.3 + 0.7 * np.sqrt(np.clip(np.minimum(u / 0.1, (1 - u) / 0.28), 0, 1))
+ lat = smoothstep(1.0, 1.0 - so[stk], v / wf)
+ sv = (rx * (-DY[sid]) + ry * DX[sid]) / (0.5 * Wd[stk] + 0.25)
+ lane = 0.6 * (0.5 + 0.5 * np.sin(sv * nb[stk] * np.pi + ph[stk, 0])) + \
+ 0.4 * (0.5 + 0.5 * np.sin(sv * nb[stk] * 2.3 * np.pi + ph[stk, 1]))
+ p = pr[stk] * (0.55 + 0.45 * prof) * (1 - st[stk] * (1 - lane) * (0.3 + 0.7 * u))
+ iy = y0 + sy // ss; ix = x0 + sx // ss
+ if fade is not None:
+ p = p * (0.4 + 0.6 * fade[iy, ix]) # a fading region also dries the stroke out
+ Tt = self.TD[BIN[sid], iy, ix].astype(np.float32) * (1.0 / 255)
+ catch = np.clip((Tt + fill * self.F[iy, ix] - (1 - p)) * 4.0 + 0.5, 0, 1)
+ catch = self.floor * np.clip(p, 0, 1) + (1 - self.floor * np.clip(p, 0, 1)) * catch
+ Aa = al[stk] * catch * lat * (0.45 + 0.55 * prof)
+ pix = (sy // ss) * w + (sx // ss)
+ npx = w * h
+ k2 = 1.0 / (ss * ss)
+ a1 = np.bincount(pix, Aa, npx).astype(np.float32) * k2
+ c3 = np.empty((npx, 3), np.float32)
+ for ch in range(3):
+ c3[:, ch] = np.bincount(pix, Aa * cols[stk, 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]
+ 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 + np.minimum(a1[m], 1)[:, None] * (tgt - old)
+ Fb = self.F[y0:y1, x0:x1]
+ Fb[m] = np.minimum(1.4, Fb[m] + a1[m] * 0.5)
+
+ # ================================================================== blended layers
+ def _field_colour(self, colour, sl):
+ """colour spec -> (h, w, 3) or (3,) for the slice: paint | (ramp, field) | array (H, W, 3) | f(X, Y)"""
+ ys, xs = sl
+ if isinstance(colour, np.ndarray) and colour.ndim == 3: return colour[ys, xs]
+ if isinstance(colour, (tuple, list)) and len(colour) == 2 and isinstance(colour[1], np.ndarray):
+ return ramp_at(ramp(colour[0]), colour[1][ys, xs])
+ if callable(colour): return np.asarray(colour(self.XX[ys, xs], self.YY[ys, xs]), np.float32)
+ return hexc(colour)
+
+ def wash(self, mask, colour, alpha=1.0, grain=0.25, edge=0.5, dry=0.0, clip=None, opacity=1.0):
+ """pastel rubbed in with a finger (or a thin gouache coat): a smooth layer over `mask`. colour: a paint,
+ (ramp, 0..1 field), an (H, W, 3) array or f(X, Y). grain: the deepest pits of the tooth stay a little
+ lighter; edge: within the soft rim of the mask the coat breaks up into the tooth instead of fading
+ smoothly; dry: the same over the whole area (a scumbled, dry coat); opacity < 1 mixes multiplicatively."""
+ self._need()
+ bb = self._bbox(mask)
+ if bb is None: return
+ x0, y0, x1, y1 = bb
+ sl = (slice(y0, y1), slice(x0, x1))
+ m = mask[sl].astype(np.float32)
+ if clip is not None: m = m * clip[sl]
+ Tt = self.T[sl]
+ A = m * alpha
+ if edge:
+ rim = smoothstep(0.0, 0.85, m) * (1 - smoothstep(0.85, 1.0, m))
+ br = smoothstep(0.35, 0.75, Tt + m * 0.55 - 0.15)
+ A = A * (1 - edge * rim * (1 - br))
+ if dry:
+ A = A * (1 - dry * (1 - smoothstep(0.25, 0.65, Tt + (1 - dry) * 0.5)))
+ if grain:
+ A = A * (1 - grain * 0.35 * smoothstep(0.18, 0.0, Tt))
+ col = self._field_colour(colour, sl)
+ Cs = self.C[sl]
+ if opacity < 1:
+ col = (1 - opacity) * np.clip(Cs * col / self.P, 0, 1) + opacity * col
+ Cs += (col - Cs) * A[..., None]
+ np.clip(Cs, 0, 1, out=Cs)
+ self.F[sl] = np.minimum(1.4, self.F[sl] + A * 0.6)
+
+ def model(self, mask, colours, light=LIGHT, lit=None, sigma=None, wrap=0.3, gamma=1.0, lo=0.0, hi=1.0,
+ alpha=1.0, grain=0.25, edge=0.5, clip=None, mottle=0.06, seed=None):
+ """a softly modelled, blended shape: a dome light (or `lit`) picks colours from a dark -> light ramp,
+ mapped to the range lo..hi of the ramp, with a faint low-frequency mottle. Returns the light field."""
+ if lit is None: lit = self.shading(mask, light, sigma, wrap)
+ v = lo + (hi - lo) * np.clip(lit, 0, 1) ** gamma
+ if mottle:
+ bb = self._bbox(mask)
+ if bb is not None:
+ x0, y0, x1, y1 = bb
+ nz = noise2d(y1 - y0, x1 - x0, 70, 3, int(self._r(seed).integers(1 << 30))) - 0.5
+ v = v.copy(); v[y0:y1, x0:x1] += 2 * mottle * nz
+ self.wash(mask, (colours, np.clip(v, 0, 1)), alpha, grain, edge, clip=clip)
+ return lit
+
+ def glaze(self, mask, colour, alpha=0.5, mode='multiply', soft=0.0):
+ """a thin layer over what is there: 'multiply' (shadows), 'screen' (lights) or 'normal'"""
+ m = blur(mask, soft) if soft else mask
+ bb = self._bbox(m)
+ if bb is None: return
+ x0, y0, x1, y1 = bb
+ sl = (slice(y0, y1), slice(x0, x1))
+ A = m[sl] * alpha
+ Cs = self.C[sl]
+ col = hexc(colour)
+ if mode == 'multiply': tgt = Cs * col
+ elif mode == 'screen': tgt = 1 - (1 - Cs) * (1 - col)
+ else: tgt = np.broadcast_to(col, Cs.shape)
+ Cs += (tgt - Cs) * A[..., None]
+
+ def dab(self, x, y, r, colour='white', alpha=0.95, soft=0.35, ry=None, rot=0.0):
+ """a small soft round touch of opaque paint (catchlights, a button, a glint)"""
+ ry = r if ry is None else ry
+ x0, x1 = max(0, int(x - r - 3)), min(self.W, int(x + r + 4))
+ y0, y1 = max(0, int(y - ry - 3)), min(self.H, int(y + ry + 4))
+ if x1 <= x0 or y1 <= y0: return
+ c, s = np.cos(np.deg2rad(rot)), np.sin(np.deg2rad(rot))
+ dx, dy = self.XX[y0:y1, x0:x1] - x, self.YY[y0:y1, x0:x1] - y
+ dd = np.sqrt(((dx * c + dy * s) / r) ** 2 + ((-dx * s + dy * c) / ry) ** 2)
+ A = smoothstep(1.0, max(0.0, 1.0 - soft - 0.6 / max(r, 1.0)), dd) * alpha
+ Cs = self.C[y0:y1, x0:x1]
+ Cs += (hexc(colour) - Cs) * A[..., None]
+
+ # ================================================================== smooth painted lines
+ def _strands_mask(self, paths, widths, taper=(0.15, 0.5), ss=3):
+ """anti-aliased coverage of tapered polylines -> (slice, crop)"""
+ allp = np.concatenate([np.asarray(p, np.float32) for p in paths])
+ pad = float(np.max(widths)) + 3
+ x0, x1 = max(0, int(allp[:, 0].min() - pad)), min(self.W, int(allp[:, 0].max() + pad) + 1)
+ y0, y1 = max(0, int(allp[:, 1].min() - pad)), min(self.H, int(allp[:, 1].max() + pad) + 1)
+ if x1 <= x0 or y1 <= y0: return None, None
+ bw, bh = x1 - x0, y1 - y0
+ ss = max(1, min(ss, 4096 // max(bw, bh)))
+ im = Image.new('L', (bw * ss, bh * ss), 0)
+ d = ImageDraw.Draw(im)
+ o = np.array([x0, y0], np.float32)
+ for i, Q in enumerate(paths):
+ q = (np.asarray(Q, np.float32) - o) * ss
+ n = len(q)
+ if n < 2:
+ rr = widths[i] * ss / 2
+ d.ellipse([q[0, 0] - rr, q[0, 1] - rr, q[0, 0] + rr, q[0, 1] + rr], fill=255); continue
+ tt = np.linspace(0, 1, n)
+ prof = 0.15 + 0.85 * np.clip(np.minimum(tt / max(taper[0], 1e-3), (1 - tt) / max(taper[1], 1e-3)), 0, 1)
+ ww = np.maximum(1, np.round(widths[i] * ss * prof)).astype(int)
+ ql = [tuple(p) for p in q.tolist()]
+ a = 0
+ while a < n - 1:
+ b = a + 1
+ while b < n - 1 and ww[b] == ww[a]: b += 1
+ d.line(ql[a:b + 1], fill=255, width=int(ww[a]), joint='curve' if ww[a] > 2 else None)
+ a = b
+ if widths[i] * ss > 4:
+ for kk in (0, n - 1):
+ rr = ww[kk] / 2
+ d.ellipse([q[kk, 0] - rr, q[kk, 1] - rr, q[kk, 0] + rr, q[kk, 1] + rr], fill=255)
+ cov = np.asarray(im.resize((bw, bh), Image.BOX), np.float32) / 255
+ return (slice(y0, y1), slice(x0, x1)), cov
+
+ def line(self, path, width, colour, alpha=1.0, taper=(0.2, 0.35), smooth=True, dry=0.0, clip=None):
+ """a smooth line painted with a small round brush, tapering in and out (lids, whiskers, a soft contour);
+ dry > 0 lets it break up a little on the tooth"""
+ self._need()
+ Q = np.asarray(path, np.float32)
+ if smooth and len(Q) > 2: Q = spline(Q, 8)
+ sl, m = self._strands_mask([Q], [width], taper)
+ if sl is None: return
+ A = m * alpha
+ if dry: A = A * smoothstep(0.15, 0.6, self.T[sl] + (1 - dry) * 0.55)
+ if clip is not None: A = A * clip[sl]
+ Cs = self.C[sl]
+ Cs += (hexc(colour) - Cs) * A[..., None]
+
+ def pencil(self, path, colour='pencil', width=1.8, alpha=0.7, pressure=0.62, seg=(40, 110), wobble=0.8,
+ gaps=0.12, smooth=True, seed=None):
+ """a faint graphite line: several overlapping sketchy strokes along a path, some left out"""
+ 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
+ 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.1, 0.3) * L))
+ if not paths: return 0
+ return self.lines(paths, colour, width, pressure, 0.25, alpha, (0.35, 0.2), soft=0.6,
+ k=7, seed=int(r.integers(1 << 30)))
+
+ # ================================================================== hair and fur
+ def strands(self, region, flow, colours, n=800, length=(40, 140), width=(1.0, 2.0), curl=0.0, jitter=6.0,
+ step=4.0, shade=None, spread=0.2, alpha=0.9, pressure=0.92, opacity=0.9, taper=(0.3, 0.05),
+ clip=True, pad=5.0, roots=None, lock=None, k=9, seed=None):
+ """many fine hairs: each starts inside `region` (or `roots`), follows `flow` (degrees: a number, a canvas
+ field in radians or f(x, y) -> degrees) with its own jitter and steady bend (`curl` degrees per step),
+ and is drawn as a fine pastel-pencil line, pressed at the root and lifting off at the tip. Each picks a
+ colour from `colours` (dark -> light) by the 0..1 field `shade` plus noise; they are painted dark first,
+ light last. lock=(strands per lock, lock width px) groups them into locks that share a root area, a
+ wander, a curl and a shade, so hair reads as wavy locks rather than combed lines. clip=True keeps them
+ within `pad` px of the region; False lets them fly loose."""
+ r = self._r(seed)
+ src = roots if roots is not None else region
+ bb = self._bbox(src, 0.5)
+ if bb is None: return 0
+ x0, y0, x1, y1 = bb
+ sub = src[y0:y1, x0:x1] > 0.5
+ idx = np.flatnonzero(sub)
+ if not len(idx): return 0
+ if lock:
+ per, lw_ = lock
+ nl = max(1, int(n / per))
+ pick = r.choice(idx, nl)
+ ly = (pick // sub.shape[1] + y0).astype(np.float32)
+ lx = (pick % sub.shape[1] + x0).astype(np.float32)
+ g = r.integers(0, nl, n)
+ y = ly[g] + r.normal(0, lw_ * 0.5, n).astype(np.float32)
+ x = lx[g] + r.normal(0, lw_ * 0.5, n).astype(np.float32)
+ jit = (r.normal(0, jitter, nl)[g] + r.normal(0, jitter * 0.25, n)).astype(np.float32)
+ bend = ((r.normal(0, 1, nl) * curl)[g] + r.normal(0, curl * 0.15 + 1e-6, n)).astype(np.float32)
+ lshade = r.normal(0, spread, nl)[g] + r.normal(0, spread * 0.3, n)
+ else:
+ pick = r.choice(idx, n)
+ y = (pick // sub.shape[1] + y0).astype(np.float32) + r.random(n).astype(np.float32)
+ x = (pick % sub.shape[1] + x0).astype(np.float32) + r.random(n).astype(np.float32)
+ jit = r.normal(0, jitter, n).astype(np.float32)
+ bend = (r.normal(0, 1, n) * curl).astype(np.float32)
+ lshade = r.normal(0, spread, n)
+ lens = r.uniform(*length, n).astype(np.float32)
+ nsteps = max(2, int(lens.max() / step) + 1)
+ Xs = np.zeros((n, nsteps + 1), np.float32); Ys = np.zeros((n, nsteps + 1), np.float32)
+ Xs[:, 0], Ys[:, 0] = x, y
+ for s_ in range(nsteps):
+ if callable(flow): a = np.asarray(flow(Xs[:, s_], Ys[:, s_]), np.float32)
+ elif np.ndim(flow) == 2: a = np.rad2deg(_lookup(flow, Xs[:, s_], Ys[:, s_]))
+ else: a = np.full(n, float(flow), np.float32)
+ a = np.deg2rad(a + jit + bend * s_)
+ Xs[:, s_ + 1] = Xs[:, s_] + np.cos(a) * step
+ Ys[:, s_ + 1] = Ys[:, s_] + np.sin(a) * step
+ npts = np.clip((lens / step).astype(int) + 1, 2, nsteps + 1)
+ nc = len(colours)
+ base = _lookup(shade, x, y) if shade is not None else np.full(n, 0.5, np.float32)
+ cls = np.clip(np.floor((base + lshade) * nc), 0, nc - 1).astype(int)
+ o = np.argsort(cls, kind='stable')
+ paths = [np.stack([Xs[i, :npts[i]], Ys[i, :npts[i]]], 1) for i in o]
+ R = ramp(list(colours))
+ cols = R[cls[o]]
+ if clip is True:
+ cm = smoothstep(0.03, 0.3, blur(region.astype(np.float32), pad))
+ elif clip is False or clip is None:
+ cm = None
+ else:
+ cm = clip
+ return self.lines(paths, lambda xx, yy, c=cols: c, width, pressure, opacity, alpha, taper, streak=0.0,
+ soft=0.55, value=0.05, clip=cm, k=k, seed=int(r.integers(1 << 30)))
+
+ def fur(self, region, field, colour, length=(14, 30), width=(1.2, 2.0), density=0.9, tuft=(5, 11), spread=0.3,
+ curl=0.12, converge=1.0, pressure=0.85, opacity=0.85, alpha=0.75, taper=(0.7, 0.04), clip='auto',
+ value=0.05, hue=0.02, k=7, avoid=None, fade='auto', side=0.14, light=LIGHT[:2], seed=None):
+ """tufts of fine strokes following the lie of the fur. Each tuft: `tuft` strands whose roots spread
+ across the clump and whose tips converge (converge 1) or fan out (-1), curling `curl` the same way,
+ pressed at the root and lifting off at the tip; strands on the side of a tuft away from `light` are
+ darker by `side`, so every lock has a lit and a shadowed flank. density ~ how often 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)
+ 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)
+ L2 = np.asarray(light[:2], np.float32); L2 = L2 / (np.linalg.norm(L2) + 1e-6)
+ tot = int(cnt.sum())
+ tid = np.repeat(np.arange(nt), cnt)
+ jj = np.concatenate([np.arange(c) for c in cnt])
+ mm = cnt[tid].astype(np.float32)
+ off = ((jj / np.maximum(mm - 1, 1) - 0.5) + r.normal(0, 0.12, tot)) * spread * L[tid]
+ d = np.stack([np.cos(a), np.sin(a)], 1)[tid]
+ nrm = np.stack([-d[:, 1], d[:, 0]], 1)
+ lj = L[tid] * r.uniform(0.7, 1.08, tot)
+ base = np.stack([cx, cy], 1)[tid]
+ root = base + nrm * off[:, None] - d * (r.uniform(0, 0.25, tot) * L[tid])[:, None]
+ tip = base + d * L[tid][:, None]
+ end = tip + nrm * (off * (1 - converge * 0.85))[:, None] + d * (lj - L[tid])[:, None] + \
+ r.normal(0, 1, (tot, 2)) * (0.06 * L[tid])[:, None]
+ ctrl = (root + end) / 2 + nrm * (cv[tid] * lj)[:, None] + r.normal(0, 1, (tot, 2)) * (0.03 * L[tid])[:, None]
+ t = np.linspace(0, 1, k)[None, :, None]
+ P = ((1 - t) ** 2 * root[:, None] + 2 * t * (1 - t) * ctrl[:, None] + t * t * end[:, None]).astype(np.float32)
+ sgn = np.sign((nrm @ L2) + 1e-6)
+ lat = sgn * off / np.maximum(1e-3, spread * L[tid])
+ mid = P[:, k // 2]
+ Wd = self._sizes(width, mid[:, 0], mid[:, 1], r)
+ tc = self._colours(colour, cx, cy, r)
+ cols = tc[tid] * (1 + 0.5 * value * r.normal(0, 1, tot).astype(np.float32))[:, None]
+ cols *= (1 + value * r.normal(0, 1, nt).astype(np.float32))[tid][:, None]
+ if side: cols *= (1 + side * 2 * np.clip(lat, -0.6, 0.6))[:, None]
+ if hue: cols = hue_rotate(cols, (hue * r.normal(0, 1, tot)).astype(np.float32))
+ cols = np.clip(cols, 0, 1).astype(np.float32)
+ 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), (tot,)) * r.uniform(0.9, 1.06, tot).astype(np.float32)
+ al = np.broadcast_to(np.asarray(alpha, np.float32), (tot,)) * r.uniform(0.85, 1.0, tot).astype(np.float32)
+ o = r.permutation(tot)
+ self._draw(P[o], Wd[o], cols[o], al[o], pr[o], taper, opacity, clip, 2, r, fade=fade,
+ streak=np.zeros(tot, np.float32), soft=0.55)
+ self.n_strokes += tot
+ return tot
+
+ def fluff(self, mask, length=(10, 30), n=None, width=(1.0, 1.8), out=0.7, field=None, alpha=0.8, lift=0.06,
+ band=3.0, inset=5.0, curl=4.0, light=None, seed=None):
+ """a soft, fluffy silhouette: short strands rooted just inside the edge of `mask`, leaning outward
+ (`out` 0..1 blends the outward normal with `field`), each coloured from the paint just inside it (lifted a
+ touch, more on the lit side), so the fur melts into whatever is behind instead of having an edge"""
+ r = self._r(seed)
+ b = blur(mask.astype(np.float32), band)
+ rim = (smoothstep(0.35, 0.6, b) * smoothstep(0.98, 0.75, b))
+ bb = self._bbox(rim, 0.3)
+ if bb is None: return 0
+ x0, y0, x1, y1 = bb
+ sub = rim[y0:y1, x0:x1] > 0.3
+ idx = np.flatnonzero(sub)
+ if not len(idx): return 0
+ if n is None: n = int(len(idx) / 6)
+ pick = r.choice(idx, n)
+ y = (pick // sub.shape[1] + y0).astype(np.float32) + r.random(n).astype(np.float32)
+ x = (pick % sub.shape[1] + x0).astype(np.float32) + r.random(n).astype(np.float32)
+ g = blur(mask.astype(np.float32), 6.0)
+ gy, gx = np.gradient(g)
+ ox, oy = -_lookup(gx, x, y), -_lookup(gy, x, y)
+ on = np.sqrt(ox * ox + oy * oy) + 1e-6
+ ox, oy = ox / on, oy / on
+ if field is not None:
+ fa = _lookup(self._field_rad(field), x, y)
+ fx, fy = np.cos(fa), np.sin(fa)
+ flip = (fx * ox + fy * oy) < 0
+ fx[flip] *= -1; fy[flip] *= -1
+ ox, oy = out * ox + (1 - out) * fx, out * oy + (1 - out) * fy
+ ang = np.degrees(np.arctan2(oy, ox)).astype(np.float32)
+ # colour from the paint a few px inside
+ sx_ = np.clip(x - ox * inset, 0, self.W - 1).astype(int); sy_ = np.clip(y - oy * inset, 0, self.H - 1).astype(int)
+ col = self.C[sy_, sx_].copy()
+ lf = np.full((n, 1), lift, np.float32)
+ if light is not None: # strands pointing toward the light lift more
+ L2 = np.asarray(light[:2], np.float32); L2 /= np.linalg.norm(L2)
+ lf = lf * (1 + 1.5 * np.clip(ox * L2[0] + oy * L2[1], 0, 1))[:, None]
+ col = np.clip(col * (1 + lf) + 0.02, 0, 1).astype(np.float32)
+ lens = r.uniform(*length, n).astype(np.float32)
+ k = 7
+ paths = []
+ for i in range(n):
+ a0 = np.deg2rad(ang[i] + r.normal(0, 14)); cv = np.deg2rad(r.normal(0, curl))
+ pts = [(x[i], y[i])]
+ px_, py_ = x[i], y[i]
+ st = lens[i] / (k - 1)
+ for j in range(k - 1):
+ px_ += np.cos(a0 + cv * j) * st; py_ += np.sin(a0 + cv * j) * st
+ pts.append((px_, py_))
+ paths.append(np.array(pts, np.float32))
+ return self.lines(paths, lambda xx, yy, c=col: c, width, 0.9, 0.9, alpha, (0.6, 0.0), soft=0.55,
+ value=0.03, k=k, seed=int(r.integers(1 << 30)))
+
+ # ================================================================== faces
+ def eye(self, cx, cy, rx, ry=None, iris='iris', iris_light='iris_light', iris_r=0.62, look=(0.0, 0.0), lid=0.12,
+ lid_skin='skin_light', line_colour='lid', line_w=None, flick=0.35, lashes=3, crease=0.35, lower=0.35,
+ white='eye_white', shade='eye_shade', catch=(-0.36, -0.40), rot=0.0, side=1, clip=None):
+ """a big round picture-book eye: an off-white ball shaded grey-blue under the lid, a dark iris (lighter in
+ the lower half, darker at the rim) with a pupil, the upper lid coming down `lid` of the ball with a soft
+ dark lid line that flicks out at the outer corner (`side` +1 = outer corner to the right), a faint crease
+ and lower lid, a few lashes and two white catchlights. look = (dx, dy) in -1..1 moves the iris."""
+ self._need()
+ ry = rx if ry is None else ry
+ a = np.deg2rad(rot); ca, sa = np.cos(a), np.sin(a)
+ to = lambda u, v: (cx + u * ca - v * sa, cy + u * sa + v * ca)
+ ball = self.ellipse(cx, cy, rx, ry, rot)
+ if clip is not None: ball = ball * clip
+ bb = self._bbox(ball, pad=4)
+ if bb is None: return ball
+ x0, y0, x1, y1 = bb
+ sl = (slice(y0, y1), slice(x0, x1))
+ X, Y = self.XX[sl], self.YY[sl]
+ U = (X - cx) * ca + (Y - cy) * sa; V = -(X - cx) * sa + (Y - cy) * ca
+ q = np.clip((V + ry) / (2 * ry), 0, 1)
+ sideshade = np.clip(np.abs(U) / rx, 0, 1) ** 3
+ wf = hexc(white) + (hexc(shade) - hexc(white)) * (0.85 * (1 - smoothstep(0.05, 0.62, q)) + 0.35 * sideshade)[..., None]
+ Cs = self.C[sl]
+ A = ball[sl][..., None]
+ Cs += (wf - Cs) * A
+ # iris and pupil
+ ir = iris_r * min(rx, ry)
+ iu, iv = look[0] * (rx - ir * 0.9), look[1] * (ry - ir * 0.9)
+ ix, iy = to(iu, iv)
+ dd = np.sqrt((X - ix) ** 2 + (Y - iy) ** 2) / ir
+ im = np.clip((1 - dd) * ir + 0.5, 0, 1) * ball[sl]
+ ic, il = hexc(iris), hexc(iris_light)
+ qq = np.clip((Y - (iy - ir)) / (2 * ir), 0, 1)
+ th = np.arctan2(Y - iy, X - ix)
+ rad = 0.5 + 0.5 * np.sin(th * 23 + 1.3) * np.sin(th * 9 + 0.4)
+ f = ic + (il - ic) * (smoothstep(0.35, 1.0, qq) * smoothstep(0.98, 0.45, dd) * (0.75 + 0.25 * rad))[..., None]
+ f = f * (1 - 0.45 * smoothstep(0.72, 1.0, dd))[..., None]
+ Cs += (f - Cs) * im[..., None]
+ pm = np.clip((1 - dd / 0.5) * ir * 0.5 + 0.5, 0, 1) * ball[sl]
+ Cs += (hexc('pupil') - Cs) * (pm * 0.96)[..., None]
+ # the lid's shadow on the ball, then the lid itself
+ ytop = -ry + 2 * ry * lid
+ arc = ytop + ry * 0.22 * (U / rx) ** 2
+ shadow = ball[sl] * smoothstep(arc + ry * 0.55, arc, V)
+ Cs *= (1 - 0.32 * shadow[..., None] * (1 - hexc('#6d6c8a')))
+ if lid > 0:
+ lm = ball[sl] * smoothstep(arc + 1.0, arc - 1.0, V)
+ Cs += (hexc(lid_skin) - Cs) * lm[..., None]
+ # catchlights
+ if catch is not None:
+ self.dab(ix + catch[0] * ir, iy + catch[1] * ir, max(1.5, ir * 0.26), 'white', 0.97, soft=0.25)
+ self.dab(ix - catch[0] * ir * 0.55, iy - catch[1] * ir * 0.75, max(0.9, ir * 0.1), 'white', 0.8, soft=0.3)
+ # lid line with a flick at the outer corner
+ lw = max(1.6, ry * 0.16) if line_w is None else line_w
+ us = np.linspace(-1.05, 1.05, 30)
+ vs = ytop + ry * 0.22 * us ** 2
+ vs = np.minimum(vs, ry * np.sqrt(np.clip(1 - (us / 1.08) ** 2, 0, 1)))
+ pts = [to(u * rx, v - lw * 0.15) for u, v in zip(us, vs)]
+ if flick:
+ u_end = 1.05 * side
+ v_end = ytop + ry * 0.22
+ pts_f = [to(u_end * rx + side * rx * flick * t, v_end - ry * flick * 0.45 * t * t) for t in (0.4, 0.8, 1.0)]
+ pts = (pts + pts_f) if side > 0 else (pts_f[::-1] + pts)
+ self.line(pts, lw, line_colour, 0.92, taper=(0.18, 0.12) if side > 0 else (0.12, 0.18))
+ # crease and lower lid (faint, warm)
+ if crease:
+ cp = [to(u * rx * 1.02, -ry * 1.18 + ry * 0.28 * u * u + ytop * 0.3) for u in np.linspace(-0.8, 0.9, 16)]
+ self.line(cp, max(1.0, lw * 0.4), 'crease', crease, taper=(0.5, 0.5), dry=0.3)
+ if lower:
+ lp = [to(np.cos(t) * rx * 1.03, np.sin(t) * ry * 1.06) for t in np.linspace(0.2 * np.pi, 0.8 * np.pi, 18)]
+ self.line(lp, max(1.0, lw * 0.35), 'crease', lower, taper=(0.5, 0.5), dry=0.4)
+ for kk in range(lashes):
+ t = 0.55 + 0.45 * kk / max(1, lashes - 1)
+ u0 = side * (t * 1.0)
+ v0 = ytop + ry * 0.22 * u0 * u0
+ p0 = to(u0 * rx, v0)
+ p1 = to(u0 * rx + side * rx * 0.2, v0 - ry * 0.22)
+ p2 = to(u0 * rx + side * rx * 0.34, v0 - ry * 0.26)
+ self.line([p0, p1, p2], max(1.0, lw * 0.32), line_colour, 0.85, taper=(0.1, 0.9))
+ return ball
+
+ def brow(self, path, width=6.0, colour='brow', alpha=0.85, hairs=24, seed=None):
+ """an eyebrow: a soft tapered band (the pastel rubbed in) plus a few fine hairs along it"""
+ r = self._r(seed)
+ P = spline(np.asarray(path, np.float32), 8)
+ self.line(P, width * 1.25, colour, alpha * 0.35, taper=(0.4, 0.6), dry=0.1)
+ self.line(P, width * 0.7, colour, alpha * 0.55, taper=(0.3, 0.6), dry=0.25)
+ if hairs:
+ d = np.gradient(P, axis=0); d /= np.linalg.norm(d, axis=1, keepdims=True) + 1e-6
+ paths = []
+ for _ in range(hairs):
+ i = int(r.integers(0, len(P) - 1))
+ t = i / (len(P) - 1)
+ w = width * (0.5 + 0.5 * np.sin(np.pi * min(1, t * 1.4)))
+ p = P[i] + np.array([-d[i, 1], d[i, 0]]) * r.normal(0, w * 0.25)
+ L = r.uniform(width * 1.1, width * 2.4)
+ dd = d[i] * np.cos(0.35) + np.array([d[i, 1], -d[i, 0]]) * np.sin(0.35)
+ paths.append(np.array([p, p + dd * L * 0.5, p + dd * L], np.float32))
+ self.lines(paths, colour, (0.9, 1.4), 0.85, 0.9, alpha * 0.45, (0.5, 0.0), k=3, seed=int(r.integers(1 << 30)))
+
+ def blush(self, cx, cy, rx, ry=None, colour='blush', strength=0.55, solid=0.25, grain=0.5, clip=None):
+ """a big round rosy cheek: strongest in the middle, softening to nothing, powdery toward the rim where
+ only the tooth takes the pastel"""
+ self._need()
+ ry = rx * 0.85 if ry is None else ry
+ x0, x1 = max(0, int(cx - rx - 2)), min(self.W, int(cx + rx + 3))
+ y0, y1 = max(0, int(cy - ry - 2)), min(self.H, int(cy + ry + 3))
+ if x1 <= x0 or y1 <= y0: return
+ sl = (slice(y0, y1), slice(x0, x1))
+ d = np.sqrt(((self.XX[sl] - cx) / rx) ** 2 + ((self.YY[sl] - cy) / ry) ** 2)
+ a = smoothstep(1.0, solid, d) ** 1.3
+ a = a * (1 - grain * (1 - a) * (1 - smoothstep(0.2, 0.7, self.T[sl])))
+ if clip is not None: a = a * clip[sl]
+ Cs = self.C[sl]
+ Cs += (hexc(colour) - Cs) * (a * strength)[..., None]
+
+ def nose(self, x, y, size=16.0, side=1, tip='nose', shadow='skin_deep', bridge=None, alpha=1.0, shade=0.28):
+ """a small whimsical nose: a soft shadow on the side away from the light (`side` +1 = shadow to the
+ right; `shade` its strength), a little nostril mark, a red-tipped ball and a soft highlight. (x, y) is the
+ tip."""
+ s = size
+ # bridge shadow: a soft curve coming down to the tip
+ if bridge is None: bridge = s * 3.2
+ P = [(x + side * s * 0.3, y - bridge), (x + side * s * 0.55, y - bridge * 0.45), (x + side * s * 0.75, y - s * 0.2),
+ (x + side * s * 0.3, y + s * 0.62)]
+ m = self.tube(P, [s * 0.3, s * 0.5, s * 0.6, s * 0.4])
+ self.glaze(blur(m, s * 0.25), shadow, shade * alpha, 'multiply')
+ # the red tip
+ self.blush(x, y, s * 1.15, s * 0.95, tip, 0.62 * alpha, solid=0.15, grain=0.3)
+ self.blush(x + side * s * 0.15, y + s * 0.15, s * 0.6, s * 0.5, tip, 0.35 * alpha, solid=0.1, grain=0.2)
+ # nostril and the underside line
+ self.line([(x - side * s * 0.15, y + s * 0.62), (x + side * s * 0.25, y + s * 0.7), (x + side * s * 0.62, y + s * 0.45)],
+ max(1.2, s * 0.13), '#9c4b43', 0.55 * alpha, taper=(0.4, 0.3))
+ self.dab(x - side * s * 0.25, y - s * 0.28, max(1.2, s * 0.22), '#fff4ee', 0.6 * alpha, soft=0.8)
+
+ def mouth(self, x, y, w=30.0, smile=0.2, colour='lip', dark='lip_dark', alpha=1.0):
+ """small whimsical lips: a soft upper lip, a fuller lower lip, a darker parting line turned up at the ends"""
+ h = w * 0.32
+ up = [(x - w * 0.5, y - smile * h), (x - w * 0.2, y - h * 0.55), (x, y - h * 0.38), (x + w * 0.2, y - h * 0.55),
+ (x + w * 0.5, y - smile * h), (x, y + 0.05 * h)]
+ lo = [(x - w * 0.45, y - smile * h * 0.6), (x - w * 0.15, y + h * 0.15), (x + w * 0.15, y + h * 0.15),
+ (x + w * 0.45, y - smile * h * 0.6), (x + w * 0.2, y + h * 0.75), (x - w * 0.2, y + h * 0.75)]
+ mu = self.poly(up, smooth=True); ml = self.poly(lo, smooth=True)
+ self.wash(blur(mu, 0.8), mix(colour, dark, 0.25), 0.85 * alpha, grain=0.1, edge=0.2)
+ self.wash(blur(ml, 0.8), colour, 0.8 * alpha, grain=0.1, edge=0.2)
+ self.dab(x + w * 0.05, y + h * 0.42, w * 0.13, '#fbd3c6', 0.45 * alpha, ry=h * 0.14, soft=0.8)
+ self.line([(x - w * 0.52, y - smile * h * 1.3), (x - w * 0.2, y + h * 0.05), (x, y + h * 0.1),
+ (x + w * 0.2, y + h * 0.05), (x + w * 0.52, y - smile * h * 1.3)], max(1.2, w * 0.05), dark,
+ 0.75 * alpha, taper=(0.4, 0.4))
+
+ # ================================================================== plants
+ def leaf(self, base, tip, width, colours='eucalyptus', bend=0.12, light=LIGHT, alpha=1.0, rib=True, seed=None):
+ """one leaf from base to tip: a pointed oval, lighter on the side toward the light, darker toward its
+ base, with a pale midrib and a few dry strokes along it"""
+ r = self._r(seed)
+ b, t = np.asarray(base, np.float32), np.asarray(tip, np.float32)
+ d = t - b; L = float(np.linalg.norm(d)) + 1e-6; d /= L
+ nrm = np.array([-d[1], d[0]], np.float32)
+ s = np.linspace(0, 1, 18)
+ mid = b[None] + d[None] * (s * L)[:, None] + nrm[None] * (bend * L * 4 * s * (1 - s))[:, None]
+ half = width * 0.5 * np.sin(np.pi * s) ** 0.75 * (1 - 0.25 * s)
+ pts = np.vstack([mid + nrm * half[:, None], (mid - nrm * half[:, None])[::-1]])
+ m = self.poly(pts)
+ if m.max() < 0.05: return m
+ L2 = np.asarray(light[:2], np.float32)
+ lit_side = 1.0 if float(nrm @ L2) < 0 else -1.0
+ bb = self._bbox(m, pad=2)
+ x0, y0, x1, y1 = bb
+ X, Y = self.XX[y0:y1, x0:x1], self.YY[y0:y1, x0:x1]
+ along = np.clip(((X - b[0]) * d[0] + (Y - b[1]) * d[1]) / L, 0, 1)
+ across = ((X - b[0]) * nrm[0] + (Y - b[1]) * nrm[1]) * lit_side / (width * 0.5)
+ v = np.zeros((self.H, self.W), np.float32)
+ v[y0:y1, x0:x1] = np.clip(0.45 + 0.35 * np.tanh(across * 2) + 0.15 * along + 0.05 * r.normal(), 0, 1)
+ self.wash(m, (colours, v), alpha, grain=0.35, edge=0.8)
+ self.strokes(m, np.degrees(np.arctan2(d[1], d[0])) + 25 * lit_side, (colours, v), (L * 0.25, L * 0.5),
+ (width * 0.12, width * 0.22), 0.6, pressure=0.6, opacity=0.8, alpha=0.5 * alpha, streak=0.5,
+ passes=1, seed=int(r.integers(1 << 30)))
+ if rib:
+ self.line(mid[2:-2], max(1.0, width * 0.05), mix(ramp(colours)[-1], 'white', 0.3), 0.45 * alpha,
+ taper=(0.2, 0.6), dry=0.4)
+ return m
+
+ def sprig(self, path, n=9, size=(40, 70), colours=('eucalyptus', 'eucalyptus'), stem='stem', width=4.0,
+ round_=0.62, spread=48.0, fade=None, seed=None):
+ """a stem along `path` (base first) with `n` leaves in loose opposite pairs, smaller toward the tip;
+ colours is a ramp per leaf (picked in turn); fade(y) -> 0..1 dims leaves toward a dissolving end"""
+ r = self._r(seed)
+ P = spline(np.asarray(path, np.float32), 10)
+ self.lines([P], stem, (width, width), 0.85, 0.85, 0.85, (0.3, 0.1), soft=0.6, k=min(15, len(P)),
+ seed=int(r.integers(1 << 30)))
+ cum = np.r_[0, np.cumsum(np.linalg.norm(np.diff(P, axis=0), axis=1))]
+ out = []
+ for i in range(n):
+ t = 0.12 + 0.86 * (i + 0.5 * (i % 2) + r.uniform(-0.3, 0.3)) / max(1, n)
+ t = float(np.clip(t, 0.05, 0.98))
+ j = int(np.searchsorted(cum, t * cum[-1]))
+ j = min(max(j, 1), len(P) - 2)
+ p = P[j]; tg = P[j + 1] - P[j - 1]; tg /= np.linalg.norm(tg) + 1e-6
+ sgn = 1 if i % 2 == 0 else -1
+ ang = np.arctan2(tg[1], tg[0]) + sgn * np.deg2rad(spread + r.normal(0, 14))
+ Ls = r.uniform(*size) * (1 - 0.45 * t)
+ tip = p + np.array([np.cos(ang), np.sin(ang)]) * Ls
+ al = 1.0 if fade is None else float(fade(p[1]))
+ cl = colours[i % len(colours)]
+ self.leaf(p, tip, Ls * round_, cl, bend=0.1 * sgn, alpha=al, seed=int(r.integers(1 << 30)))
+ out.append((p, tip))
+ return out
+
+ # ================================================================== finish and output
+ def finish(self, soft=0.25, grain=1.0, warmth=0.3):
+ """record the finishing (applied in render, so every stage snapshot matches the final look)"""
+ self.fin = dict(soft=soft, grain=grain, 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.7) for c in range(3)], -1)
+ out = out * (1 - f['soft']) + b * f['soft']
+ if f['warmth']:
+ lum = out.mean(-1, keepdims=True)
+ ink = 1 - smoothstep(0.9, 0.99, lum) # the bare paper stays as it is
+ out = out * (1 + f['warmth'] * ink * np.array([0.012, 0.002, -0.016], 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.008 * (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