code: def draw_bitmap(self, content):
          
  
          if content.HasAlpha():
              image = wx.ImageFromBitmap(content)
              image.ConvertAlphaToMask()
              image.SetMask(False)
              content = wx.BitmapFromImage(image)
  
          ims = wx.lib.wxcairo.ImageSurfaceFromBitmap(content)
  
          ims_width = ims.get_width()
          ims_height = ims.get_height()
  
          transx, transy = self._get_translation(ims_width, ims_height)
  
          scale_x, scale_y = self._get_scalexy(ims_width, ims_height)
          scale = min(scale_x, scale_y)
  
          angle = float(self.code_array.cell_attributes[self.key]["angle"])
  
          self.context.save()
          self.context.rotate(-angle / 360 * 2 * math.pi)
          self.context.translate(transx, transy)
          self.context.scale(scale, scale)
          self.context.set_source_surface(ims, 0, 0)
          self.context.paint()
          self.context.restore()
docs: Draws bitmap cell content to context