code: def _WX28_clipped_agg_as_bitmap(agg, bbox):
      
      l, b, width, height = bbox.bounds
      r = l + width
      t = b + height
  
      srcBmp = wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height),
          agg.buffer_rgba())
      srcDC = wx.MemoryDC()
      srcDC.SelectObject(srcBmp)
  
      destBmp = wx.EmptyBitmap(int(width), int(height))
      destDC = wx.MemoryDC()
      destDC.SelectObject(destBmp)
  
      destDC.BeginDrawing()
      x = int(l)
      y = int(int(agg.height) - t)
      destDC.Blit(0, 0, int(width), int(height), srcDC, x, y)
      destDC.EndDrawing()
  
      srcDC.SelectObject(wx.NullBitmap)
      destDC.SelectObject(wx.NullBitmap)
  
      return destBmp
docs: Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.
  
      Note: agg must be a backend_agg.RendererAgg instance.