Fixed Scaling Bugs
This commit is contained in:
parent
f2329e9366
commit
1a8acdbed0
19
core.py
19
core.py
|
@ -65,9 +65,9 @@ class Core():
|
||||||
painter.setFont(font)
|
painter.setFont(font)
|
||||||
painter.setPen(QColor(*textColor))
|
painter.setPen(QColor(*textColor))
|
||||||
|
|
||||||
yPosition = yOffset
|
|
||||||
|
|
||||||
fm = QtGui.QFontMetrics(font)
|
fm = QtGui.QFontMetrics(font)
|
||||||
|
yPosition = yOffset + fm.height()/6
|
||||||
|
|
||||||
if alignment == 0: #Left
|
if alignment == 0: #Left
|
||||||
xPosition = xOffset
|
xPosition = xOffset
|
||||||
if alignment == 1: #Middle
|
if alignment == 1: #Middle
|
||||||
|
@ -92,21 +92,20 @@ class Core():
|
||||||
width = int(self.settings.value('outputWidth'))
|
width = int(self.settings.value('outputWidth'))
|
||||||
height = int(int(self.settings.value('outputHeight'))/2)
|
height = int(int(self.settings.value('outputHeight'))/2)
|
||||||
|
|
||||||
|
vH = height-height/8
|
||||||
|
bF = int(self.settings.value('outputWidth')) / 64
|
||||||
|
bH = bF / 2
|
||||||
|
bQ = bF / 4
|
||||||
imTop = Image.new("RGBA", (width, height))
|
imTop = Image.new("RGBA", (width, height))
|
||||||
draw = ImageDraw.Draw(imTop)
|
draw = ImageDraw.Draw(imTop)
|
||||||
r, g, b = color
|
r, g, b = color
|
||||||
color2 = (r, g, b, 50)
|
color2 = (r, g, b, 50)
|
||||||
|
|
||||||
vH = height-height/8
|
|
||||||
bF = int(self.settings.value('outputWidth')) / 64
|
|
||||||
bH = bF / 2
|
|
||||||
bQ = bF / 4
|
|
||||||
|
|
||||||
bP = int(self.settings.value('outputHeight')) / 800
|
bP = int(self.settings.value('outputHeight')) / 800
|
||||||
|
|
||||||
for j in range(0, 63):
|
for j in range(0, 63):
|
||||||
draw.rectangle((bH + j * bF, vH, bH + j * bF + bF, vH + bQ - spectrum[j * 4] * bP - bH), fill=color2)
|
draw.rectangle((bH + j * bF, vH+bQ, bH + j * bF + bF, vH + bQ - spectrum[j * 4] * bP - bH), fill=color2)
|
||||||
draw.rectangle((bH + bQ + j * bF, vH - bQ , bH + bQ + j * bF + bH, vH - spectrum[j * 4] * bP), fill=color)
|
draw.rectangle((bH + bQ + j * bF, vH , bH + bQ + j * bF + bH, vH - spectrum[j * 4] * bP), fill=color)
|
||||||
|
|
||||||
|
|
||||||
imBottom = imTop.transpose(Image.FLIP_TOP_BOTTOM)
|
imBottom = imTop.transpose(Image.FLIP_TOP_BOTTOM)
|
||||||
|
@ -114,7 +113,7 @@ class Core():
|
||||||
im = Image.new("RGB", (int(self.settings.value('outputWidth')), int(self.settings.value('outputHeight'))), "black")
|
im = Image.new("RGB", (int(self.settings.value('outputWidth')), int(self.settings.value('outputHeight'))), "black")
|
||||||
im.paste(image, (0, 0))
|
im.paste(image, (0, 0))
|
||||||
im.paste(imTop, (0, 0), mask=imTop)
|
im.paste(imTop, (0, 0), mask=imTop)
|
||||||
im.paste(imBottom, (0, int(vH+bF*.7)), mask=imBottom)
|
im.paste(imBottom, (0, int(vH+bF*1.8)), mask=imBottom)
|
||||||
|
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
3
main.py
3
main.py
|
@ -166,9 +166,10 @@ class Main(QtCore.QObject):
|
||||||
window.alignmentComboBox.addItem("Middle")
|
window.alignmentComboBox.addItem("Middle")
|
||||||
window.alignmentComboBox.addItem("Right")
|
window.alignmentComboBox.addItem("Right")
|
||||||
window.alignmentComboBox.setCurrentIndex(1)
|
window.alignmentComboBox.setCurrentIndex(1)
|
||||||
window.fontsizeSpinBox.setValue(int(int(self.settings.value("outputHeight")) / 16 ))
|
window.fontsizeSpinBox.setValue(int(int(self.settings.value("outputHeight")) / 14 ))
|
||||||
window.textXSpinBox.setValue(int(int(self.settings.value('outputWidth'))/2))
|
window.textXSpinBox.setValue(int(int(self.settings.value('outputWidth'))/2))
|
||||||
window.textYSpinBox.setValue(int(int(self.settings.value('outputHeight'))/2))
|
window.textYSpinBox.setValue(int(int(self.settings.value('outputHeight'))/2))
|
||||||
|
|
||||||
window.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
|
window.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
|
||||||
window.lineEdit_visColor.setText('%s,%s,%s' % self.visColor)
|
window.lineEdit_visColor.setText('%s,%s,%s' % self.visColor)
|
||||||
window.pushButton_textColor.clicked.connect(lambda: self.pickColor('text'))
|
window.pushButton_textColor.clicked.connect(lambda: self.pickColor('text'))
|
||||||
|
|
Reference in New Issue