-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpropaint.php
More file actions
15478 lines (13569 loc) · 618 KB
/
propaint.php
File metadata and controls
15478 lines (13569 loc) · 618 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// GESTION DES UPLOADS DE FORMES IMG
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['formeImgUpload'])) {
header('Content-Type: application/json');
$response = ['success' => false, 'message' => ''];
try {
$uploadDir = __DIR__ . '/formeimgpropaint/';
if (!file_exists($uploadDir)) {
if (!mkdir($uploadDir, 0755, true)) {
throw new Exception("Impossible de créer le dossier formeimgpropaint");
}
}
$file = $_FILES['formeImgUpload'];
$fileName = $file['name'];
$fileTmp = $file['tmp_name'];
$fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($fileExt, ['png', 'jpg', 'jpeg', 'webp'])) {
// Nettoyer le nom de fichier
$cleanName = preg_replace('/[^a-zA-Z0-9._-]/', '', $fileName);
$destPath = $uploadDir . $cleanName;
if (move_uploaded_file($fileTmp, $destPath)) {
$response['success'] = true;
$response['message'] = "Image uploadée avec succès";
$response['url'] = 'formeimgpropaint/' . $cleanName;
} else {
throw new Exception("Erreur lors du déplacement du fichier");
}
} else {
throw new Exception("Format non supporté (PNG, JPG, WEBP)");
}
} catch (Exception $e) {
$response['message'] = $e->getMessage();
}
echo json_encode($response);
exit;
}
// LISTAGE DES FORMES IMG
if (isset($_GET['action']) && $_GET['action'] === 'list_formeimgs') {
header('Content-Type: application/json');
$dir = __DIR__ . '/formeimgpropaint/';
$files = [];
if (is_dir($dir)) {
foreach (scandir($dir) as $f) {
if (preg_match('/\.(png|jpg|jpeg|webp)$/i', $f)) {
$files[] = 'formeimgpropaint/' . $f;
}
}
}
echo json_encode($files);
exit;
}
// LISTAGE DES TEXTURES
if (isset($_GET['action']) && $_GET['action'] === 'list_textures') {
header('Content-Type: application/json');
$dir = __DIR__ . '/texture/';
$files = [];
if (is_dir($dir)) {
foreach (scandir($dir) as $f) {
if (preg_match('/\.(png|jpg|jpeg|webp|avif)$/i', $f)) {
$files[] = 'texture/' . $f;
}
}
}
echo json_encode($files);
exit;
}
// GESTION DES UPLOADS DE POLICES (FONTS)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['fontUpload'])) {
header('Content-Type: application/json');
$response = ['success' => false, 'message' => '', 'fontName' => '', 'fontUrl' => ''];
try {
$uploadDir = __DIR__ . '/fontfam/';
if (!file_exists($uploadDir)) {
if (!mkdir($uploadDir, 0755, true)) {
throw new Exception("Impossible de créer le dossier fontfam");
}
}
$file = $_FILES['fontUpload'];
$fileName = $file['name'];
$fileTmp = $file['tmp_name'];
$fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$baseName = pathinfo($fileName, PATHINFO_FILENAME);
// Créer un sous-dossier pour cette police
$fontDir = $uploadDir . $baseName . '/';
if (!file_exists($fontDir)) {
if (!mkdir($fontDir, 0755, true)) {
throw new Exception("Impossible de créer le dossier de la police");
}
}
if ($fileExt === 'zip') {
$zip = new ZipArchive;
if ($zip->open($fileTmp) === TRUE) {
$zip->extractTo($fontDir);
$zip->close();
// Chercher le premier fichier .ttf ou .otf extrait
$files = scandir($fontDir);
$fontFile = null;
foreach ($files as $f) {
if (preg_match('/\.(ttf|otf)$/i', $f)) {
$fontFile = $f;
break;
}
}
if ($fontFile) {
$response['success'] = true;
$response['message'] = "Police extraite avec succès";
$response['fontName'] = pathinfo($fontFile, PATHINFO_FILENAME);
$response['fontUrl'] = 'fontfam/' . $baseName . '/' . $fontFile;
} else {
throw new Exception("Aucun fichier .ttf ou .otf trouvé dans le ZIP");
}
} else {
throw new Exception("Impossible d'ouvrir le fichier ZIP");
}
} elseif ($fileExt === 'ttf' || $fileExt === 'otf') {
$destPath = $fontDir . $fileName;
if (move_uploaded_file($fileTmp, $destPath)) {
$response['success'] = true;
$response['message'] = "Police uploadée avec succès";
$response['fontName'] = $baseName;
$response['fontUrl'] = 'fontfam/' . $baseName . '/' . $fileName;
} else {
throw new Exception("Erreur lors du déplacement du fichier");
}
} else {
throw new Exception("Format de fichier non supporté (ZIP, TTF, OTF uniquement)");
}
} catch (Exception $e) {
$response['message'] = $e->getMessage();
}
echo json_encode($response);
exit;
}
// LISTAGE AUTOMATIQUE DES POLICES DANS fontfam/
$availableFonts = [];
$fontBaseDir = __DIR__ . '/fontfam/';
if (is_dir($fontBaseDir)) {
foreach (scandir($fontBaseDir) as $dir) {
if ($dir === '.' || $dir === '..') continue;
$fullDir = $fontBaseDir . $dir;
if (!is_dir($fullDir)) continue;
foreach (scandir($fullDir) as $file) {
if (preg_match('/\.(ttf|otf)$/i', $file)) {
$fontPath = 'fontfam/' . $dir . '/' . $file;
$fontName = pathinfo($file, PATHINFO_FILENAME);
$availableFonts[] = [
'name' => $fontName,
'url' => $fontPath
];
}
}
}
}
?>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="https://dihu.fr/appgithub/iconedihu/9.png" type="image/png">
<link rel="icon" href="https://dihu.fr/appgithub/iconedihu/9.png" type="image/png">
<title>ProPaint</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<script>
window.preloadedFonts = <?php echo json_encode($availableFonts, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); ?>;
</script>
<style>
/* Custom font for the italic text */
.italic-text {
font-family: Georgia, serif;
}
/* Scrollbar styling for vertical toolbar */
.scrollbar-thin::-webkit-scrollbar {
width: 6px;
}
.scrollbar-thin::-webkit-scrollbar-track {
background: #2d2d2d;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background-color: #555;
border-radius: 3px;
}
.checkerboard {
background-image:
linear-gradient(45deg, #ccc 25%, transparent 25%),
linear-gradient(-45deg, #ccc 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #ccc 75%),
linear-gradient(-45deg, transparent 75%, #ccc 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type=number] {
-moz-appearance:textfield;
}
</style>
</head>
<body class="bg-[#1e1e1e] text-[#f0d98c] font-sans select-none">
<div class="flex flex-col h-screen w-full">
<!-- Top menu bar -->
<div class="flex items-center bg-[#2d2d2d] text-[#c0c0c0] text-[13px] font-normal px-2 select-text" style="font-family: Arial, sans-serif;">
<div class="flex space-x-4">
<span class="cursor-default">File</span>
<span class="cursor-pointer hover:text-white relative group">
Edit
<div class="absolute left-0 top-full bg-[#3a3a3a] border border-[#555] hidden group-hover:block min-w-[150px] z-50 shadow-lg">
<button onclick="copyObjectToLibrary()" class="block w-full text-left px-4 py-2 hover:bg-[#4a4a4a]">Objet Copier</button>
<button onclick="showClipboardModal()" class="block w-full text-left px-4 py-2 hover:bg-[#4a4a4a]">Bibliothèque</button>
</div>
</span>
<span class="cursor-default">Image</span>
<span class="cursor-default">Layer</span>
<span class="cursor-default">Type</span>
<span class="cursor-default">Select</span>
<span class="cursor-default">Filter</span>
<span class="cursor-default">View</span>
<span class="cursor-pointer hover:text-white relative group">
Window
<div class="absolute left-0 top-full bg-[#3a3a3a] border border-[#555] hidden group-hover:block min-w-[200px] z-50 shadow-lg">
<button onclick="showProjectOptions()" class="block w-full text-left px-4 py-2 hover:bg-[#4a4a4a]">Affichage Projet</button>
</div>
</span>
<span class="cursor-default">Help</span>
</div>
</div>
<!-- Project Options Modal -->
<div id="projectOptionsModal" class="fixed inset-0 bg-black bg-opacity-80 z-50 hidden flex items-center justify-center">
<div class="bg-[#2d2d2d] w-[600px] max-h-[90vh] rounded-lg flex flex-col relative border border-[#555] p-4 overflow-y-auto">
<button onclick="document.getElementById('projectOptionsModal').classList.add('hidden')" class="absolute top-2 right-2 text-red-500 hover:text-red-400 text-2xl z-50">
<i class="fas fa-times"></i>
</button>
<h2 class="text-xl mb-4 text-[#f0d98c] border-b border-[#555] pb-2">Options d'Affichage Projet</h2>
<div class="grid grid-cols-2 gap-4 mb-4">
<!-- Social Media -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Réseaux Sociaux</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(1280, 720)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">YouTube Miniature HD (1280x720)</button>
<button onclick="resizeCanvas(3840, 2160)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">YouTube Miniature 4K (3840x2160)</button>
<button onclick="resizeCanvas(1080, 1920)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Shorts / TikTok / Reel HD (1080x1920)</button>
<button onclick="resizeCanvas(2160, 3840)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Shorts / TikTok 4K (2160x3840)</button>
</div>
</div>
<!-- Wallpapers -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Fonds d'écran</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(1920, 1080)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Wallpaper PC HD (1920x1080)</button>
<button onclick="resizeCanvas(3840, 2160)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Wallpaper PC 4K (3840x2160)</button>
<button onclick="resizeCanvas(1080, 1920)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Wallpaper Smartphone (1080x1920)</button>
</div>
</div>
<!-- Bannières -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Bannières</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(2000, 500)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Bannière Fine (2000x500)</button>
<button onclick="resizeCanvas(2000, 1000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Bannière Normale (2000x1000)</button>
<button onclick="resizeCanvas(2000, 1500)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Bannière Large (2000x1500)</button>
<button onclick="resizeCanvas(2000, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Bannière Très Large (2000x2000)</button>
</div>
</div>
<!-- Bannières Verticales -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Bannières Verticales</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(500, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Verticale Fine (500x2000)</button>
<button onclick="resizeCanvas(1000, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Verticale Normale (1000x2000)</button>
<button onclick="resizeCanvas(1500, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Verticale Large (1500x2000)</button>
<button onclick="resizeCanvas(2000, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Verticale Très Large (2000x2000)</button>
</div>
</div>
<!-- Divers -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Divers</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(1000, 1000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Basique (1000x1000)</button>
<button onclick="resizeCanvas(512, 512)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Icône (512x512)</button>
<button onclick="resizeCanvas(500, 500)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Logo (500x500)</button>
<button onclick="resizeCanvas(2000, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Carré HD (2000x2000)</button>
<button onclick="resizeCanvas(5000, 5000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Carré Ultra (5000x5000)</button>
</div>
</div>
<!-- Grands Formats -->
<div>
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Grands Formats</h3>
<div class="space-y-1">
<button onclick="resizeCanvas(3500, 2000)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Large (3500x2000)</button>
<button onclick="resizeCanvas(2500, 4500)" class="w-full text-left px-3 py-2 bg-[#3a3a3a] hover:bg-[#4a4a4a] rounded text-xs">Vertical (2500x4500)</button>
</div>
</div>
</div>
<!-- Sur Mesure -->
<div class="border-t border-[#555] pt-4 mt-2">
<h3 class="text-[#00aaff] font-bold mb-2 text-sm">Format Sur Mesure</h3>
<div class="flex space-x-2 items-end">
<div class="flex-1">
<label class="block text-xs mb-1">Largeur (px)</label>
<input type="number" id="customWidth" placeholder="ex: 1920" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 text-sm">
</div>
<div class="flex-1">
<label class="block text-xs mb-1">Hauteur (px)</label>
<input type="number" id="customHeight" placeholder="ex: 1080" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 text-sm">
</div>
<button onclick="applyCustomResize()" class="bg-[#00aaff] hover:bg-[#0088cc] text-white px-4 py-1 rounded text-sm h-[30px]">
Valider
</button>
</div>
</div>
</div>
</div>
<!-- Second horizontal bar with icons and options -->
<div class="flex items-center bg-[#3a3a3a] text-[#c0c0c0] text-[13px] font-normal px-2 select-none space-x-4 h-10">
<button id="undoBtn" aria-label="Undo" class="flex items-center space-x-1 hover:bg-[#4a4a4a] px-2 rounded">
<i class="fas fa-undo text-[16px]"></i>
<span>Undo</span>
</button>
<button id="redoBtn" aria-label="Redo" class="flex items-center space-x-1 hover:bg-[#4a4a4a] px-2 rounded">
<i class="fas fa-redo text-[16px]"></i>
<span>Redo</span>
</button>
<div class="border-l border-[#555] h-6"></div>
<label for="uploadImage" class="cursor-pointer hover:bg-[#4a4a4a] px-2 rounded flex items-center space-x-2" title="Importer une image">
<i class="fas fa-upload text-[16px]"></i>
<span>Import</span>
</label>
<input type="file" id="uploadImage" accept="image/*" class="hidden" aria-label="Importer une image" />
<button id="downloadBtn" class="hover:bg-[#4a4a4a] px-2 rounded flex items-center space-x-2" title="Télécharger l'image en haute résolution">
<i class="fas fa-download text-[16px]"></i>
<span>Export</span>
</button>
<button id="clearErasedBtn" class="hover:bg-[#4a4a4a] px-2 rounded flex items-center space-x-2" title="Réinitialiser les zones effacées">
<i class="fas fa-undo-alt text-[16px]"></i>
<span>Reset Eraser</span>
</button>
</div>
<div class="flex flex-grow overflow-hidden">
<!-- Toolbar left vertical with scroll -->
<div id="leftToolbar" class="flex flex-col bg-[#2d2d2d] w-[48px] py-2 space-y-1 items-center select-none scrollbar-thin overflow-y-auto">
<!-- Brush icon -->
<button aria-label="Brush" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='brush-basic'; currentTool='brush-basic';">
<i class="fas fa-brush text-[20px]"></i>
</button>
<!-- Pencil icon -->
<button aria-label="Pencil" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='brush-pencil'; currentTool='brush-pencil';">
<i class="fas fa-pencil-alt text-[20px]"></i>
</button>
<!-- Eraser icon -->
<button aria-label="Eraser" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='eraser'; currentTool='eraser';">
<i class="fas fa-eraser text-[20px]"></i>
</button>
<!-- Shape icon -->
<button aria-label="Shape" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='shape-rectangle'; currentTool='shape-rectangle';">
<i class="fas fa-square text-[20px]"></i>
</button>
<!-- Circle icon -->
<button aria-label="Circle" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='shape-circle'; currentTool='shape-circle';">
<i class="fas fa-circle text-[20px]"></i>
</button>
<!-- Line icon -->
<button aria-label="Line" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='shape-line'; currentTool='shape-line';">
<i class="fas fa-slash text-[20px]"></i>
</button>
<!-- Select icon -->
<button aria-label="Select" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='select'; currentTool='select';">
<i class="fas fa-mouse-pointer text-[20px]"></i>
</button>
<!-- Copy icon -->
<button aria-label="Copy" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='copy'; currentTool='copy';">
<i class="fas fa-copy text-[20px]"></i>
</button>
<!-- Paste icon -->
<button aria-label="Paste" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='paste'; currentTool='paste';">
<i class="fas fa-paste text-[20px]"></i>
</button>
<!-- Lasso Free icon -->
<button aria-label="Lasso Free" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='lasso-free'; currentTool='lasso-free';">
<i class="fas fa-draw-polygon text-[20px]"></i>
</button>
<!-- Lasso Polygonal icon -->
<button aria-label="Lasso Polygonal" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='lasso-polygon'; currentTool='lasso-polygon';">
<i class="fas fa-bezier-curve text-[20px]"></i>
</button>
<!-- Lasso Magnetic icon -->
<button aria-label="Lasso Magnetic" class="w-10 h-10 flex items-center justify-center text-[#c0c0c0] hover:bg-[#3a3a3a] rounded" onclick="document.getElementById('toolSelect').value='lasso-magnetic'; currentTool='lasso-magnetic';">
<i class="fas fa-magnet text-[20px]"></i>
</button>
</div>
<!-- Main canvas area -->
<div class="flex-grow bg-[#252525] flex items-center justify-center relative overflow-auto">
<div id="canvasContainer" class="flex justify-center items-center relative bg-white checkerboard" style="min-height: 400px; width: 100%; height: 100%;">
<canvas id="drawingCanvas" width="3840" height="2160" class="border border-gray-400" aria-label="Canvas de dessin haute résolution" style="max-width: none; max-height: none;"></canvas>
</div>
</div>
<!-- Right panel with tools -->
<div id="rightPanel" class="flex flex-col bg-[#2d2d2d] w-[320px] min-w-[280px] max-w-full text-[#c0c0c0] select-none overflow-y-auto">
<!-- Tools section -->
<div id="toolsSection" class="p-3 bg-[#252525] border-b border-[#555]">
<h2 class="text-lg font-semibold mb-2">Tools</h2>
<select id="toolSelect" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-3 text-[#c0c0c0]">
<option value="brush-basic">Feutre Basique</option>
<option value="mode-shapes">Formes</option>
<option value="mode-text">Textes</option>
<option value="select">Sélection</option>
<option value="eraser">Gomme</option>
</select>
<!-- Container pour les formes spécifiques (visible uniquement si "Formes" est sélectionné) -->
<div id="shapeToolsContainer" class="hidden mb-3">
<label class="block mb-1 text-sm">Choisir une forme</label>
<select id="subShapeSelect" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 text-[#c0c0c0]">
<option value="shape-img" class="font-bold text-[#00aaff]">★ Formes Img (Images)</option>
<!-- FORMES DE BASE EXISTANTES -->
<option value="shape-rectangle">Rectangle</option>
<option value="shape-circle">Cercle</option>
<option value="shape-triangle">Triangle</option>
<option value="shape-line">Ligne</option>
<!-- NOUVELLES FORMES PHASE 2 -->
<option value="shape-point">Point</option>
<option value="shape-ellipse">Ellipse</option>
<option value="shape-diamond">Losange</option>
<option value="shape-pentagon">Pentagone</option>
<option value="shape-hexagon">Hexagone</option>
<option value="shape-octagon">Octogone</option>
<option value="shape-star5">Étoile 5 branches</option>
<option value="shape-star6">Étoile 6 branches</option>
<option value="shape-star8">Étoile 8 branches</option>
<option value="shape-heart">Cœur</option>
<option value="shape-arrow">Flèche</option>
<option value="shape-cloud">Nuage</option>
<!-- 5 NOUVELLES FORMES SUPPLÉMENTAIRES -->
<option value="shape-crescent">Croissant de Lune</option>
<option value="shape-droplet">Goutte d'eau</option>
<option value="shape-trapezoid">Trapèze</option>
<option value="shape-parallelogram">Parallélogramme</option>
<option value="shape-cross">Croix</option>
<!-- 20 NOUVELLES FORMES SUPPLÉMENTAIRES -->
<option value="shape-heptagon">Heptagone (7 côtés)</option>
<option value="shape-nonagon">Nonagone (9 côtés)</option>
<option value="shape-decagon">Décagone (10 côtés)</option>
<option value="shape-dodecagon">Dodécagone (12 côtés)</option>
<option value="shape-star3">Étoile 3 branches</option>
<option value="shape-star4">Étoile 4 branches</option>
<option value="shape-star7">Étoile 7 branches</option>
<option value="shape-star10">Étoile 10 branches</option>
<option value="shape-spiral">Spirale</option>
<option value="shape-gear">Engrenage</option>
<option value="shape-lightning">Éclair</option>
<option value="shape-leaf">Feuille</option>
<option value="shape-flower">Fleur</option>
<option value="shape-sun">Soleil</option>
<option value="shape-moon">Lune pleine</option>
<option value="shape-infinity">Infini (∞)</option>
<option value="shape-bubble">Bulle</option>
<option value="shape-crown">Couronne</option>
<option value="shape-gem">Diamant/Gemme</option>
<option value="shape-shield">Bouclier</option>
<option value="shape-eye">Œil</option>
<option value="shape-butterfly">Papillon</option>
<!-- NOUVELLES FORMES AJOUTÉES -->
<option value="shape-right-triangle">Triangle rectangle</option>
<option value="shape-obtuse-triangle">Triangle obtus</option>
<option value="shape-equilateral">Triangle équilatéral</option>
<option value="shape-arc">Arc</option>
<option value="shape-semicircle">Demi-cercle</option>
<option value="shape-quarter-circle">Quart de cercle</option>
<option value="shape-ring">Anneau</option>
<option value="shape-star12">Étoile 12 branches</option>
<option value="shape-star16">Étoile 16 branches</option>
<option value="shape-starburst">Étoile explosive</option>
<option value="shape-bean">Fève / haricot</option>
<option value="shape-pill">Pilule / capsule</option>
<option value="shape-stadium">Stade (rectangle arrondi)</option>
<option value="shape-ellipse-vertical">Ellipse verticale</option>
<option value="shape-ellipse-horizontal">Ellipse horizontale</option>
<option value="shape-wave">Vague</option>
<option value="shape-zigzag">Zigzag</option>
<option value="shape-sine">Onde sinusoïdale</option>
<option value="shape-trefoil">Trèfle à 3 feuilles</option>
<option value="shape-quatrefoil">Trèfle à 4 feuilles</option>
<option value="shape-bracket-left">Crochet gauche</option>
<option value="shape-bracket-right">Crochet droit</option>
<option value="shape-brace-left">Accolade gauche</option>
<option value="shape-brace-right">Accolade droite</option>
<option value="shape-chevron-up">Chevron haut</option>
<option value="shape-chevron-down">Chevron bas</option>
<option value="shape-chevron-left">Chevron gauche</option>
<option value="shape-chevron-right">Chevron droite</option>
<option value="shape-triangle-up">Triangle haut</option>
<option value="shape-triangle-down">Triangle bas</option>
<option value="shape-triangle-left">Triangle gauche</option>
<option value="shape-triangle-right">Triangle droite</option>
<option value="shape-mountain">Montagne</option>
<option value="shape-hill">Colline</option>
<option value="shape-tree">Arbre</option>
<option value="shape-fish">Poisson</option>
<option value="shape-bird">Oiseau</option>
<option value="shape-cat">Chat</option>
<option value="shape-dog">Chien</option>
<option value="shape-starfish">Étoile de mer</option>
<option value="shape-shell">Coquillage</option>
<option value="shape-apple">Pomme</option>
<option value="shape-cherry">Cerise</option>
<option value="shape-banana">Banane</option>
<option value="shape-car">Voiture</option>
<option value="shape-plane">Avion</option>
<option value="shape-rocket">Fusée</option>
<option value="shape-boat">Bateau</option>
<option value="shape-house">Maison</option>
<option value="shape-building">Building</option>
<option value="shape-door">Porte</option>
<option value="shape-window">Fenêtre</option>
<option value="shape-phone">Téléphone</option>
<option value="shape-laptop">Laptop</option>
<option value="shape-tv">Télévision</option>
<option value="shape-folder">Dossier</option>
<option value="shape-file">Fichier</option>
<option value="shape-trash">Poubelle</option>
<option value="shape-lock">Cadenas</option>
<option value="shape-key">Clé</option>
<option value="shape-map-pin">Pin map</option>
<option value="shape-location">Localisation</option>
<option value="shape-play">Play ▶</option>
<option value="shape-pause">Pause ⏸</option>
<option value="shape-stop">Stop ⏹</option>
<option value="shape-record">Record ⏺</option>
<option value="shape-volume">Volume 🔊</option>
<option value="shape-check">Check ✔</option>
<option value="shape-crossmark">Croix ✖</option>
<option value="shape-question">Point d'interrogation ?</option>
<option value="shape-exclamation">Point d’exclamation !</option>
<option value="shape-speech-bubble">Bulle de discussion</option>
<option value="shape-quote">Guillemets “ ”</option>
<option value="shape-hourglass">Sablier</option>
<option value="shape-loading">Loading (cercle segmenté)</option>
<option value="shape-target">Cible 🎯</option>
<option value="shape-scope">Viseur</option>
<option value="shape-compass">Boussole</option>
<option value="shape-anchor">Ancre ⚓</option>
<option value="shape-puzzle">Pièce de puzzle</option>
<option value="shape-jigsaw">Contour de puzzle</option>
<option value="shape-honeycomb">Cellule d’abeille</option>
<option value="shape-lattice">Grille diagonale</option>
<option value="shape-dna">Spirale ADN</option>
<option value="shape-molecule">Molécule</option>
<option value="shape-snowflake">Flocon de neige</option>
<option value="shape-fire">Flamme 🔥</option>
<option value="shape-water-splash">Éclaboussure</option>
<option value="shape-balloon">Ballon gonflé 🎈</option>
<option value="shape-flag">Drapeau</option>
<option value="shape-medal">Médaille</option>
<option value="shape-trophy">Trophée</option>
<option value="shape-book">Livre</option>
<option value="shape-scroll">Parchemin</option>
<option value="shape-music-note">Note de musique</option>
<option value="shape-music-double">Double note</option>
<option value="shape-eye-closed">Œil fermé</option>
<option value="shape-bolt-nut">Écrou hexagonal</option>
<option value="shape-screwdriver">Tournevis</option>
<option value="shape-cube">Cube (vue 3D)</option>
<option value="shape-pyramid">Pyramide (vue 3D)</option>
<option value="shape-cylinder">Cylindre (vue 3D)</option>
<option value="shape-fractal-tree">Arbre fractal</option>
<option value="shape-radial-burst">Explosion radiale</option>
<option value="shape-splat">Tache / éclat</option>
<!-- 5 NOUVELLES FORMES (ROUGE) -->
<option value="shape-spiral-galaxy" style="color: #ff4444; font-weight: bold;">Galaxie Spirale</option>
<option value="shape-tornado" style="color: #ff4444; font-weight: bold;">Tornade</option>
<option value="shape-dna-helix" style="color: #ff4444; font-weight: bold;">Hélice ADN</option>
<option value="shape-atom" style="color: #ff4444; font-weight: bold;">Atome</option>
<option value="shape-sacred-geo" style="color: #ff4444; font-weight: bold;">Géométrie Sacrée</option>
<!-- OPTION FORMES IMG -->
<option value="shape-img">Formes IMG (Images)</option>
</select>
<!-- UI FORMES IMG -->
<div id="formeImgContainer" class="hidden mt-2 p-2 bg-[#2d2d2d] rounded border border-[#555]">
<label class="block mb-1 text-xs font-bold">Bibliothèque Formes IMG</label>
<div id="formeImgList" class="grid grid-cols-4 gap-1 mb-2 max-h-[150px] overflow-y-auto border border-[#444] p-1 min-h-[50px]">
<!-- Images chargées via JS -->
</div>
<label class="cursor-pointer bg-[#444] hover:bg-[#555] text-xs px-2 py-1 rounded block text-center transition" title="Seuls les PNG conservent la transparence">
<i class="fas fa-plus"></i> Ajouter des formes img
<input type="file" id="formeImgInput" accept="image/png,image/jpeg,image/webp" class="hidden">
</label>
</div>
<!-- UI OPTIONS DE STYLE DE FORME -->
<div id="shapeStyleOptionsContainer" class="hidden mt-2 p-2 bg-[#252525] rounded border border-[#555]">
<!-- Options dynamiques injectées ici -->
</div>
</div>
<!-- Style d'image global avancé -->
<div id="imageStylePanel" class="hidden p-3 bg-[#252525] border-b border-[#555]">
<h3 class="text-sm font-semibold mb-2 text-[#00aaff]">Paramètres Image</h3>
<div class="space-y-2">
<div>
<label class="block mb-1 text-xs">Luminosité: <span id="imgBrightnessVal">100</span>%</label>
<input type="range" id="imgBrightness" min="0" max="200" value="100" class="w-full" oninput="document.getElementById('imgBrightnessVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Contraste: <span id="imgContrastVal">100</span>%</label>
<input type="range" id="imgContrast" min="0" max="200" value="100" class="w-full" oninput="document.getElementById('imgContrastVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Saturation: <span id="imgSaturateVal">100</span>%</label>
<input type="range" id="imgSaturate" min="0" max="200" value="100" class="w-full" oninput="document.getElementById('imgSaturateVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Teinte (Hue): <span id="imgHueVal">0</span>deg</label>
<input type="range" id="imgHue" min="0" max="360" value="0" class="w-full" oninput="document.getElementById('imgHueVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Flou (Blur): <span id="imgBlurVal">0</span>px</label>
<input type="range" id="imgBlur" min="0" max="20" step="0.1" value="0" class="w-full" oninput="document.getElementById('imgBlurVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Sépia: <span id="imgSepiaVal">0</span>%</label>
<input type="range" id="imgSepia" min="0" max="100" value="0" class="w-full" oninput="document.getElementById('imgSepiaVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Gris (Grayscale): <span id="imgGrayscaleVal">0</span>%</label>
<input type="range" id="imgGrayscale" min="0" max="100" value="0" class="w-full" oninput="document.getElementById('imgGrayscaleVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Inversion: <span id="imgInvertVal">0</span>%</label>
<input type="range" id="imgInvert" min="0" max="100" value="0" class="w-full" oninput="document.getElementById('imgInvertVal').textContent=this.value; updateSelectedImageStyle();">
</div>
<div>
<label class="block mb-1 text-xs">Opacité: <span id="imgOpacityVal">100</span>%</label>
<input type="range" id="imgOpacity" min="0" max="100" value="100" class="w-full" oninput="document.getElementById('imgOpacityVal').textContent=this.value; updateSelectedImageStyle();">
</div>
</div>
<button onclick="resetImageStyles()" class="mt-3 w-full bg-[#444] hover:bg-[#555] text-white py-1 rounded text-xs">Réinitialiser</button>
</div>
<label for="brushSize" class="block mb-1 text-sm">Brush Size: <span id="brushSizeValue">10</span> px</label>
<div class="flex items-center space-x-2 mb-3">
<input type="range" id="brushSize" min="0.001" max="2000" step="0.001" value="10" class="flex-1" />
<input type="number" id="brushSizeNumber" min="0.001" max="2000" step="0.001" value="10" class="w-20 bg-[#1e1e1e] border border-[#555] rounded px-1 py-0.5 text-xs text-right" />
</div>
<!-- Options Formes -->
<div id="shapeOptions" class="hidden mb-3">
<h3 class="text-sm font-semibold mb-2 text-[#00aaff]">Options Formes</h3>
<!-- Type de forme -->
<div class="mb-2">
<label class="flex items-center text-sm">
<input type="checkbox" id="shapeOutlineOnly" class="mr-2">
<span>Contour uniquement</span>
</label>
</div>
<!-- Épaisseur du contour -->
<div id="outlineThicknessContainer" class="hidden mb-2">
<label for="outlineThickness" class="block mb-1 text-xs">Épaisseur: <span id="outlineThicknessValue">1</span>px</label>
<input type="range" id="outlineThickness" min="0.0001" max="500" step="0.0001" value="1" class="w-full" />
</div>
<!-- Border Radius pour les formes -->
<div class="mb-2">
<label for="borderRadius" class="block mb-1 text-xs">Border Radius: <span id="borderRadiusValue">0</span>px</label>
<input type="range" id="borderRadius" min="0" max="60" step="0.1" value="0" class="w-full" />
</div>
<!-- Rotation pour les formes -->
<div class="mb-2">
<label for="shapeRotation" class="block mb-1 text-xs">Rotation: <span id="shapeRotationValue">0</span>°</label>
<input type="range" id="shapeRotation" min="0" max="360" step="0.1" value="0" class="w-full" />
</div>
<!-- 3D Revel Effect -->
<div class="mt-2 border-t border-[#555] pt-2">
<label class="flex items-center text-xs mb-2 font-bold text-[#ff00ff] cursor-pointer">
<input type="checkbox" id="shapeRevelActive" class="mr-2" onchange="document.getElementById('shapeRevelOptions').classList.toggle('hidden', !this.checked); if(window.updateSelectedShape) window.updateSelectedShape();" />
<span>3D Revel Effect</span>
</label>
<div id="shapeRevelOptions" class="hidden space-y-2 pl-2 border-l border-[#444]">
<div>
<label class="block text-xs mb-1">Intensité</label>
<div class="grid grid-cols-6 gap-1 text-[10px]">
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="10" checked onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 10</label>
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="20" onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 20</label>
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="40" onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 40</label>
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="60" onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 60</label>
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="80" onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 80</label>
<label class="cursor-pointer"><input type="radio" name="shapeRevelIntensity" value="100" onchange="if(window.updateSelectedShape) window.updateSelectedShape()"> 100</label>
</div>
</div>
</div>
</div>
<!-- Style de forme -->
<div class="mb-2">
<label for="shapeStyle" class="block mb-1 text-xs">Style de forme</label>
<select id="shapeStyle" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 text-[#c0c0c0]">
<option value="flat-fill">Remplissage plat</option>
<option value="flat-stroke">Contour simple</option>
<option value="double-stroke">Double contour</option>
<option value="soft-shadow">Ombre douce</option>
<option value="inner-shadow">Ombre interne</option>
<option value="glow">Lueur externe</option>
<option value="glass">Verre</option>
<option value="metal">Métal</option>
<option value="neon">Néon</option>
<option value="pastel">Pastel doux</option>
<option value="ink">Encre nette</option>
<option value="marker">Feutre marqueur</option>
<option value="pixel">Pixel art</option>
<option value="wireframe">Fil de fer</option>
<option value="dashed">Contour pointillé</option>
<option value="dotted">Contour à points</option>
<option value="soft-gradient">Dégradé doux</option>
<option value="glass-gradient">Verre dégradé</option>
<option value="emboss">Relief (emboss)</option>
<option value="cutout">Découpe</option>
<!-- NOUVEAUX STYLES -->
<option value="neon-advanced">Néon Avancé</option>
<option value="crayon-style">Crayon de couleur</option>
<option value="glitch-style">Glitch Art</option>
<option value="3d-block">Bloc 3D</option>
<option value="pointillism">Pointillisme</option>
</select>
</div>
<!-- CONTENEUR OPTIONS DYNAMIQUES STYLES -->
<div id="shapeStyleOptionsContainer" class="hidden mt-2 p-2 bg-[#222] border border-[#444] rounded">
<!-- Injecté via JS -->
</div>
</div>
<label class="block mb-1 text-sm">Color Mode</label>
<select id="colorMode" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-3 text-[#c0c0c0]">
<option value="solid">Solid Color</option>
<option value="gradient">Gradient</option>
</select>
<div id="gradientAngleContainer" class="mb-3 hidden">
<h3 class="text-sm font-semibold mb-2 text-[#00aaff]">Paramètres Gradient</h3>
<!-- Angle du gradient -->
<div class="mb-2">
<label for="gradientAngle" class="block mb-1 text-xs">Angle: <span id="gradientAngleValue">0</span>°</label>
<input type="range" id="gradientAngle" min="-180" max="180" value="0" class="w-full" />
<div class="flex justify-between text-xs text-[#999] mt-1">
<span>-180°</span>
<span>0°</span>
<span>180°</span>
</div>
</div>
<!-- Preset angles rapides -->
<div class="grid grid-cols-5 gap-1 mb-2">
<button class="preset-angle bg-[#444] hover:bg-[#555] text-white px-1 py-1 rounded text-xs" data-angle="-180">-180°</button>
<button class="preset-angle bg-[#444] hover:bg-[#555] text-white px-1 py-1 rounded text-xs" data-angle="-90">-90°</button>
<button class="preset-angle bg-[#444] hover:bg-[#555] text-white px-1 py-1 rounded text-xs" data-angle="0">0°</button>
<button class="preset-angle bg-[#444] hover:bg-[#555] text-white px-1 py-1 rounded text-xs" data-angle="90">90°</button>
<button class="preset-angle bg-[#444] hover:bg-[#555] text-white px-1 py-1 rounded text-xs" data-angle="180">180°</button>
</div>
<!-- Directions prédéfinies -->
<div class="grid grid-cols-5 gap-1 mb-3">
<button class="preset-direction bg-[#555] hover:bg-[#666] text-white px-1 py-1 rounded text-xs" data-direction="left">Left</button>
<button class="preset-direction bg-[#555] hover:bg-[#666] text-white px-1 py-1 rounded text-xs" data-direction="bottom">Bottom</button>
<button class="preset-direction bg-[#555] hover:bg-[#666] text-white px-1 py-1 rounded text-xs" data-direction="center">Center</button>
<button class="preset-direction bg-[#555] hover:bg-[#666] text-white px-1 py-1 rounded text-xs" data-direction="top">Top</button>
<button class="preset-direction bg-[#555] hover:bg-[#666] text-white px-1 py-1 rounded text-xs" data-direction="right">Right</button>
</div>
<!-- Transitions des zones -->
<div class="space-y-2">
<div>
<label for="topTransition" class="block mb-1 text-xs">Transition Top: <span id="topTransitionValue">0</span>%</label>
<input type="range" id="topTransition" min="0" max="100" value="0" class="w-full" />
</div>
<div>
<label for="middleTransition" class="block mb-1 text-xs">Transition Middle: <span id="middleTransitionValue">50</span>%</label>
<input type="range" id="middleTransition" min="0" max="100" value="50" class="w-full" />
</div>
<div>
<label for="bottomTransition" class="block mb-1 text-xs">Transition Bottom: <span id="bottomTransitionValue">100</span>%</label>
<input type="range" id="bottomTransition" min="0" max="100" value="100" class="w-full" />
</div>
<div>
<label for="sideTransition" class="block mb-1 text-xs">Transition Côtés: <span id="sideTransitionValue">50</span>%</label>
<input type="range" id="sideTransition" min="0" max="100" value="50" class="w-full" />
</div>
</div>
<!-- Intensité et saturation -->
<div class="space-y-2 mt-3">
<div>
<label for="gradientIntensity" class="block mb-1 text-xs">Intensité: <span id="gradientIntensityValue">100</span>%</label>
<input type="range" id="gradientIntensity" min="0" max="200" value="100" class="w-full" />
</div>
<div>
<label for="gradientSaturation" class="block mb-1 text-xs">Saturation: <span id="gradientSaturationValue">100</span>%</label>
<input type="range" id="gradientSaturation" min="0" max="200" value="100" class="w-full" />
</div>
</div>
</div>
<label for="opacity" class="block mb-1 text-sm">Opacity: <span id="opacityValue">100</span>%</label>
<input type="range" id="opacity" min="0" max="1" step="0.01" value="1" class="w-full mb-3" />
<!-- STYLES ARTISTIQUES AMÉLIORÉS PHASE 6 -->
<div id="artisticStylesPanel" class="p-3 bg-[#252525] border-b border-[#555] hidden">
<h2 class="text-lg font-semibold mb-2 text-[#00aaff]">🎨 Styles Artistiques</h2>
<label class="block mb-1 text-sm">Style de pinceau</label>
<select id="brushStyle" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-3 text-[#c0c0c0]">
<option value="normal">Normal</option>
<!-- STYLES TRADITIONNELS AMÉLIORÉS -->
<option value="pastel">🎨 Pastel (doux, poudreux)</option>
<option value="charcoal">⚫ Fusain (texturé, flou)</option>
<option value="watercolor">💧 Aquarelle (dilué, transparent)</option>
<option value="ink">🖋️ Encre (net, contrasté)</option>
<option value="airbrush">💨 Aérographe (diffus, doux)</option>
<option value="oil">🎭 Peinture à l'huile (épais, relief)</option>
<option value="gouache">🖌️ Gouache (opaque, mat)</option>
<option value="sponge">🧽 Éponge (moucheté, irrégulier)</option>
<!-- STYLES SÉLECTION SIMPLIFIÉS -->
<option value="fresco">🏛️ Fresque (granuleux, antique)</option>
<option value="impasto">🎨 Impasto (très épais, sculptural)</option>
</select>
<!-- Mode de style: pinceau ou forme -->
<div class="mb-2">
<label class="block mb-1 text-xs">Mode de style</label>
<select id="styleMode" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 text-[#c0c0c0]">
<option value="brush">Pinceau</option>
<option value="shape">Forme</option>
</select>
</div>
<!-- Contrôles d'intensité du style -->
<div class="mb-2">
<label for="styleIntensity" class="block mb-1 text-xs">Intensité du style: <span id="styleIntensityValue">50</span>%</label>
<input type="range" id="styleIntensity" min="0" max="100" value="50" class="w-full" />
</div>
<!-- Contrôles de grain/texture -->
<div class="mb-2">
<label for="textureGrain" class="block mb-1 text-xs">Grain/Texture: <span id="textureGrainValue">30</span>%</label>
<input type="range" id="textureGrain" min="0" max="100" value="30" class="w-full" />
</div>
<!-- Contrôles d'étalement -->
<div class="mb-2">
<label for="spreading" class="block mb-1 text-xs">Étalement: <span id="spreadingValue">20</span>%</label>
<input type="range" id="spreading" min="0" max="100" value="20" class="w-full" />
</div>
<!-- Contrôles de flou/blur -->
<div class="mb-2">
<label for="blurEffect" class="block mb-1 text-xs">Flou/Blur: <span id="blurEffectValue">0</span>px</label>
<input type="range" id="blurEffect" min="0" max="20" value="0" class="w-full" />
</div>
<!-- Contrôles de brillance -->
<div class="mb-2">
<label for="shineIntensity" class="block mb-1 text-xs">Intensité brillance: <span id="shineIntensityValue">0</span>%</label>
<input type="range" id="shineIntensity" min="0" max="100" value="0" class="w-full" />
</div>
<div class="mb-3">
<label class="block mb-1 text-xs">Couleur de brillance</label>
<select id="shineColor" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-2 text-[#c0c0c0]">
<option value="#ffffff">Blanc</option>
<option value="#ffff00">Jaune</option>
<option value="#00ff00">Vert</option>
<option value="#0099ff">Bleu</option>
<option value="#ff6600">Orange</option>
<option value="#ff00ff">Violet</option>
<option value="#ff0000">Rouge</option>
<option value="#00ffff">Cyan</option>
<option value="#ffccaa">Doré</option>
<option value="#ccccff">Argenté</option>
</select>
<div class="mb-2">
<label for="shineOpacity" class="block mb-1 text-xs">Opacité brillance: <span id="shineOpacityValue">30</span>%</label>
<input type="range" id="shineOpacity" min="0" max="100" value="30" class="w-full" />
</div>
</div>
<!-- Option pour les formes -->
<div class="mb-2 hidden">
<!-- Checkbox supprimée pour éviter les conflits de style -->
</div>
</div>
<!-- PHASE 5 - TEXTURES NATURELLES ET EFFETS NUMÉRIQUES -->
<div class="mb-3 p-3 bg-[#1a1a1a] border border-[#333] rounded">
<h3 class="text-sm font-semibold mb-2 text-[#00aaff]">Phase 5 - Textures & Effets</h3>
<!-- Textures traditionnelles améliorées -->
<div class="mb-3">
<label for="textureStyle" class="block mb-1 text-xs">Textures traditionnelles</label>
<select id="textureStyle" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-2 text-[#c0c0c0]">
<option value="none">Aucune texture</option>
<option value="brush-hair">🖌️ Pinceau en poils</option>
<option value="clone-stamp">📍 Tampon de clonage</option>
<option value="sponge-natural">🧽 Éponge naturelle</option>
<option value="dry-brush">🌾 Pinceau sec</option>
<option value="wet-paint">💧 Peinture humide</option>
<option value="crosshatch">❌ Hachures croisées</option>
<option value="stipple">🔴 Pointillisme</option>
<option value="smudge">👆 Barbouillage</option>
<option value="impasto-heavy">🎨 Impasto lourd</option>
<option value="palette-knife">🔪 Couteau à palette</option>
<option value="fan-brush">🌸 Pinceau éventail</option>
<option value="sgraffito">🪚 Sgraffito</option>
<option value="scumbling">🌀 Frottis</option>
<option value="glazing">✨ Glacis</option>
<option value="alla-prima">⚡ Alla prima</option>
<option value="grisaille">⚫ Grisaille</option>
<option value="chiaroscuro">🌓 Clair-obscur</option>
</select>
</div>
<!-- Textures naturelles améliorées -->
<div class="mb-3">
<label for="naturalTexture" class="block mb-1 text-xs">Textures naturelles</label>
<select id="naturalTexture" class="w-full bg-[#1e1e1e] border border-[#555] rounded px-2 py-1 mb-2 text-[#c0c0c0]">