def allow_rasterization(draw):
 @contextmanager
 def with_rasterized(artist, renderer):
  if artist.get_rasterized():
   renderer.start_rasterizing()
  if (artist.get_agg_filter() is not None):
   renderer.start_filter()
  try:
   (yield)
  finally:
   if (artist.get_agg_filter() is not None):
    renderer.stop_filter(artist.get_agg_filter())
   if artist.get_rasterized():
    renderer.stop_rasterizing()
 @wraps(draw)
 def draw_wrapper(artist, renderer, *args, **kwargs):
  with with_rasterized(artist, renderer):
   return draw(artist, renderer, *args, **kwargs)
 draw_wrapper._supports_rasterization = True
 return draw_wrapper

def allow_rasterization ( draw ) : @ contextmanager def with_rasterized ( artist , renderer ) : if artist . get_rasterized ( ) : renderer . start_rasterizing ( ) if ( artist . get_agg_filter ( ) is not None ) : renderer . start_filter ( ) try : ( yield ) finally : if ( artist . get_agg_filter ( ) is not None ) : renderer . stop_filter ( artist . get_agg_filter ( ) ) if artist . get_rasterized ( ) : renderer . stop_rasterizing ( ) @ wraps ( draw ) def draw_wrapper ( artist , renderer , * args , ** kwargs ) : with with_rasterized ( artist , renderer ) : return draw ( artist , renderer , * args , ** kwargs ) draw_wrapper . _supports_rasterization = True return draw_wrapper
decorator for artist .