MCPcopy Create free account
hub / github.com/PyQt5/PyQt / createPixmapFromNinePatchImage

Function createPixmapFromNinePatchImage

QLabel/Lib/QtNinePatch2.py:120–137  ·  view source on GitHub ↗
(image, dw, dh)

Source from the content-addressed store, hash-verified

118
119
120def createPixmapFromNinePatchImage(image, dw, dh):
121 w = dw
122 h = dh
123 if w < image.width() or h < image.height(): # shrink
124 w = max(image.width(), w)
125 h = max(image.height(), h)
126 pm1 = resize9patch(image, w, h)
127 if pm1.isNull():
128 return QPixmap()
129 pm2 = QPixmap(dw, dh)
130 pm2.fill(Qt.transparent)
131 pr = QPainter(pm2)
132 pr.setRenderHint(QPainter.Antialiasing)
133 pr.setRenderHint(QPainter.SmoothPixmapTransform)
134 pr.drawPixmap(0, 0, dw, dh, pm1, 0, 0, w, h)
135 return pm2
136 else:
137 return resize9patch(image, dw, dh)

Callers

nothing calls this directly

Calls 3

resize9patchFunction · 0.85
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected