decksmith 0.1.11__tar.gz → 0.1.12__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.
@@ -1,16 +1,16 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: decksmith
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.
5
- License: GPL-2.0-only
5
+ License-Expression: GPL-2.0-only
6
6
  Author: Julio Cabria
7
7
  Author-email: juliocabria@tutanota.com
8
8
  Requires-Python: >=3.11
9
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
10
9
  Classifier: Programming Language :: Python :: 3
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
13
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: click
16
16
  Requires-Dist: jval (==1.0.6)
@@ -321,8 +321,12 @@ class CardBuilder:
321
321
  # The center of the circle is the top-left position + radius
322
322
  center_pos = (absolute_pos[0] + radius, absolute_pos[1] + radius)
323
323
 
324
- # Draw the circle
325
- self.draw.circle(
324
+ # Create a temporary layer for proper alpha compositing
325
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
326
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
327
+
328
+ # Draw the circle on the temporary layer
329
+ layer_draw.circle(
326
330
  center_pos,
327
331
  radius,
328
332
  fill=element.get("fill", None),
@@ -330,6 +334,10 @@ class CardBuilder:
330
334
  width=element.get("outline_width", 1),
331
335
  )
332
336
 
337
+ # Composite the layer onto the card
338
+ self.card = Image.alpha_composite(self.card, layer)
339
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
340
+
333
341
  # Store position if id is provided
334
342
  if "id" in element:
335
343
  # The stored bbox is based on the top-left position
@@ -377,14 +385,22 @@ class CardBuilder:
377
385
  position[1] + size[1],
378
386
  )
379
387
 
380
- # Draw the ellipse
381
- self.draw.ellipse(
388
+ # Create a temporary layer for proper alpha compositing
389
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
390
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
391
+
392
+ # Draw the ellipse on the temporary layer
393
+ layer_draw.ellipse(
382
394
  bounding_box,
383
395
  fill=element.get("fill", None),
384
396
  outline=element.get("outline_color", None),
385
397
  width=element.get("outline_width", 1),
386
398
  )
387
399
 
400
+ # Composite the layer onto the card
401
+ self.card = Image.alpha_composite(self.card, layer)
402
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
403
+
388
404
  # Store position if id is provided
389
405
  if "id" in element:
390
406
  self.element_positions[element["id"]] = bounding_box
@@ -432,14 +448,22 @@ class CardBuilder:
432
448
  # Translate points by the final offset
433
449
  final_points = [(p[0] + offset[0], p[1] + offset[1]) for p in points]
434
450
 
435
- # Draw the polygon
436
- self.draw.polygon(
451
+ # Create a temporary layer for proper alpha compositing
452
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
453
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
454
+
455
+ # Draw the polygon on the temporary layer
456
+ layer_draw.polygon(
437
457
  final_points,
438
458
  fill=element.get("fill", None),
439
459
  outline=element.get("outline_color", None),
440
460
  width=element.get("outline_width", 1),
441
461
  )
442
462
 
463
+ # Composite the layer onto the card
464
+ self.card = Image.alpha_composite(self.card, layer)
465
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
466
+
443
467
  # Store position if id is provided
444
468
  if "id" in element:
445
469
  # The stored bbox is the relative bbox translated by the offset
@@ -482,8 +506,12 @@ class CardBuilder:
482
506
  # The center of the polygon is the top-left position + radius
483
507
  center_pos = (absolute_pos[0] + radius, absolute_pos[1] + radius)
484
508
 
485
- # Draw the regular polygon
486
- self.draw.regular_polygon(
509
+ # Create a temporary layer for proper alpha compositing
510
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
511
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
512
+
513
+ # Draw the regular polygon on the temporary layer
514
+ layer_draw.regular_polygon(
487
515
  (center_pos[0], center_pos[1], radius),
488
516
  n_sides=element["sides"],
489
517
  rotation=element.get("rotation", 0),
@@ -492,6 +520,10 @@ class CardBuilder:
492
520
  width=element.get("outline_width", 1),
493
521
  )
494
522
 
523
+ # Composite the layer onto the card
524
+ self.card = Image.alpha_composite(self.card, layer)
525
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
526
+
495
527
  # Store position if id is provided
496
528
  if "id" in element:
497
529
  # The stored bbox is based on the top-left position
@@ -545,8 +577,12 @@ class CardBuilder:
545
577
 
546
578
  # print(f"DEBUG: Transformed {element=}")
547
579
 
548
- # Draw the rectangle
549
- self.draw.rounded_rectangle(
580
+ # Create a temporary layer for proper alpha compositing
581
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
582
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
583
+
584
+ # Draw the rectangle on the temporary layer
585
+ layer_draw.rounded_rectangle(
550
586
  bounding_box,
551
587
  radius=element.get("corner_radius", 0),
552
588
  fill=element.get("fill", None),
@@ -555,6 +591,10 @@ class CardBuilder:
555
591
  corners=element.get("corners", None),
556
592
  )
557
593
 
594
+ # Composite the layer onto the card
595
+ self.card = Image.alpha_composite(self.card, layer)
596
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
597
+
558
598
  # Store position if id is provided
559
599
  if "id" in element:
560
600
  self.element_positions[element["id"]] = bounding_box
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "decksmith"
3
- version = "0.1.11"
3
+ version = "0.1.12"
4
4
  description = "A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck."
5
5
  authors = [
6
6
  {name = "Julio Cabria", email = "juliocabria@tutanota.com"},
@@ -24,7 +24,7 @@ dev = [
24
24
 
25
25
  [tool.poetry]
26
26
  name = "decksmith"
27
- version = "0.1.11"
27
+ version = "0.1.12"
28
28
  description = "A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck."
29
29
  authors = ["Julio Cabria <juliocabria@tutanota.com>"]
30
30
  license = "GPL-2.0-only"
File without changes
File without changes