Skip to content

Commit

Permalink
Close #12 by using transparent background for PNG export.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Aug 22, 2021
1 parent 09735cd commit 458d671
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .idea/four-letter-blocks.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ to put the blocks together. Here are a few ideas for how to make the blocks:
the blocks bump gently against each other.

Whatever technique you use, glue sticks are easier to work with than white glue.
If you don't want to print it out, you can also download the image and move the
pieces around in a paint program.

## Constructing Your Own
To construct your own puzzle, you have to construct the crossword puzzle, split
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ to put the blocks together. Here are a few ideas for how to make the blocks:
the blocks bump gently against each other.

Whatever technique you use, glue sticks are easier to work with than white glue.
If you don't want to print it out, you can also download the image and move the
pieces around in a paint program.

## Constructing Your Own
To construct your own puzzle, you have to construct the crossword puzzle, split
Expand Down
4 changes: 2 additions & 2 deletions four_letter_blocks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def export_png(self, file_path: Path):
puzzle = self.parse_puzzle()
width, height = 640, 2000
pixmap = QPixmap(width, height)
white = QColor('white')
pixmap.fill(white)
transparent = QColor(255, 255, 255, 0)
pixmap.fill(transparent)
painter = QPainter(pixmap)
height = puzzle.draw_blocks(painter)
painter.end()
Expand Down
4 changes: 3 additions & 1 deletion four_letter_blocks/square.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6.QtCore import QRect, Qt
from PySide6.QtGui import QPainter
from PySide6.QtGui import QPainter, QColor, QBrush


class Square:
Expand Down Expand Up @@ -28,6 +28,8 @@ def draw(self, painter: QPainter):
self.y,
self.size,
self.size)
white = QColor('white')
painter.setBrush(QBrush(white))
painter.drawRect(rect)
font = painter.font()
number_shift = round(self.size / 20)
Expand Down

0 comments on commit 458d671

Please sign in to comment.