@@ -199,7 +199,7 @@ def _get_unsampled_image(self, A, image_extents, viewlim):
199199 im .is_grayscale = False
200200 else :
201201 if self ._rgbacache is None :
202- x = self .to_rgba (self ._A , self . _alpha , bytes = True )
202+ x = self .to_rgba (self ._A , bytes = True )
203203 self ._rgbacache = x
204204 else :
205205 x = self ._rgbacache
@@ -345,6 +345,7 @@ def draw(self, renderer, *args, **kwargs):
345345 gc = renderer .new_gc ()
346346 gc .set_clip_rectangle (self .axes .bbox .frozen ())
347347 gc .set_clip_path (self .get_clip_path ())
348+ gc .set_alpha (self .get_alpha ())
348349
349350 if self ._check_unsampled_image (renderer ):
350351 self ._draw_unsampled_image (renderer , gc )
@@ -722,7 +723,7 @@ def set_data(self, x, y, A):
722723 A .shape = A .shape [0 :2 ]
723724 if len (A .shape ) == 2 :
724725 if A .dtype != np .uint8 :
725- A = self .to_rgba (A , alpha = self . _alpha , bytes = True )
726+ A = self .to_rgba (A , bytes = True )
726727 self .is_grayscale = self .cmap .is_gray ()
727728 else :
728729 A = np .repeat (A [:,:,np .newaxis ], 4 , 2 )
@@ -824,7 +825,7 @@ def make_image(self, magnification=1.0):
824825 width = width * magnification
825826 height = height * magnification
826827 if self ._rgbacache is None :
827- A = self .to_rgba (self ._A , alpha = self . _alpha , bytes = True )
828+ A = self .to_rgba (self ._A , bytes = True )
828829 self ._rgbacache = A
829830 if self ._A .ndim == 2 :
830831 self .is_grayscale = self .cmap .is_gray ()
@@ -851,6 +852,7 @@ def draw(self, renderer, *args, **kwargs):
851852 gc = renderer .new_gc ()
852853 gc .set_clip_rectangle (self .axes .bbox .frozen ())
853854 gc .set_clip_path (self .get_clip_path ())
855+ gc .set_alpha (self .get_alpha ())
854856 renderer .draw_image (gc ,
855857 round (self .axes .bbox .xmin ),
856858 round (self .axes .bbox .ymin ),
@@ -974,7 +976,7 @@ def make_image(self, magnification=1.0):
974976 if self ._A is None :
975977 raise RuntimeError ('You must first set the image array' )
976978
977- x = self .to_rgba (self ._A , self . _alpha , bytes = True )
979+ x = self .to_rgba (self ._A , bytes = True )
978980 self .magnification = magnification
979981 # if magnification is not one, we need to resize
980982 ismag = magnification != 1
@@ -1008,6 +1010,7 @@ def draw(self, renderer, *args, **kwargs):
10081010 gc = renderer .new_gc ()
10091011 gc .set_clip_rectangle (self .figure .bbox )
10101012 gc .set_clip_path (self .get_clip_path ())
1013+ gc .set_alpha (self .get_alpha ())
10111014 renderer .draw_image (gc , round (self .ox ), round (self .oy ), im )
10121015 gc .restore ()
10131016
@@ -1096,7 +1099,7 @@ def make_image(self, renderer, magnification=1.0):
10961099 im .is_grayscale = False
10971100 else :
10981101 if self ._rgbacache is None :
1099- x = self .to_rgba (self ._A , self . _alpha , bytes = True )
1102+ x = self .to_rgba (self ._A , bytes = True )
11001103 self ._rgbacache = x
11011104 else :
11021105 x = self ._rgbacache
@@ -1148,6 +1151,7 @@ def draw(self, renderer, *args, **kwargs):
11481151 l , b , r , t = self .get_window_extent (renderer ).extents
11491152 gc = renderer .new_gc ()
11501153 self ._set_gc_clip (gc )
1154+ gc .set_alpha (self .get_alpha ())
11511155 #gc.set_clip_path(self.get_clip_path())
11521156 renderer .draw_image (gc , round (l ), round (b ), im )
11531157 gc .restore ()
0 commit comments