当前位置: 首页>>代码示例>>Python>>正文


Python wx.BitmapFromBufferRGBA方法代码示例

本文整理汇总了Python中wx.BitmapFromBufferRGBA方法的典型用法代码示例。如果您正苦于以下问题:Python wx.BitmapFromBufferRGBA方法的具体用法?Python wx.BitmapFromBufferRGBA怎么用?Python wx.BitmapFromBufferRGBA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.BitmapFromBufferRGBA方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def draw_image(self, gc, x, y, im):
        bbox = gc.get_clip_rectangle()
        if bbox != None:
            l,b,w,h = bbox.bounds
        else:
            l=0
            b=0,
            w=self.width
            h=self.height
        rows, cols, image_str = im.as_rgba_str()
        image_array = np.fromstring(image_str, np.uint8)
        image_array.shape = rows, cols, 4
        bitmap = wx.BitmapFromBufferRGBA(cols,rows,image_array)
        gc = self.get_gc()
        gc.select()
        gc.gfx_ctx.DrawBitmap(bitmap,int(l),int(self.height-b),int(w),int(-h))
        gc.unselect() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:backend_wx.py

示例2: _convert_agg_to_wx_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def _convert_agg_to_wx_bitmap(agg, bbox):
    """
    Convert the region of the agg buffer bounded by bbox to a wx.Bitmap.  If
    bbox is None, the entire buffer is converted.

    Note: agg must be a backend_agg.RendererAgg instance.
    """
    if bbox is None:
        # agg => rgba buffer -> bitmap
        return wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height),
            agg.buffer_rgba())
    else:
        # agg => rgba buffer -> bitmap => clipped bitmap
        return _WX28_clipped_agg_as_bitmap(agg, bbox) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:backend_wxagg.py

示例3: _WX28_clipped_agg_as_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def _WX28_clipped_agg_as_bitmap(agg, bbox):
    """
    Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.

    Note: agg must be a backend_agg.RendererAgg instance.
    """
    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 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:31,代码来源:backend_wxagg.py

示例4: bitmapFromBufferRGBA

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def bitmapFromBufferRGBA(im, rgba):
    if isLatestVersion:
        return wx.Bitmap.FromBufferRGBA(im.size[0], im.size[1], rgba)
    else:
        return wx.BitmapFromBufferRGBA(im.size[0], im.size[1], rgba) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:7,代码来源:three_to_four.py

示例5: CreateBitmapOnTopOfIcon

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def CreateBitmapOnTopOfIcon(foregroundIcon, backgroundIcon, size=(12, 12)):
    small = foregroundIcon.pil.resize(size, Image.BICUBIC)
    pil = backgroundIcon.pil.copy()
    pil.paste(small, (16 - size[0], 16 - size[1]), small)
    return wx.BitmapFromBufferRGBA(pil.size[0], pil.size[1], str(pil.tobytes())) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:7,代码来源:Icons.py

示例6: PilToBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromBufferRGBA [as 别名]
def PilToBitmap(pil):
    """
    Convert a PIL image to a wx.Bitmap (with alpha channel support).
    """
    return wx.BitmapFromBufferRGBA(pil.size[0], pil.size[1], str(pil.tobytes()))

# setup some commonly used icons 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:9,代码来源:Icons.py


注:本文中的wx.BitmapFromBufferRGBA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。