Unités en mm

This commit is contained in:
Alex 2026-10-10 10:36:56 +02:00
parent 34984e96f7
commit d9486a6c96
10 changed files with 93 additions and 33 deletions

View File

@ -73,8 +73,10 @@ aplanis mais les yeux, la bouche et le bord du visage restent nets, et les
- Repère d'assemblage : chaque planche porte, en plus de son trait de découpe
(rouge), le contour de la planche suivante (noir), au tracé exact de sa
découpe, pour savoir où la coller.
- Numéros à graver : chaque pièce d'une planche porte son numéro, encadré,
et chaque zone marquée porte le numéro de la planche qui vient s'y coller.
- Numéros à graver, dans une troisième couleur (bleu) : chaque planche porte
son numéro, encadré, et chaque zone marquée porte le numéro de la planche
qui vient s'y coller. Tous se logent sous la planche suivante : aucun ne se
voit une fois la pile collée, et la planche du dessus n'en porte aucun.
Les chiffres sont tracés en segments droits, sans police de caractères.
- Variante « Son gris seul » : chaque calque contient l'aplat de son gris,
bordé sur tous ses côtés ; les planches pavent l'image sans se recouvrir et
@ -168,7 +170,8 @@ vide.
### Conseils
- **Découpe laser** : choisir « Aucun remplissage » ; il ne reste que les
traits de découpe (rouge) et de marquage (noir), à affecter chacun à son
traits de découpe (rouge), de marquage (noir) et des numéros (bleu), à
affecter chacun à son
réglage dans le logiciel de la machine. Découper un calque par feuille.
Avec la position « Juxtaposées », les planches sont rangées côte à côte :
on voit chacune en entier sans masquer les autres calques.
@ -211,7 +214,7 @@ Onglet **Niveaux**
| Contenu de chaque planche | Empilées, la plus claire devant | « Empilées, la plus claire devant » : planche n° 1 = la plus sombre, toute l'image. « Empilées, la plus sombre devant » : planche n° 1 = la plus claire, toute l'image. « Son gris seul » : planches côte à côte, sans recouvrement, planche n° 1 = le gris le plus sombre. |
| Position des planches | Superposées, à la place de l'image | « Superposées » : toutes les planches à la place de l'image, comme une fois collées. « Juxtaposées » : chaque planche dans sa case d'une grille à droite de l'image, avec son repère, prête à être découpée seule. |
| Reporter sur chaque planche le contour de la suivante | oui | Repère d'assemblage tracé dans la couleur de marquage (planches empilées uniquement). |
| Écrire les numéros des planches | oui | Numéros tracés en segments dans la couleur de marquage, à graver. Encadré : le numéro de la planche, sur chacune de ses pièces, caché sous la planche suivante quand la place le permet. Sans cadre : le numéro de la planche à coller dans cette zone marquée. |
| Écrire les numéros des planches | oui | Numéros tracés en segments dans la couleur des numéros, à graver. Encadré : le numéro de la planche. Sans cadre : le numéro de la planche à coller dans cette zone marquée. Sur des planches empilées, les deux se logent sous la planche suivante : aucun numéro ne se voit une fois les planches collées (une pièce trop peu recouverte reste sans numéro), et la planche du dessus n'en porte aucun. Avec « Son gris seul », rien ne s'empile : chaque pièce garde son numéro visible. |
| Lissage (% du grand côté de l'image) | 1 | Lissage appliqué avant la découpe : plus il est fort, plus les contours sont ronds et simples. |
| Préserver les contours lors du lissage | oui | Aplanit la peau et les textures mais garde nettes les transitions marquées (portraits, photos). Décoché : flou gaussien simple, mieux adapté aux reliefs abstraits. |
| Résolution de calcul (points sur le grand côté) | 800 | Taille à laquelle l'image est rééchantillonnée pour le calcul. |
@ -248,6 +251,7 @@ Onglet **Style**
| Unité | mm | Unité de l'épaisseur du trait. |
| Couleur du trait de découpe | rouge | Contour de la planche. |
| Couleur du trait de marquage | noir | Repère de la planche suivante. |
| Couleur du trait des numéros | bleu | Numéros des planches, à graver à part de la découpe et du repère. |
| Conserver l'image d'origine | oui | Sinon l'image est supprimée. |
## Structure du projet
@ -298,7 +302,7 @@ gris (0 noir, 1 blanc) ; un anneau est un tableau `(n, 2)` de points, en
| `region_rings(field, lines, inside)` | Contour fermé d'une région bornée par des lignes de niveau, refermé le long du bord de l'image. |
| `iso_boards(field, levels, blur, min_area, tolerance, shapes, preserve_edges, equalize)` | Une planche par niveau : liste de `(niveau, gris, anneaux, repère)`, le repère étant la ligne de niveau qui borde la planche suivante. |
| `iso_layers(…)` | Comme `iso_boards`, sans les repères. |
| `board_labels(rings, following, number, width, height, largest, smallest)` | Emplacement et taille des numéros d'une planche : le sien par pièce, celui de la suivante par zone marquée. |
| `board_labels(rings, following, number, width, height, largest, smallest, hidden=False)` | Emplacement et taille des numéros d'une planche : le sien par pièce, celui de la suivante par zone marquée. Avec `hidden`, le sien uniquement sous la planche suivante. |
| `number_lines(number, x, y, height, framed)` / `number_size(…)` | Tracé d'un numéro en segments, cadre facultatif ; son encombrement. |
| `region_mask(rings, width, height, step)` / `mask_depth(mask)` / `mask_components(mask)` | Région en grille de booléens, distance au bord, parties d'un seul tenant. |
| `image_ring(width, height)` | Rectangle de l'image. |

View File

@ -32,7 +32,7 @@
gui-description="Assembly guide: the outline of the board to glue on top is drawn in the marking color, without being cut.">true</param>
<param name="numbers" type="bool"
gui-text="Write the board numbers"
gui-description="Drawn in the marking color, to engrave. Framed number: the number of the board itself, on each of its pieces, hidden under the next board when there is room. Plain number: the board to glue in that marked area.">true</param>
gui-description="Drawn in the number color, to engrave. Framed number: the number of the board itself. Plain number: the board to glue in that marked area. On stacked boards both sit under the next board, so no number shows once the boards are glued, and the top board carries none.">true</param>
<param name="blur" type="float" precision="2" min="0" max="20"
gui-text="Smoothing (% of the image's longer side):"
gui-description="Smoothing applied before cutting the levels: the higher it is, the rounder and simpler the outlines.">1.0</param>
@ -94,6 +94,8 @@
gui-text="Cut stroke color:">4278190335</param>
<param name="mark_color" type="color" appearance="colorbutton"
gui-text="Marking stroke color:">255</param>
<param name="number_color" type="color" appearance="colorbutton"
gui-text="Number stroke color:">65535</param>
<param name="keep_original" type="bool"
gui-text="Keep the original image">true</param>
</page>
@ -110,7 +112,7 @@
The image is smoothed, then split into the requested number of gray levels with evenly spaced thresholds. Each level becomes one closed path that follows the edge of its flat area, like a contour line on a map.
Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, each piece of a board carries its own number in a frame, and each marked area carries, without a frame, the number of the board to glue there. With "Its own gray only", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.
Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, drawn in the number color (blue), each board carries its own number in a frame and each marked area carries, without a frame, the number of the board to glue there; both sit under the next board, so no number shows on the glued stack, and the top board carries none. With "Its own gray only", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.
For a relief that follows the real volumes of a portrait rather than its light and shadows, raise the depth map share (Depth tab): at 100, the boards follow the volumes, and the fine details setting carves the eyes and the mouth into them. A depth map made elsewhere (8 or 16 bits) can also be imported and selected like any image, with a share of 0. In both cases, if most boards come out empty or the subject only gets a few of them, raise the level distribution.

View File

@ -74,6 +74,7 @@ class GrayIsoLayers(inkex.EffectExtension):
pars.add_argument("--unit", default="mm")
pars.add_argument("--stroke_color", default="4278190335")
pars.add_argument("--mark_color", default="255")
pars.add_argument("--number_color", default="65535")
pars.add_argument("--keep_original", type=inkex.Boolean, default=True)
def effect(self):
@ -174,11 +175,17 @@ class GrayIsoLayers(inkex.EffectExtension):
# Numeros a graver : celui de la planche, encadre, sur chacune de
# ses pieces, et celui de la planche suivante la ou elle se pose.
if opt.numbers and self.mark_style() is not None:
following = boards[number][2] if mark is not None else None
# Dans une pile ils restent sous la planche suivante, donc caches
# une fois les planches collees, et la planche du dessus, que rien
# ne recouvre, n'en porte aucun.
stacked = opt.shapes != "band"
following = boards[number][2] if stacked and number < len(boards) else None
number_style = self.number_style() if opt.numbers else None
if number_style is not None and (following or not stacked):
own, after = board_labels(
rings, following, number, cols, rows,
largest=0.03 * max(rows, cols), smallest=0.008 * max(rows, cols))
largest=0.03 * max(rows, cols), smallest=0.008 * max(rows, cols),
hidden=stacked)
parts = [number_lines(number, x, y, size, framed=True)
for x, y, size in own]
parts += [number_lines(number + 1, x, y, size) for x, y, size in after]
@ -189,7 +196,7 @@ class GrayIsoLayers(inkex.EffectExtension):
node = inkex.PathElement()
node.label = _("Numbers")
node.set("d", d)
node.style = self.mark_style()
node.style = number_style
layer.add(node)
if not opt.keep_original:
@ -250,6 +257,16 @@ class GrayIsoLayers(inkex.EffectExtension):
"stroke-width": str(round(width, 6)), "stroke-linejoin": "round",
"stroke-linecap": "round"})
def number_style(self):
"""Style des numeros : comme le repere d'assemblage, dans une couleur
a eux pour les graver a part. `None` s'il n'y a pas de trait."""
style = self.mark_style()
if style is not None:
color, opacity = parse_color(self.options.number_color, ("#0000ff", 1.0))
style["stroke"] = color
style["stroke-opacity"] = str(opacity)
return style
@staticmethod
def image_box(image, cols, rows):
"""Rectangle reellement occupe par le bitmap, dans le repere de l'image.

View File

@ -681,8 +681,10 @@ def iso_layers(field, levels=16, blur=0.0, min_area=0.0, tolerance=0.0,
# Numeros des planches
#
# Chaque piece d'une planche porte son numero, encadre, et chaque zone ou se
# pose la planche suivante porte le numero de celle-ci. Les numeros sont
# traces en segments droits, sans police : ils se gravent tels quels.
# pose la planche suivante porte le numero de celle-ci. Dans une pile, les
# deux se logent sous la planche suivante : plus aucun numero ne se voit une
# fois les planches collees. Les numeros sont traces en segments droits, sans
# police : ils se gravent tels quels.
# --------------------------------------------------------------------------
# Segments d'un chiffre dans une case de 0.5 x 1 : a haut, b droite haut,
@ -804,7 +806,7 @@ def _number_height(number, radius, largest, framed):
def board_labels(rings, following, number, width, height, largest, smallest,
step=None):
step=None, hidden=False):
"""Emplacement des numeros a graver sur la planche `number`.
`rings` est le contour de la planche, `following` celui de la planche
@ -815,7 +817,9 @@ def board_labels(rings, following, number, width, height, largest, smallest,
- `own` : le numero de la planche, un par piece d'un seul tenant, a
encadrer. Il se place de preference sous la planche suivante, a l'ecart
du numero de celle-ci, pour etre cache une fois la pile collee ; sinon
sur la partie qui reste visible.
sur la partie qui reste visible. Avec `hidden`, une piece que la planche
suivante ne recouvre pas assez reste sans numero plutot que de le
montrer : rien ne se lit sur la pile collee.
Les chiffres mesurent au plus `largest` ; une piece ou une zone trop
etroite pour des chiffres de `smallest` ne recoit pas de numero.
"""
@ -851,7 +855,10 @@ def board_labels(rings, following, number, width, height, largest, smallest,
pieces, _count = mask_components(region)
own, done = [], set()
# D'abord sous la planche suivante (numero cache), puis a decouvert.
for mask in (region & covered & ~taken, region & ~covered & ~taken):
masks = [region & covered & ~taken]
if not hidden:
masks.append(region & ~covered & ~taken)
for mask in masks:
found, _labels = spots(mask, number, True)
for x, y, size, _label in sorted(found, key=lambda spot: -spot[2]):
j = int(np.argmin(np.abs(xs - x)))

View File

@ -70,8 +70,8 @@ msgid "Write the board numbers"
msgstr "Write the board numbers"
#: gray_iso_layers.inx
msgid "Drawn in the marking color, to engrave. Framed number: the number of the board itself, on each of its pieces, hidden under the next board when there is room. Plain number: the board to glue in that marked area."
msgstr "Drawn in the marking color, to engrave. Framed number: the number of the board itself, on each of its pieces, hidden under the next board when there is room. Plain number: the board to glue in that marked area."
msgid "Drawn in the number color, to engrave. Framed number: the number of the board itself. Plain number: the board to glue in that marked area. On stacked boards both sit under the next board, so no number shows once the boards are glued, and the top board carries none."
msgstr "Drawn in the number color, to engrave. Framed number: the number of the board itself. Plain number: the board to glue in that marked area. On stacked boards both sit under the next board, so no number shows once the boards are glued, and the top board carries none."
#: gray_iso_layers.inx
msgid "Smoothing (% of the image's longer side):"
@ -193,6 +193,10 @@ msgstr "Cut stroke color:"
msgid "Marking stroke color:"
msgstr "Marking stroke color:"
#: gray_iso_layers.inx
msgid "Number stroke color:"
msgstr "Number stroke color:"
#: gray_iso_layers.inx
msgid "Keep the original image"
msgstr "Keep the original image"
@ -207,7 +211,7 @@ msgid ""
"\n"
"The image is smoothed, then split into the requested number of gray levels with evenly spaced thresholds. Each level becomes one closed path that follows the edge of its flat area, like a contour line on a map.\n"
"\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, each piece of a board carries its own number in a frame, and each marked area carries, without a frame, the number of the board to glue there. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, drawn in the number color (blue), each board carries its own number in a frame and each marked area carries, without a frame, the number of the board to glue there; both sit under the next board, so no number shows on the glued stack, and the top board carries none. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"\n"
"For a relief that follows the real volumes of a portrait rather than its light and shadows, raise the depth map share (Depth tab): at 100, the boards follow the volumes, and the fine details setting carves the eyes and the mouth into them. A depth map made elsewhere (8 or 16 bits) can also be imported and selected like any image, with a share of 0. In both cases, if most boards come out empty or the subject only gets a few of them, raise the level distribution.\n"
"\n"
@ -217,7 +221,7 @@ msgstr ""
"\n"
"The image is smoothed, then split into the requested number of gray levels with evenly spaced thresholds. Each level becomes one closed path that follows the edge of its flat area, like a contour line on a map.\n"
"\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, each piece of a board carries its own number in a frame, and each marked area carries, without a frame, the number of the board to glue there. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, drawn in the number color (blue), each board carries its own number in a frame and each marked area carries, without a frame, the number of the board to glue there; both sit under the next board, so no number shows on the glued stack, and the top board carries none. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"\n"
"For a relief that follows the real volumes of a portrait rather than its light and shadows, raise the depth map share (Depth tab): at 100, the boards follow the volumes, and the fine details setting carves the eyes and the mouth into them. A depth map made elsewhere (8 or 16 bits) can also be imported and selected like any image, with a share of 0. In both cases, if most boards come out empty or the subject only gets a few of them, raise the level distribution.\n"
"\n"

View File

@ -70,8 +70,8 @@ msgid "Write the board numbers"
msgstr "Écrire les numéros des planches"
#: gray_iso_layers.inx
msgid "Drawn in the marking color, to engrave. Framed number: the number of the board itself, on each of its pieces, hidden under the next board when there is room. Plain number: the board to glue in that marked area."
msgstr "Tracés dans la couleur de marquage, à graver. Numéro encadré : celui de la planche elle-même, sur chacune de ses pièces, caché sous la planche suivante quand la place le permet. Numéro seul : la planche à coller dans cette zone marquée."
msgid "Drawn in the number color, to engrave. Framed number: the number of the board itself. Plain number: the board to glue in that marked area. On stacked boards both sit under the next board, so no number shows once the boards are glued, and the top board carries none."
msgstr "Tracés dans la couleur des numéros, à graver. Numéro encadré : celui de la planche elle-même. Numéro seul : la planche à coller dans cette zone marquée. Sur des planches empilées, les deux se logent sous la planche suivante : aucun numéro ne se voit une fois les planches collées, et la planche du dessus n'en porte aucun."
#: gray_iso_layers.inx
msgid "Smoothing (% of the image's longer side):"
@ -193,6 +193,10 @@ msgstr "Couleur du trait de découpe :"
msgid "Marking stroke color:"
msgstr "Couleur du trait de marquage :"
#: gray_iso_layers.inx
msgid "Number stroke color:"
msgstr "Couleur du trait des numéros :"
#: gray_iso_layers.inx
msgid "Keep the original image"
msgstr "Conserver l'image d'origine"
@ -207,7 +211,7 @@ msgid ""
"\n"
"The image is smoothed, then split into the requested number of gray levels with evenly spaced thresholds. Each level becomes one closed path that follows the edge of its flat area, like a contour line on a map.\n"
"\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, each piece of a board carries its own number in a frame, and each marked area carries, without a frame, the number of the board to glue there. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, drawn in the number color (blue), each board carries its own number in a frame and each marked area carries, without a frame, the number of the board to glue there; both sit under the next board, so no number shows on the glued stack, and the top board carries none. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"\n"
"For a relief that follows the real volumes of a portrait rather than its light and shadows, raise the depth map share (Depth tab): at 100, the boards follow the volumes, and the fine details setting carves the eyes and the mouth into them. A depth map made elsewhere (8 or 16 bits) can also be imported and selected like any image, with a share of 0. In both cases, if most boards come out empty or the subject only gets a few of them, raise the level distribution.\n"
"\n"
@ -217,7 +221,7 @@ msgstr ""
"\n"
"L'image est lissée, puis découpée en autant de niveaux de gris que demandé, avec des seuils régulièrement espacés. Chaque niveau devient un chemin fermé qui suit le bord de son aplat, comme une courbe de niveau sur une carte.\n"
"\n"
"Chaque niveau de gris va dans son propre calque, nommé Planche n° 1, Planche n° 2… du fond vers l'avant, ajouté au-dessus de l'image : il y a donc autant de nouveaux calques que de niveaux de gris. Les planches sont faites pour être découpées puis empilées : la planche n° 1 couvre toute l'image et chaque planche suivante, plus petite, se pose devant la précédente, la plus claire (ou la plus sombre) devant. Dans chaque calque, le contour de découpe de la planche est tracé dans la couleur de découpe (rouge), et le contour de la planche suivante est reporté dans la couleur de marquage (noir), pour montrer où la coller. Avec les numéros des planches, chaque pièce d'une planche porte son propre numéro dans un cadre, et chaque zone marquée porte, sans cadre, le numéro de la planche à y coller. Avec « Son gris seul », une planche contient uniquement l'aplat de son gris : les aplats pavent l'image sans se recouvrir et ne portent aucun marquage. Plusieurs images sélectionnées partagent les mêmes calques. Avec des planches juxtaposées, chaque planche est déplacée dans sa propre case d'une grille à droite de l'image, avec son marquage, pour que chacune puisse être vue et découpée seule.\n"
"Chaque niveau de gris va dans son propre calque, nommé Planche n° 1, Planche n° 2… du fond vers l'avant, ajouté au-dessus de l'image : il y a donc autant de nouveaux calques que de niveaux de gris. Les planches sont faites pour être découpées puis empilées : la planche n° 1 couvre toute l'image et chaque planche suivante, plus petite, se pose devant la précédente, la plus claire (ou la plus sombre) devant. Dans chaque calque, le contour de découpe de la planche est tracé dans la couleur de découpe (rouge), et le contour de la planche suivante est reporté dans la couleur de marquage (noir), pour montrer où la coller. Avec les numéros des planches, tracés dans la couleur des numéros (bleu), chaque planche porte son propre numéro dans un cadre et chaque zone marquée porte, sans cadre, le numéro de la planche à y coller ; les deux se logent sous la planche suivante : aucun numéro ne se voit sur la pile collée, et la planche du dessus n'en porte aucun. Avec « Son gris seul », une planche contient uniquement l'aplat de son gris : les aplats pavent l'image sans se recouvrir et ne portent aucun marquage. Plusieurs images sélectionnées partagent les mêmes calques. Avec des planches juxtaposées, chaque planche est déplacée dans sa propre case d'une grille à droite de l'image, avec son marquage, pour que chacune puisse être vue et découpée seule.\n"
"\n"
"Pour un relief qui suit les vrais volumes d'un portrait plutôt que ses lumières et ses ombres, augmentez la part de la carte de profondeur (onglet Profondeur) : à 100, les planches suivent les volumes, et le réglage des détails fins y grave les yeux et la bouche. Une carte de profondeur produite ailleurs (8 ou 16 bits) peut aussi être importée et sélectionnée comme n'importe quelle image, avec une part de 0. Dans les deux cas, si la plupart des planches sortent vides ou si le sujet n'en reçoit que quelques-unes, augmentez la répartition des niveaux.\n"
"\n"

View File

@ -68,7 +68,7 @@ msgid "Write the board numbers"
msgstr ""
#: gray_iso_layers.inx
msgid "Drawn in the marking color, to engrave. Framed number: the number of the board itself, on each of its pieces, hidden under the next board when there is room. Plain number: the board to glue in that marked area."
msgid "Drawn in the number color, to engrave. Framed number: the number of the board itself. Plain number: the board to glue in that marked area. On stacked boards both sit under the next board, so no number shows once the boards are glued, and the top board carries none."
msgstr ""
#: gray_iso_layers.inx
@ -191,6 +191,10 @@ msgstr ""
msgid "Marking stroke color:"
msgstr ""
#: gray_iso_layers.inx
msgid "Number stroke color:"
msgstr ""
#: gray_iso_layers.inx
msgid "Keep the original image"
msgstr ""
@ -205,7 +209,7 @@ msgid ""
"\n"
"The image is smoothed, then split into the requested number of gray levels with evenly spaced thresholds. Each level becomes one closed path that follows the edge of its flat area, like a contour line on a map.\n"
"\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, each piece of a board carries its own number in a frame, and each marked area carries, without a frame, the number of the board to glue there. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"Each gray level goes into its own layer, named Board no. 1, Board no. 2... from the back to the front, added above the image: as many new layers as gray levels. The boards are meant to be cut and stacked: board no. 1 covers the whole image and each following board is smaller and lies in front of the previous one, lightest (or darkest) in front. In each layer, the cut outline of the board is drawn in the cut color (red), and the outline of the next board is carried over in the marking color (black), to show where to glue it. With the board numbers, drawn in the number color (blue), each board carries its own number in a frame and each marked area carries, without a frame, the number of the board to glue there; both sit under the next board, so no number shows on the glued stack, and the top board carries none. With \"Its own gray only\", a board holds the flat area of its gray alone: the flat areas tile the image without overlapping and carry no marking. Several selected images share the same layers. With the boards side by side, each board is moved into its own cell of a grid to the right of the image, with its marking, so that every board can be seen and cut on its own.\n"
"\n"
"For a relief that follows the real volumes of a portrait rather than its light and shadows, raise the depth map share (Depth tab): at 100, the boards follow the volumes, and the fine details setting carves the eyes and the mouth into them. A depth map made elsewhere (8 or 16 bits) can also be imported and selected like any image, with a share of 0. In both cases, if most boards come out empty or the subject only gets a few of them, raise the level distribution.\n"
"\n"

View File

@ -622,7 +622,17 @@ def test_board_labels_number_each_piece_and_each_marked_area():
assert math.hypot(nx - 50, ny - 50) < 2 and nsize == 6.0
assert contains(boards[1][2], x, y) and size >= 2.0
assert math.hypot(x - nx, y - ny) > 6.0
# Derniere planche : rien ne la recouvre, son numero reste visible.
# Numeros caches seulement : une planche trop peu recouverte pour loger
# son numero sous la suivante reste sans numero, plutot que de le montrer.
small = [np.array([(48, 48), (52, 48), (52, 52), (48, 52)], dtype=float)]
own, after = board_labels(boards[0][2], small, 1, 101, 101, 6.0, 2.0)
assert len(own) == 1 and not contains(small, own[0][0], own[0][1])
assert board_labels(boards[0][2], small, 1, 101, 101, 6.0, 2.0,
hidden=True)[0] == []
own, _after = board_labels(boards[0][2], boards[1][2], 1, 101, 101, 6.0, 2.0,
hidden=True)
assert len(own) == 1 and contains(boards[1][2], own[0][0], own[0][1])
# Planche sans suivante (aplats "band") : son numero reste visible.
own, after = board_labels(boards[3][2], None, 4, 101, 101, 6.0, 2.0)
assert after == [] and len(own) == 1
assert contains(boards[3][2], own[0][0], own[0][1])
@ -914,17 +924,25 @@ def test_end_to_end_boards_side_by_side(tmp_path):
def test_end_to_end_numbers(tmp_path):
svg = run_extension(tmp_path, "--id=img1", "--levels=4", "--blur=0",
"--numbers=true")
# Un chemin de numeros par planche, en plus de la decoupe et du repere.
# Un chemin de numeros par planche, en plus de la decoupe et du repere,
# sauf sur la planche du dessus : rien ne viendrait cacher son numero.
assert layers_of(svg) == [("Photo", 0), ("Board no. 1", 3), ("Board no. 2", 3),
("Board no. 3", 3), ("Board no. 4", 2), ("Dessus", 0)]
("Board no. 3", 3), ("Board no. 4", 1), ("Dessus", 0)]
numbered = [path for path in paths(svg) if 'label="Numbers"' in path]
assert len(numbered) == 4
assert len(numbered) == 3
# Une troisieme couleur, ni celle de la decoupe ni celle du repere.
for path in numbered:
assert "fill:none" in path and "stroke:#000000" in path and "C " not in path
assert "fill:none" in path and "stroke:#0000ff" in path and "C " not in path
# Planche n° 1 : son numero encadre (un cadre ferme, 2 segments) et le
# numero 2 (5 segments) ; la derniere n'a que le sien (4 segments).
# numero 2 (5 segments), tous deux sous la planche n° 2.
assert numbered[0].count("Z") == 1 and numbered[0].count("M ") == 1 + 2 + 5
assert numbered[3].count("Z") == 1 and numbered[3].count("M ") == 1 + 4
svg = run_extension(tmp_path, "--id=img1", "--levels=4", "--blur=0",
"--numbers=true", "--number_color={}".format(0x00AA00FF))
assert sum("stroke:#00aa00" in path for path in paths(svg)) == 3
# Aplats seuls : rien ne s'empile, chaque piece garde son numero visible.
svg = run_extension(tmp_path, "--id=img1", "--levels=4", "--blur=0",
"--numbers=true", "--shapes=band")
assert sum('label="Numbers"' in path for path in paths(svg)) == 4
# Sans trait, rien a graver.
svg = run_extension(tmp_path, "--id=img1", "--levels=4", "--blur=0",
"--numbers=true", "--stroke_width=0")