sigilmc 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sigilmc-0.1.0/LICENSE +21 -0
- sigilmc-0.1.0/PKG-INFO +74 -0
- sigilmc-0.1.0/README.md +50 -0
- sigilmc-0.1.0/pyproject.toml +31 -0
- sigilmc-0.1.0/setup.cfg +4 -0
- sigilmc-0.1.0/src/sigilmc/__init__.py +0 -0
- sigilmc-0.1.0/src/sigilmc/cli.py +45 -0
- sigilmc-0.1.0/src/sigilmc/datatypes.py +118 -0
- sigilmc-0.1.0/src/sigilmc/dessin.py +130 -0
- sigilmc-0.1.0/src/sigilmc/exceptions.py +36 -0
- sigilmc-0.1.0/src/sigilmc/exemples.py +11 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/PKG-INFO +74 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/SOURCES.txt +15 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/dependency_links.txt +1 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/entry_points.txt +2 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/requires.txt +14 -0
- sigilmc-0.1.0/src/sigilmc.egg-info/top_level.txt +2 -0
sigilmc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pauline J.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sigilmc-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sigilmc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dessinateur de sigils pour les Hermétistes pressés
|
|
5
|
+
Author: Pauline J.
|
|
6
|
+
License: MIT
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: cairocffi==1.7.1
|
|
10
|
+
Requires-Dist: CairoSVG==2.9.1
|
|
11
|
+
Requires-Dist: cffi==2.1.1
|
|
12
|
+
Requires-Dist: cssselect2==0.10.1
|
|
13
|
+
Requires-Dist: defusedxml==0.7.1
|
|
14
|
+
Requires-Dist: drawsvg==2.4.2
|
|
15
|
+
Requires-Dist: ImageIO==2.38.1
|
|
16
|
+
Requires-Dist: imageio-ffmpeg==0.8.0
|
|
17
|
+
Requires-Dist: numpy==2.5.4
|
|
18
|
+
Requires-Dist: pillow==13.0.0
|
|
19
|
+
Requires-Dist: pwkit==1.3.1
|
|
20
|
+
Requires-Dist: pycparser==3.12
|
|
21
|
+
Requires-Dist: tinycss2==1.5.1
|
|
22
|
+
Requires-Dist: webencodings==0.6.1
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
<img src="img/logo.png" height="200px"/>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
# SIGIL MAY CRY
|
|
30
|
+
|
|
31
|
+
Sigil May Cry, ou SigilMC permet de dessiner en calligraphie sigillaire sans se casser le cul à déplacer des .png pixelisés. Les sigils sont crées vectoriellement, permettant une très haute définition.
|
|
32
|
+
|
|
33
|
+
## FAQ
|
|
34
|
+
|
|
35
|
+
> **C'est quoi, un sigil ?**
|
|
36
|
+
|
|
37
|
+
Ce dépôt n'est pas destiné à ceux qui ne savent pas de quoi il parle, pour des raisons qui seront évidentes pour certains, et pour mes proches : bonjour ! Comment ça va ? Il n'y a rien à voir ici ahahahah
|
|
38
|
+
|
|
39
|
+
> **Est-ce que je peux enfreindre les règles de base des Sigils ?**
|
|
40
|
+
|
|
41
|
+
**Non.** Trois arcanums par strophe, trois stophes par cercle, trois cercles par sigil, pas plus.
|
|
42
|
+
|
|
43
|
+
> **Je suis Sylkabe.**
|
|
44
|
+
|
|
45
|
+
Bonjour !
|
|
46
|
+
|
|
47
|
+
## Syntaxe
|
|
48
|
+
|
|
49
|
+
- Les arcanums d'une srophe sont séparés par un tiret (`-`)
|
|
50
|
+
- Les strophes d'un cercle sont séparées par un point-virgule (`;`)
|
|
51
|
+
- Les strophes peuvent être dupliquées à l'aide d'un astérisque (`*`)
|
|
52
|
+
- Les cercles d'un sigil sont séparés par un slash (`/`)
|
|
53
|
+
|
|
54
|
+
### Exemple
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
3 * liquide - augmenter - chaleur / 2 * air - augmenter - froid ; air - augmenter - taille
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<img src="img/sigilBrume.png" height="300px"/>
|
|
61
|
+
|
|
62
|
+
## À faire
|
|
63
|
+
- Sigils :
|
|
64
|
+
- [ ] Corps
|
|
65
|
+
- [ ] Force
|
|
66
|
+
- [ ] Cycle perpétuel
|
|
67
|
+
- Ergonomie :
|
|
68
|
+
- [x] Outil CLI
|
|
69
|
+
- [ ] Méthode d'utilisation simple pour les non-initiés à python 😰😰😰
|
|
70
|
+
- Fonctionnalités :
|
|
71
|
+
- [ ] Options d'export
|
|
72
|
+
- [ ] Entrée par fichier
|
|
73
|
+
- [ ] Format de fichier compréhensible
|
|
74
|
+
- [ ] Possibilité de générer plusieurs sigils et de les exporter en masse
|
sigilmc-0.1.0/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="img/logo.png" height="200px"/>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# SIGIL MAY CRY
|
|
6
|
+
|
|
7
|
+
Sigil May Cry, ou SigilMC permet de dessiner en calligraphie sigillaire sans se casser le cul à déplacer des .png pixelisés. Les sigils sont crées vectoriellement, permettant une très haute définition.
|
|
8
|
+
|
|
9
|
+
## FAQ
|
|
10
|
+
|
|
11
|
+
> **C'est quoi, un sigil ?**
|
|
12
|
+
|
|
13
|
+
Ce dépôt n'est pas destiné à ceux qui ne savent pas de quoi il parle, pour des raisons qui seront évidentes pour certains, et pour mes proches : bonjour ! Comment ça va ? Il n'y a rien à voir ici ahahahah
|
|
14
|
+
|
|
15
|
+
> **Est-ce que je peux enfreindre les règles de base des Sigils ?**
|
|
16
|
+
|
|
17
|
+
**Non.** Trois arcanums par strophe, trois stophes par cercle, trois cercles par sigil, pas plus.
|
|
18
|
+
|
|
19
|
+
> **Je suis Sylkabe.**
|
|
20
|
+
|
|
21
|
+
Bonjour !
|
|
22
|
+
|
|
23
|
+
## Syntaxe
|
|
24
|
+
|
|
25
|
+
- Les arcanums d'une srophe sont séparés par un tiret (`-`)
|
|
26
|
+
- Les strophes d'un cercle sont séparées par un point-virgule (`;`)
|
|
27
|
+
- Les strophes peuvent être dupliquées à l'aide d'un astérisque (`*`)
|
|
28
|
+
- Les cercles d'un sigil sont séparés par un slash (`/`)
|
|
29
|
+
|
|
30
|
+
### Exemple
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
3 * liquide - augmenter - chaleur / 2 * air - augmenter - froid ; air - augmenter - taille
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
<img src="img/sigilBrume.png" height="300px"/>
|
|
37
|
+
|
|
38
|
+
## À faire
|
|
39
|
+
- Sigils :
|
|
40
|
+
- [ ] Corps
|
|
41
|
+
- [ ] Force
|
|
42
|
+
- [ ] Cycle perpétuel
|
|
43
|
+
- Ergonomie :
|
|
44
|
+
- [x] Outil CLI
|
|
45
|
+
- [ ] Méthode d'utilisation simple pour les non-initiés à python 😰😰😰
|
|
46
|
+
- Fonctionnalités :
|
|
47
|
+
- [ ] Options d'export
|
|
48
|
+
- [ ] Entrée par fichier
|
|
49
|
+
- [ ] Format de fichier compréhensible
|
|
50
|
+
- [ ] Possibilité de générer plusieurs sigils et de les exporter en masse
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sigilmc"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Dessinateur de sigils pour les Hermétistes pressés"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Pauline J." }
|
|
9
|
+
]
|
|
10
|
+
dependencies = [
|
|
11
|
+
"cairocffi==1.7.1",
|
|
12
|
+
"CairoSVG==2.9.1",
|
|
13
|
+
"cffi==2.1.1",
|
|
14
|
+
"cssselect2==0.10.1",
|
|
15
|
+
"defusedxml==0.7.1",
|
|
16
|
+
"drawsvg==2.4.2",
|
|
17
|
+
"ImageIO==2.38.1",
|
|
18
|
+
"imageio-ffmpeg==0.8.0",
|
|
19
|
+
"numpy==2.5.4",
|
|
20
|
+
"pillow==13.0.0",
|
|
21
|
+
"pwkit==1.3.1",
|
|
22
|
+
"pycparser==3.12",
|
|
23
|
+
"tinycss2==1.5.1",
|
|
24
|
+
"webencodings==0.6.1"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
sigilmc = "sigilmc.cli:main"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.packages.find]
|
|
31
|
+
where = ["src"]
|
sigilmc-0.1.0/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
from sigilmc.dessin import dessin
|
|
4
|
+
from sigilmc.exceptions import FormatNonSupporteError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
prog="sigilmc",
|
|
10
|
+
description="Dessinateur de sigils pour les Hermétistes pressés"
|
|
11
|
+
)
|
|
12
|
+
parser.add_argument("sigil", help="Le sigil à dessiner")
|
|
13
|
+
parser.add_argument("-o", "--output", help="Chemin vers le fichier à générer")
|
|
14
|
+
parser.add_argument("-s", "--strophe",
|
|
15
|
+
action="store_true",
|
|
16
|
+
help="Active le mode strophe, permettant de générer qu'une strophe ou un arcanum")
|
|
17
|
+
parser.add_argument("-p", "--pixelscale", type=int, help="Définit la qualité du rendu")
|
|
18
|
+
args = parser.parse_args()
|
|
19
|
+
|
|
20
|
+
# Lecture des arguments
|
|
21
|
+
pixel_scale = 16
|
|
22
|
+
if args.pixelscale: pixel_scale = args.pixelscale
|
|
23
|
+
strophe = args.strophe
|
|
24
|
+
sigil = args.sigil
|
|
25
|
+
output = "sigil.png"
|
|
26
|
+
output_type = "png"
|
|
27
|
+
if args.output:
|
|
28
|
+
output = args.output
|
|
29
|
+
output_type = output.split(".")[-1]
|
|
30
|
+
# Dessin
|
|
31
|
+
d = dessin(sigil, strophe, pixel_scale)
|
|
32
|
+
# Sauvegarde
|
|
33
|
+
if output_type == "png":
|
|
34
|
+
d.save_png(output)
|
|
35
|
+
elif output_type == "svg":
|
|
36
|
+
d.save_svg(output)
|
|
37
|
+
elif output_type == "gif":
|
|
38
|
+
d.save_gif(output,
|
|
39
|
+
fps=1,
|
|
40
|
+
duration=0)
|
|
41
|
+
else:
|
|
42
|
+
raise FormatNonSupporteError(output_type)
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
main()
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
from sigilmc.exceptions import (
|
|
6
|
+
ArcanumNotFoundError,
|
|
7
|
+
CercleTropGrandError,
|
|
8
|
+
CercleVideError,
|
|
9
|
+
SigilTropGrandError,
|
|
10
|
+
SigilVideError,
|
|
11
|
+
StropheTropLongueError,
|
|
12
|
+
StropheVideError,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
ARCANUM_FILE_PATH = os.path.join(os.path.dirname(__file__), "../data/arcanums.json")
|
|
16
|
+
with open(ARCANUM_FILE_PATH) as arc:
|
|
17
|
+
ARCANUMS = json.load(arc)
|
|
18
|
+
|
|
19
|
+
class Suite:
|
|
20
|
+
x: float
|
|
21
|
+
y: float
|
|
22
|
+
taille: float
|
|
23
|
+
def __init__(self, x: float, y:float, taille: float) -> None:
|
|
24
|
+
self.x = x
|
|
25
|
+
self.y = y
|
|
26
|
+
self.taille = taille
|
|
27
|
+
|
|
28
|
+
class Arcanum:
|
|
29
|
+
nom: str
|
|
30
|
+
dessin: list[dict]
|
|
31
|
+
suite: Suite
|
|
32
|
+
def __init__(self, nom: str) -> None:
|
|
33
|
+
if nom in dict(ARCANUMS["arcanums"]):
|
|
34
|
+
self.nom = nom
|
|
35
|
+
elif nom in dict(ARCANUMS["alias"]):
|
|
36
|
+
self.nom = ARCANUMS["alias"][nom]
|
|
37
|
+
else:
|
|
38
|
+
raise ArcanumNotFoundError(nom)
|
|
39
|
+
arc_data = dict(ARCANUMS["arcanums"][self.nom])
|
|
40
|
+
self.dessin = arc_data["dessin"]
|
|
41
|
+
suitedict = arc_data["suite"]
|
|
42
|
+
self.suite = Suite(suitedict["x"], suitedict["y"], suitedict["taille"])
|
|
43
|
+
|
|
44
|
+
class Strophe:
|
|
45
|
+
strophe: str
|
|
46
|
+
nb_arcanums: int
|
|
47
|
+
arcanums: list[Arcanum]
|
|
48
|
+
def __init__(self, strophe:str) -> None:
|
|
49
|
+
arcstrings = [a.strip() for a in strophe.lower().split("-")]
|
|
50
|
+
self.nb_arcanums = len(arcstrings)
|
|
51
|
+
if self.nb_arcanums > 3:
|
|
52
|
+
raise StropheTropLongueError(strophe, self.nb_arcanums)
|
|
53
|
+
elif self.nb_arcanums == 0:
|
|
54
|
+
raise StropheVideError
|
|
55
|
+
self.arcanums = [Arcanum(a) for a in arcstrings]
|
|
56
|
+
self.strophe = strophe
|
|
57
|
+
|
|
58
|
+
class ContraintePlace(Enum):
|
|
59
|
+
AUCUNE = 0
|
|
60
|
+
HAUT = 1
|
|
61
|
+
BAS = 2
|
|
62
|
+
COTES = 3
|
|
63
|
+
|
|
64
|
+
class Cercle:
|
|
65
|
+
nb_strophes: int
|
|
66
|
+
strophes: list[Strophe]
|
|
67
|
+
cercle: str
|
|
68
|
+
contrainte: ContraintePlace
|
|
69
|
+
def __init__(self, cercle: str, contrainte_sup: ContraintePlace) -> None:
|
|
70
|
+
stpstrings = [s.strip() for s in cercle.lower().split(";")]
|
|
71
|
+
# Gestion des multiples, pour pas avoir à taper la même strophe 3 fois
|
|
72
|
+
for i in range(len(stpstrings)):
|
|
73
|
+
if "*" in stpstrings[i]:
|
|
74
|
+
stp = [s.strip() for s in stpstrings[i].split("*")]
|
|
75
|
+
stpstrings.pop(i)
|
|
76
|
+
for j in range(int(stp[0])):
|
|
77
|
+
stpstrings.insert(i, stp[1])
|
|
78
|
+
self.nb_strophes = len(stpstrings)
|
|
79
|
+
if self.nb_strophes > 3:
|
|
80
|
+
raise CercleTropGrandError(cercle, self.nb_strophes)
|
|
81
|
+
elif self.nb_strophes == 0:
|
|
82
|
+
raise CercleVideError
|
|
83
|
+
# Attribution des contraintes.
|
|
84
|
+
# Cela permet aux cercles de pas se chevaucher
|
|
85
|
+
# Ici, s'il n'y a qu'un tercet, il est en haut s'il en a la place
|
|
86
|
+
# et s'il y en a 3 la "pointe" du triangle sera à l'opposée de la précédente
|
|
87
|
+
elif self.nb_strophes != 2:
|
|
88
|
+
if contrainte_sup == ContraintePlace.HAUT:
|
|
89
|
+
self.contrainte = ContraintePlace.BAS
|
|
90
|
+
else:
|
|
91
|
+
self.contrainte = ContraintePlace.HAUT
|
|
92
|
+
else:
|
|
93
|
+
if contrainte_sup == ContraintePlace.COTES:
|
|
94
|
+
# Manière dégueu de dire qu'il est à la verticale
|
|
95
|
+
self.contrainte = ContraintePlace.BAS
|
|
96
|
+
else:
|
|
97
|
+
self.contrainte = ContraintePlace.COTES
|
|
98
|
+
self.strophes = [Strophe(stp) for stp in stpstrings]
|
|
99
|
+
self.cercle = cercle
|
|
100
|
+
|
|
101
|
+
class Sigil:
|
|
102
|
+
nb_cercles: int
|
|
103
|
+
cercles: list[Cercle]
|
|
104
|
+
sigil: str
|
|
105
|
+
def __init__(self, sigil: str) -> None:
|
|
106
|
+
cclstrings = [c.strip() for c in sigil.lower().split("/")]
|
|
107
|
+
self.nb_cercles = len(cclstrings)
|
|
108
|
+
if self.nb_cercles > 3:
|
|
109
|
+
raise SigilTropGrandError(sigil, self.nb_cercles)
|
|
110
|
+
elif self.nb_cercles == 0:
|
|
111
|
+
raise SigilVideError
|
|
112
|
+
contrainte = ContraintePlace.AUCUNE
|
|
113
|
+
self.cercles = []
|
|
114
|
+
for c in cclstrings:
|
|
115
|
+
nv_cercle = Cercle(c, contrainte)
|
|
116
|
+
self.cercles.append(nv_cercle)
|
|
117
|
+
contrainte = nv_cercle.contrainte
|
|
118
|
+
self.sigil = sigil
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import drawsvg as draw
|
|
5
|
+
|
|
6
|
+
from sigilmc.datatypes import Arcanum, Cercle, ContraintePlace, Sigil, Strophe
|
|
7
|
+
from sigilmc.exceptions import FormeInconnueError
|
|
8
|
+
|
|
9
|
+
CERCLES_FILE_PATH = os.path.join(os.path.dirname(__file__), "../data/cercles.json")
|
|
10
|
+
with open(CERCLES_FILE_PATH) as f:
|
|
11
|
+
AGENCEMENTS = json.load(f)["agencements"]
|
|
12
|
+
|
|
13
|
+
### FONCTIONS DE DESSIN DE FORMES DE BASE
|
|
14
|
+
def draw_lines(coords:list[list], size: int,
|
|
15
|
+
stroke_width = 1.0) -> draw.Group:
|
|
16
|
+
g = draw.Group()
|
|
17
|
+
coords_actual = [ [c[0]*size, c[1]*size] for c in coords ] # Mise en forme des coordonnées pour la taille réelle
|
|
18
|
+
for c in range(1, len(coords_actual)):
|
|
19
|
+
g.append(draw.Line(coords_actual[c-1][0], coords_actual[c-1][1],
|
|
20
|
+
coords_actual[c][0], coords_actual[c][1],
|
|
21
|
+
stroke="black",
|
|
22
|
+
stroke_width=stroke_width))
|
|
23
|
+
return g
|
|
24
|
+
|
|
25
|
+
def draw_circle(x: float, y: float, r: float,
|
|
26
|
+
fill: str, size: int, stroke_width=1.0) -> draw.Group:
|
|
27
|
+
g = draw.Group()
|
|
28
|
+
x, y, r = x*size, y*size, r*size
|
|
29
|
+
g.append(draw.Circle(x, y, r,
|
|
30
|
+
fill=fill,
|
|
31
|
+
stroke="black",
|
|
32
|
+
stroke_width=stroke_width))
|
|
33
|
+
return g
|
|
34
|
+
|
|
35
|
+
def draw_arc(x: float, y: float, r: float,
|
|
36
|
+
angle1: int, angle2: int,
|
|
37
|
+
size: int, stroke_width=1.0) -> draw.Group:
|
|
38
|
+
g = draw.Group()
|
|
39
|
+
x, y, r = x * size, y*size, r*size
|
|
40
|
+
g.append(draw.Arc(x, y, r, angle1, angle2,
|
|
41
|
+
fill="transparent",
|
|
42
|
+
stroke="black",
|
|
43
|
+
stroke_width=stroke_width))
|
|
44
|
+
return g
|
|
45
|
+
|
|
46
|
+
def draw_curve(coords: list, size: int, stroke_width=1.0) -> draw.Group:
|
|
47
|
+
g = draw.Group()
|
|
48
|
+
p = draw.Path(stroke="black", fill="transparent", stroke_width=stroke_width)
|
|
49
|
+
sx, sy, c1x, c1y, c2x, c2y, ex, ey = tuple([c*size for c in coords])
|
|
50
|
+
p.M(sx, sy)
|
|
51
|
+
p.C(c1x, c1y, c2x, c2y, ex, ey)
|
|
52
|
+
g.append(p)
|
|
53
|
+
return g
|
|
54
|
+
|
|
55
|
+
### FONCTIONS DE DESSIN D'OBJETS / SIGILS
|
|
56
|
+
def draw_arcanum(arc: Arcanum, size: int, stroke_width=1.0) -> draw.Group:
|
|
57
|
+
g = draw.Group()
|
|
58
|
+
for dsn in arc.dessin:
|
|
59
|
+
forme = dsn["type"]
|
|
60
|
+
if forme == "lines":
|
|
61
|
+
coords = dsn["coords"]
|
|
62
|
+
g.append(draw_lines(coords, size, stroke_width))
|
|
63
|
+
elif forme == "circle":
|
|
64
|
+
x, y, r, fill = dsn["x"], dsn["y"], dsn["r"], dsn["fill"]
|
|
65
|
+
g.append(draw_circle(x, y, r, fill, size, stroke_width))
|
|
66
|
+
elif forme == "arc":
|
|
67
|
+
x, y, r, angle1, angle2 = dsn["x"], dsn["y"], dsn["r"], dsn["angles"][0], dsn["angles"][1]
|
|
68
|
+
g.append(draw_arc(x, y, r, angle1, angle2, size, stroke_width))
|
|
69
|
+
elif forme == "curve":
|
|
70
|
+
coords = dsn["coords"]
|
|
71
|
+
g.append(draw_curve(coords, size, stroke_width))
|
|
72
|
+
else:
|
|
73
|
+
raise FormeInconnueError(forme)
|
|
74
|
+
return g
|
|
75
|
+
|
|
76
|
+
def draw_strophe(stp: Strophe, size: int, encercler=False, stroke_width=1.0) -> draw.Group:
|
|
77
|
+
g = draw.Group()
|
|
78
|
+
x, y = 0, 0
|
|
79
|
+
if encercler:
|
|
80
|
+
g.append(draw.Circle(0, 0, 0.5*size,
|
|
81
|
+
fill="white", stroke="black",
|
|
82
|
+
stroke_width=stroke_width))
|
|
83
|
+
size = int(size*0.7)
|
|
84
|
+
for arc in stp.arcanums:
|
|
85
|
+
g.append(draw.Use(draw_arcanum(arc, size, stroke_width), x, y))
|
|
86
|
+
suite = arc.suite
|
|
87
|
+
size = int(suite.taille * size)
|
|
88
|
+
x = int(x + suite.x * size)
|
|
89
|
+
y = int(y + suite.y * size)
|
|
90
|
+
return g
|
|
91
|
+
|
|
92
|
+
def agencement(taille_cercle: int, contrainte: ContraintePlace) -> str:
|
|
93
|
+
if taille_cercle == 1:
|
|
94
|
+
if contrainte == ContraintePlace.BAS: return "mono_bas"
|
|
95
|
+
else: return "mono_haut"
|
|
96
|
+
if taille_cercle == 2:
|
|
97
|
+
if contrainte == ContraintePlace.COTES: return "duo_hrzn"
|
|
98
|
+
else: return "duo_vert"
|
|
99
|
+
else:
|
|
100
|
+
if contrainte == ContraintePlace.BAS: return "triangle_bas"
|
|
101
|
+
else: return "triangle_haut"
|
|
102
|
+
|
|
103
|
+
def draw_cercle(ccl: Cercle, size: int, max_size: int) -> draw.Group:
|
|
104
|
+
g = draw.Group()
|
|
105
|
+
agcm = AGENCEMENTS[agencement(ccl.nb_strophes, ccl.contrainte)]
|
|
106
|
+
coords = agcm["coords"]
|
|
107
|
+
stp_size = int(max_size / 6)
|
|
108
|
+
g.append(draw.Circle(0, 0, 0.4*size, fill="white", stroke="black", stroke_width=0.25))
|
|
109
|
+
for i in range(ccl.nb_strophes):
|
|
110
|
+
stp_draw = draw_strophe(ccl.strophes[i], stp_size, encercler=True, stroke_width=0.25)
|
|
111
|
+
x, y = coords[i][0] * size, coords[i][1] * size
|
|
112
|
+
g.append(draw.Use(stp_draw, x, y))
|
|
113
|
+
return g
|
|
114
|
+
|
|
115
|
+
def draw_sigil(sigil: Sigil, size: int) -> draw.Group:
|
|
116
|
+
g = draw.Group()
|
|
117
|
+
ccl_size = int((1/3) * sigil.nb_cercles * size)
|
|
118
|
+
for ccl in sigil.cercles:
|
|
119
|
+
g.append(draw.Use(draw_cercle(ccl, ccl_size, size), 0, 0))
|
|
120
|
+
ccl_size = int(ccl_size - 0.3 * size)
|
|
121
|
+
return g
|
|
122
|
+
|
|
123
|
+
def dessin(sigil: str, strophe: bool, pixel_scale: int) -> draw.Drawing:
|
|
124
|
+
d = draw.Drawing(100, 100, origin="center")
|
|
125
|
+
if strophe:
|
|
126
|
+
d.append(draw.Use(draw_strophe(Strophe(sigil), 95, encercler=False), 0, 0))
|
|
127
|
+
else:
|
|
128
|
+
d.append(draw.Use(draw_sigil(Sigil(sigil), 100), 0 ,0))
|
|
129
|
+
d.set_pixel_scale(pixel_scale)
|
|
130
|
+
return d
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class ArcanumNotFoundError(Exception):
|
|
2
|
+
def __init__(self, nom: str) -> None:
|
|
3
|
+
self.message = f"ERREUR / Arcanum non-reconnu : {nom}"
|
|
4
|
+
super().__init__(self.message)
|
|
5
|
+
|
|
6
|
+
class StropheTropLongueError(Exception):
|
|
7
|
+
def __init__(self, strophe: str, taille: int) -> None:
|
|
8
|
+
super().__init__(f"La strophe « {strophe} » contient {taille} arcanums. Il doit y en avoir moins de 3.")
|
|
9
|
+
|
|
10
|
+
class CercleTropGrandError(Exception):
|
|
11
|
+
def __init__(self, strophe: str, taille: int) -> None:
|
|
12
|
+
super().__init__(f"Le cercle « {strophe} » contient {taille} strophes. Il doit y en avoir moins de 3.")
|
|
13
|
+
|
|
14
|
+
class SigilTropGrandError(Exception):
|
|
15
|
+
def __init__(self, strophe: str, taille: int) -> None:
|
|
16
|
+
super().__init__(f"Le sigil « {strophe} » contient {taille} cercles. Il doit y en avoir moins de 3.")
|
|
17
|
+
|
|
18
|
+
class StropheVideError(Exception):
|
|
19
|
+
def __init__(self) -> None:
|
|
20
|
+
super().__init__("La strophe est vide.")
|
|
21
|
+
|
|
22
|
+
class CercleVideError(Exception):
|
|
23
|
+
def __init__(self) -> None:
|
|
24
|
+
super().__init__("Le cercle est vide.")
|
|
25
|
+
|
|
26
|
+
class SigilVideError(Exception):
|
|
27
|
+
def __init__(self) -> None:
|
|
28
|
+
super().__init__("Le sigil est vide.")
|
|
29
|
+
|
|
30
|
+
class FormeInconnueError(Exception):
|
|
31
|
+
def __init__(self, forme: str) -> None:
|
|
32
|
+
super().__init__(f"Forme géométrique non-reconnue : {forme}")
|
|
33
|
+
|
|
34
|
+
class FormatNonSupporteError(Exception):
|
|
35
|
+
def __init__(self, format: str) -> None:
|
|
36
|
+
super().__init__(f"Format de fichier non supporté : {format}, seuls .png, .svg et .gif sont acceptés.")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from sigilmc.datatypes import Cercle, ContraintePlace, Sigil, Strophe
|
|
2
|
+
|
|
3
|
+
strophe = Strophe("sigil - augmenter - vitesse")
|
|
4
|
+
cercleFeu = Cercle("eau - augmenter - chaleur ; terre - augmenter - chaleur ; air - augmenter - chaleur", ContraintePlace.AUCUNE)
|
|
5
|
+
cercleLapis = Cercle("métal - diminuer - taille ; métal - augmenter - masse", ContraintePlace.AUCUNE)
|
|
6
|
+
cercleLichen = Cercle("lichen - vers - mort", ContraintePlace.AUCUNE)
|
|
7
|
+
|
|
8
|
+
sigilFeu = Sigil("3 * terre - augmenter - chaleur / 3 * air - augmenter - chaleur / 3 * eau - augmenter - chaleur")
|
|
9
|
+
sigilLapis = Sigil("métal - augmenter - masse ; métal - diminuer - taille")
|
|
10
|
+
sigilBrume = Sigil("3*liquide-augmenter-chaleur/2*air-augmenter-FROID;air-augmenter-taille")
|
|
11
|
+
sigilSigil = Sigil("3 * sigil - diminuer - résistance / 3 * sigil - augmenter - vitesse")
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sigilmc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dessinateur de sigils pour les Hermétistes pressés
|
|
5
|
+
Author: Pauline J.
|
|
6
|
+
License: MIT
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: cairocffi==1.7.1
|
|
10
|
+
Requires-Dist: CairoSVG==2.9.1
|
|
11
|
+
Requires-Dist: cffi==2.1.1
|
|
12
|
+
Requires-Dist: cssselect2==0.10.1
|
|
13
|
+
Requires-Dist: defusedxml==0.7.1
|
|
14
|
+
Requires-Dist: drawsvg==2.4.2
|
|
15
|
+
Requires-Dist: ImageIO==2.38.1
|
|
16
|
+
Requires-Dist: imageio-ffmpeg==0.8.0
|
|
17
|
+
Requires-Dist: numpy==2.5.4
|
|
18
|
+
Requires-Dist: pillow==13.0.0
|
|
19
|
+
Requires-Dist: pwkit==1.3.1
|
|
20
|
+
Requires-Dist: pycparser==3.12
|
|
21
|
+
Requires-Dist: tinycss2==1.5.1
|
|
22
|
+
Requires-Dist: webencodings==0.6.1
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
<img src="img/logo.png" height="200px"/>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
# SIGIL MAY CRY
|
|
30
|
+
|
|
31
|
+
Sigil May Cry, ou SigilMC permet de dessiner en calligraphie sigillaire sans se casser le cul à déplacer des .png pixelisés. Les sigils sont crées vectoriellement, permettant une très haute définition.
|
|
32
|
+
|
|
33
|
+
## FAQ
|
|
34
|
+
|
|
35
|
+
> **C'est quoi, un sigil ?**
|
|
36
|
+
|
|
37
|
+
Ce dépôt n'est pas destiné à ceux qui ne savent pas de quoi il parle, pour des raisons qui seront évidentes pour certains, et pour mes proches : bonjour ! Comment ça va ? Il n'y a rien à voir ici ahahahah
|
|
38
|
+
|
|
39
|
+
> **Est-ce que je peux enfreindre les règles de base des Sigils ?**
|
|
40
|
+
|
|
41
|
+
**Non.** Trois arcanums par strophe, trois stophes par cercle, trois cercles par sigil, pas plus.
|
|
42
|
+
|
|
43
|
+
> **Je suis Sylkabe.**
|
|
44
|
+
|
|
45
|
+
Bonjour !
|
|
46
|
+
|
|
47
|
+
## Syntaxe
|
|
48
|
+
|
|
49
|
+
- Les arcanums d'une srophe sont séparés par un tiret (`-`)
|
|
50
|
+
- Les strophes d'un cercle sont séparées par un point-virgule (`;`)
|
|
51
|
+
- Les strophes peuvent être dupliquées à l'aide d'un astérisque (`*`)
|
|
52
|
+
- Les cercles d'un sigil sont séparés par un slash (`/`)
|
|
53
|
+
|
|
54
|
+
### Exemple
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
3 * liquide - augmenter - chaleur / 2 * air - augmenter - froid ; air - augmenter - taille
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<img src="img/sigilBrume.png" height="300px"/>
|
|
61
|
+
|
|
62
|
+
## À faire
|
|
63
|
+
- Sigils :
|
|
64
|
+
- [ ] Corps
|
|
65
|
+
- [ ] Force
|
|
66
|
+
- [ ] Cycle perpétuel
|
|
67
|
+
- Ergonomie :
|
|
68
|
+
- [x] Outil CLI
|
|
69
|
+
- [ ] Méthode d'utilisation simple pour les non-initiés à python 😰😰😰
|
|
70
|
+
- Fonctionnalités :
|
|
71
|
+
- [ ] Options d'export
|
|
72
|
+
- [ ] Entrée par fichier
|
|
73
|
+
- [ ] Format de fichier compréhensible
|
|
74
|
+
- [ ] Possibilité de générer plusieurs sigils et de les exporter en masse
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/sigilmc/__init__.py
|
|
5
|
+
src/sigilmc/cli.py
|
|
6
|
+
src/sigilmc/datatypes.py
|
|
7
|
+
src/sigilmc/dessin.py
|
|
8
|
+
src/sigilmc/exceptions.py
|
|
9
|
+
src/sigilmc/exemples.py
|
|
10
|
+
src/sigilmc.egg-info/PKG-INFO
|
|
11
|
+
src/sigilmc.egg-info/SOURCES.txt
|
|
12
|
+
src/sigilmc.egg-info/dependency_links.txt
|
|
13
|
+
src/sigilmc.egg-info/entry_points.txt
|
|
14
|
+
src/sigilmc.egg-info/requires.txt
|
|
15
|
+
src/sigilmc.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
cairocffi==1.7.1
|
|
2
|
+
CairoSVG==2.9.1
|
|
3
|
+
cffi==2.1.1
|
|
4
|
+
cssselect2==0.10.1
|
|
5
|
+
defusedxml==0.7.1
|
|
6
|
+
drawsvg==2.4.2
|
|
7
|
+
ImageIO==2.38.1
|
|
8
|
+
imageio-ffmpeg==0.8.0
|
|
9
|
+
numpy==2.5.4
|
|
10
|
+
pillow==13.0.0
|
|
11
|
+
pwkit==1.3.1
|
|
12
|
+
pycparser==3.12
|
|
13
|
+
tinycss2==1.5.1
|
|
14
|
+
webencodings==0.6.1
|