FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add support for 'none' interpolation in SVG backend. Closes #94. by mdboom · Pull Request #149 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
27 changes: 19 additions & 8 deletions lib/matplotlib/backends/backend_svg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,10 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,

self.writer.end('g')

def draw_image(self, gc, x, y, im):
def option_scale_image(self):
return True

def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):
attrib = {}
clipid = self._get_clip(gc)
if clipid is not None:
Expand All @@ -702,10 +705,10 @@ def draw_image(self, gc, x, y, im):
if rcParams['svg.image_noscale']:
trans = list(im.get_matrix())
trans[5] = -trans[5]
attrib['transform'] = generate_transform('matrix', tuple(trans))
attrib['transform'] = generate_transform([('matrix', tuple(trans))])
assert trans[1] == 0
assert trans[2] == 0
numrows,numcols = im.get_size()
numrows, numcols = im.get_size()
im.reset_matrix()
im.set_interpolation(0)
im.resize(numcols, numrows)
Expand Down Expand Up @@ -733,11 +736,19 @@ def draw_image(self, gc, x, y, im):
im.flipud_out()
attrib['xlink:href'] = filename

self.writer.element(
'image',
x=str(x/trans[0]), y=str((self.height-y)/trans[3]-h),
width=str(w), height=str(h),
attrib=attrib)
if transform is None:
self.writer.element(
'image',
x=str(x/trans[0]), y=str((self.height-y)/trans[3]-h),
width=str(w), height=str(h),
attrib=attrib)
else:
attrib['transform'] = generate_transform(
[('matrix', transform.to_values())])
self.writer.element(
'image',
x=str(x), y=str(y), width=str(dx), height=str(dy),
attrib=attrib)

if url is not None:
self.writer.end('a')
Expand Down

Back | FazBrowse Home | New Git URL