本文整理汇总了Python中wx.ImageFromBitmap方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ImageFromBitmap方法的具体用法?Python wx.ImageFromBitmap怎么用?Python wx.ImageFromBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.ImageFromBitmap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def load_bitmap(resource, size=None):
bitmap = wx.Bitmap(get_resource(resource), wx.BITMAP_TYPE_PNG)
if size is not None:
image = wx.ImageFromBitmap(bitmap)
image.Rescale(size.GetWidth(), size.GetHeight(),
wx.IMAGE_QUALITY_HIGH)
bitmap = image.ConvertToBitmap()
return bitmap
示例2: resize_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def resize_bitmap(parent, _bitmap, target_height):
'''
Resizes a bitmap to a height of 89 pixels (the
size of the top panel), while keeping aspect ratio
in tact
'''
image = wx.ImageFromBitmap(_bitmap)
_width, _height = image.GetSize()
if _height < target_height:
return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
ratio = float(_width) / _height
image = image.Scale(target_height * ratio, target_height, wx.IMAGE_QUALITY_HIGH)
return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
示例3: _convert_agg_to_wx_image
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgb -> image
image = wx.EmptyImage(int(agg.width), int(agg.height))
image.SetData(agg.tostring_rgb())
return image
else:
# agg => rgba buffer -> bitmap => clipped bitmap => image
return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
示例4: _convert_agg_to_wx_image
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgb -> image
image = wx.Image(int(agg.width), int(agg.height))
image.SetData(agg.tostring_rgb())
return image
else:
# agg => rgba buffer -> bitmap => clipped bitmap => image
return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
示例5: imageFromBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def imageFromBitmap(bitmap):
if isLatestVersion:
return bitmap.ConvertToImage()
else:
return wx.ImageFromBitmap(bitmap)
示例6: _convert_agg_to_wx_image
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ImageFromBitmap [as 别名]
def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgb -> image
image = wxc.EmptyImage(int(agg.width), int(agg.height))
image.SetData(agg.tostring_rgb())
return image
else:
# agg => rgba buffer -> bitmap => clipped bitmap => image
return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))