Skip to content

Commit

Permalink
Draft: Fixed bugs in hatching - fixes #1164
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Dec 20, 2013
1 parent ca4d0d7 commit bdb5eef
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Mod/Draft/Draft.py
Expand Up @@ -501,18 +501,20 @@ def loadTexture(filename,size=None):
from pivy import coin
from PyQt4 import QtGui,QtSvg
try:
if size and (".svg" in filename.lower()):
# this is a pattern, not a texture
if isinstance(size,int):
size = (size,size)
svgr = QtSvg.QSvgRenderer(filename)
p = QtGui.QImage(size[0],size[1],QtGui.QImage.Format_ARGB32)
pa = QtGui.QPainter()
pa.begin(p)
svgr.render(pa)
pa.end()
else:
p = QtGui.QImage(filename)
p = QtGui.QImage(filename)
# buggy - TODO: allow to use resolutions
#if size and (".svg" in filename.lower()):
# # this is a pattern, not a texture
# if isinstance(size,int):
# size = (size,size)
# svgr = QtSvg.QSvgRenderer(filename)
# p = QtGui.QImage(size[0],size[1],QtGui.QImage.Format_ARGB32)
# pa = QtGui.QPainter()
# pa.begin(p)
# svgr.render(pa)
# pa.end()
#else:
# p = QtGui.QImage(filename)
size = coin.SbVec2s(p.width(), p.height())
buffersize = p.numBytes()
numcomponents = int (buffersize / ( size[0] * size[1] ))
Expand Down

0 comments on commit bdb5eef

Please sign in to comment.