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

backends: fix alpha handling for cairo and macosx by efiring · Pull Request #437 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) 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
7 changes: 6 additions & 1 deletion lib/matplotlib/backend_bases.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 @@ -774,6 +774,8 @@ def set_alpha(self, alpha):
if alpha is not None:
self._alpha = alpha
self._forced_alpha = True
else:
self._forced_alpha = False

def set_antialiased(self, b):
"""
Expand Down Expand Up @@ -834,7 +836,10 @@ def set_foreground(self, fg, isRGB=False):
else:
self._rgb = colors.colorConverter.to_rgba(fg)
if len(self._rgb) == 4 and not self._forced_alpha:
self._alpha = self._rgb[3]
self.set_alpha(self._rgb[3])
# Use set_alpha method here so that subclasses will
# be calling their own version, which may set their
# own attributes.

def set_graylevel(self, frac):
"""
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/backends/backend_cairo.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 @@ -283,6 +283,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
def new_gc(self):
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
self.gc.ctx.save()
self.gc._alpha = 1.0
self.gc._forced_alpha = False # if True, _alpha overrides A from RGBA
return self.gc


Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/backends/backend_macosx.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 @@ -101,6 +101,8 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
def new_gc(self):
self.gc.save()
self.gc.set_hatch(None)
self.gc._alpha = 1.0
self.gc._forced_alpha = False # if True, _alpha overrides A from RGBA
return self.gc

def draw_gouraud_triangle(self, gc, points, colors, transform):
Expand Down

Back | FazBrowse Home | New Git URL