mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
avoid resizes of the svg.
See https://github.com/shlomif/PySolFC/issues/3 .
This commit is contained in:
parent
f5aeecc50d
commit
4a7c9a761d
4 changed files with 18 additions and 3 deletions
|
@ -15,6 +15,14 @@ MyKCardDeck::MyKCardDeck(QString theme_name)
|
||||||
d->setDeckContents(ids);
|
d->setDeckContents(ids);
|
||||||
d->setCardWidth(150);
|
d->setCardWidth(150);
|
||||||
}
|
}
|
||||||
|
int MyKCardDeck::get_card_height()
|
||||||
|
{
|
||||||
|
return d->cardHeight();
|
||||||
|
}
|
||||||
|
int MyKCardDeck::get_card_width()
|
||||||
|
{
|
||||||
|
return d->cardWidth();
|
||||||
|
}
|
||||||
void MyKCardDeck::set_card_height(int i)
|
void MyKCardDeck::set_card_height(int i)
|
||||||
{
|
{
|
||||||
d->setCardHeight(i);
|
d->setCardHeight(i);
|
||||||
|
|
|
@ -13,6 +13,8 @@ class Q_DECL_EXPORT MyKCardDeck : public QObject
|
||||||
explicit MyKCardDeck(QString);
|
explicit MyKCardDeck(QString);
|
||||||
public slots:
|
public slots:
|
||||||
Q_DECL_EXPORT QPixmap *get_card_pixmap(int i);
|
Q_DECL_EXPORT QPixmap *get_card_pixmap(int i);
|
||||||
|
Q_DECL_EXPORT int get_card_height();
|
||||||
|
Q_DECL_EXPORT int get_card_width();
|
||||||
Q_DECL_EXPORT void set_card_height(int i);
|
Q_DECL_EXPORT void set_card_height(int i);
|
||||||
Q_DECL_EXPORT void set_card_width(int i);
|
Q_DECL_EXPORT void set_card_width(int i);
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,6 +57,9 @@ class Images:
|
||||||
if cs is None:
|
if cs is None:
|
||||||
return
|
return
|
||||||
self._setSize()
|
self._setSize()
|
||||||
|
self.CARDW = 100
|
||||||
|
self.CARDH = -1
|
||||||
|
cs.backnames = []
|
||||||
self._card = []
|
self._card = []
|
||||||
self._back = []
|
self._back = []
|
||||||
# bottom of stack (link to _bottom_negative/_bottom_positive)
|
# bottom of stack (link to _bottom_negative/_bottom_positive)
|
||||||
|
@ -107,6 +110,8 @@ class Images:
|
||||||
if self.CARDW < 0:
|
if self.CARDW < 0:
|
||||||
self.CARDW, self.CARDH = w, h
|
self.CARDW, self.CARDH = w, h
|
||||||
else:
|
else:
|
||||||
|
if self.CARDH < 0:
|
||||||
|
self.CARDH = h
|
||||||
if ((check_w and w != self.CARDW) or
|
if ((check_w and w != self.CARDW) or
|
||||||
(check_h and h != self.CARDH)):
|
(check_h and h != self.CARDH)):
|
||||||
raise ValueError("Invalid size %dx%d of image %s" % (w, h, f))
|
raise ValueError("Invalid size %dx%d of image %s" % (w, h, f))
|
||||||
|
|
|
@ -49,13 +49,13 @@ class SVGManager:
|
||||||
if not self.d:
|
if not self.d:
|
||||||
return None
|
return None
|
||||||
d = self.d
|
d = self.d
|
||||||
# d.set_card_width(width)
|
d.set_card_width(width)
|
||||||
d.set_card_width(150)
|
print("wh", d.get_card_width(), width, d.get_card_height(), height)
|
||||||
# d.set_card_height(height)
|
# d.set_card_height(height)
|
||||||
image = Image.fromqpixmap(
|
image = Image.fromqpixmap(
|
||||||
d.get_card_pixmap(
|
d.get_card_pixmap(
|
||||||
rank + 1 + {'c': 0, 'd': 1, 'h': 2, 's': 3}[suit]*0x100))
|
rank + 1 + {'c': 0, 'd': 1, 'h': 2, 's': 3}[suit]*0x100))
|
||||||
return image.resize((width, height), Image.LANCZOS)
|
# return image.resize((width, height), Image.LANCZOS)
|
||||||
return image
|
return image
|
||||||
if 0:
|
if 0:
|
||||||
id__ = '#' + "queen_heart"
|
id__ = '#' + "queen_heart"
|
||||||
|
|
Loading…
Add table
Reference in a new issue