本文整理匯總了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))