本文整理汇总了Python中java.awt.image.BufferedImage.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BufferedImage.__init__方法的具体用法?Python BufferedImage.__init__怎么用?Python BufferedImage.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from java.awt.image import BufferedImage [as 别名]
# 或者: from java.awt.image.BufferedImage import __init__ [as 别名]
def __init__(self, *arg):
"""
Return Surface that is subclassed from java.awt.image.BufferedImage.
Alternative arguments:
* Size (w,h) of surface, optional second argument of flags (SRCALPHA)
* Bufferedimage to convert to Surface
Module initialization places pyj2d.Surface in module's namespace.
"""
try:
width, height = arg[0]
try:
if arg[1] & (BufferedImage.TYPE_INT_ARGB | Const.SRCALPHA):
BufferedImage.__init__(self, width, height, BufferedImage.TYPE_INT_ARGB)
else:
BufferedImage.__init__(self, width, height, BufferedImage.TYPE_INT_RGB)
except IndexError:
BufferedImage.__init__(self, width, height, BufferedImage.TYPE_INT_ARGB)
graphics2D = self.createGraphics()
graphics2D.setColor(Color(0,0,0))
graphics2D.fillRect(0, 0, width, height)
graphics2D.dispose()
except TypeError:
try:
cm = arg[0].getColorModel()
raster = arg[0].getRaster()
isRasterPremultiplied = arg[0].isAlphaPremultiplied()
properties = Hashtable()
keys = arg[0].getPropertyNames()
if keys != None:
for key in keys:
properties.put(key,arg[0].getProperty(key))
except AttributeError:
cm, raster, isRasterPremultiplied, properties = arg
BufferedImage.__init__(self, cm, raster, isRasterPremultiplied, properties)
self._display = None #display surface
self._super_surface = None
self._offset = (0,0)
self._colorkey = None
self._nonimplemented_methods()