Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions Packages/vcs/vcs/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,21 +688,16 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs):
self.scaleLogo()

# Decide whether to rasterize background in vector outputs
# Current criteria to rasterize:
# Current limitation to vectorize:
# * if fillarea style is either pattern or hatch
# * if fillarea opacity is less than 100 for solid fill
try:
if gm.style and all(style != 'solid' for style in gm.style):
self._rasterPropsInVectorFormats = True
elif gm.opacity and not all(o == 100 for o in gm.opacity):
self._rasterPropsInVectorFormats = True
except:
pass
try:
if gm.fillareastyle in ['pattern', 'hatch']:
self._rasterPropsInVectorFormats = True
elif not all(o == 100 for o in gm.fillareaopacity):
self._rasterPropsInVectorFormats = True
except:
pass

Expand Down Expand Up @@ -1109,6 +1104,7 @@ def vectorGraphics(self, output_type, file, width=None, height=None,

# Since the patterns are applied as textures on vtkPolyData, enabling
# background rasterization is required to write them out

if self._rasterPropsInVectorFormats:
gl.Write3DPropsAsRasterImageOn()

Expand All @@ -1117,9 +1113,10 @@ def vectorGraphics(self, output_type, file, width=None, height=None,
gl.SetFilePrefix(".".join(file.split(".")[:-1]))

if textAsPaths:
gl.TextAsPathOff()
else:
gl.TextAsPathOn()
else:
gl.TextAsPathOff()

if output_type == "svg":
gl.SetFileFormatToSVG()
elif output_type == "ps":
Expand Down Expand Up @@ -1252,16 +1249,16 @@ def gettextextent(self, textorientation, texttable):
texttable = vcs.gettexttable(texttable)

from vtk_ui.text import text_dimensions

text_property = vtk.vtkTextProperty()
info = self.canvasinfo()
win_size = info["width"], info["height"]
vcs2vtk.prepTextProperty(text_property, win_size, to=textorientation, tt=texttable)

dpi = self.renWin.GetDPI()

length = max(len(texttable.string), len(texttable.x), len(texttable.y))

strings = texttable.string + [texttable.string[-1]] * (length - len(texttable.string))
xs = texttable.x + [texttable.x[-1]] * (length - len(texttable.x))
ys = texttable.y + [texttable.y[-1]] * (length - len(texttable.y))
Expand Down