本文整理汇总了Python中pandac.PandaModules.PNMImage.getAlpha方法的典型用法代码示例。如果您正苦于以下问题:Python PNMImage.getAlpha方法的具体用法?Python PNMImage.getAlpha怎么用?Python PNMImage.getAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.PNMImage
的用法示例。
在下文中一共展示了PNMImage.getAlpha方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MazeMapGui
# 需要导入模块: from pandac.PandaModules import PNMImage [as 别名]
# 或者: from pandac.PandaModules.PNMImage import getAlpha [as 别名]
#.........这里部分代码省略.........
while y <= uly + size:
if x > 0 and y > 0 and x < image.getXSize() and y < image.getYSize():
image.setXelA(x, y, color)
y += 1
x += 1
def destroy(self):
del self._mazeCollTable
del self._maskResolution
del self._radius
del self._revealedCells
del self._revealFunctions
del self._revealFunction
self.map.removeNode()
del self.map
self.mask.removeNode()
del self.mask
self.maskedLayer.removeNode()
del self.maskedLayer
self.visibleLayer.removeNode()
del self.visibleLayer
self._maskImage.clear()
del self._maskImage
self.maskTexture.clear()
del self.maskTexture
self._laffMeterModel.removeNode()
del self._laffMeterModel
DirectFrame.destroy(self)
def _revealSmoothCircle(self, x, y, center):
length = (Vec2(x, y) - center).length()
goalAlpha = max(0.0, length / float(self._radius) - 0.5)
self._maskImage.setXelA(x, y, VBase4D(0.0, 0.0, 0.0, min(self._maskImage.getAlpha(x, y), goalAlpha * 2.0)))
def _revealHardCircle(self, x, y, center):
length = (Vec2(x, y) - center).length()
if length <= self._radius:
self._maskImage.setXelA(x, y, VBase4D(0, 0, 0, 0))
def _revealSquare(self, x, y, center):
self._maskImage.setXelA(x, y, VBase4D(0, 0, 0, 0))
def _drawHole(self, x, y):
center = Vec2(x, y)
ul = center - Vec2(self._radius, self._radius)
lr = center + Vec2(self._radius, self._radius)
x = int(ul[0])
while x <= lr[0]:
y = int(ul[1])
while y <= lr[1]:
if x > 0 and y > 0 and x < self._maskResolution and y < self._maskResolution:
self._revealFunctions[self._revealFunction](x, y, center)
y += 1
x += 1
self.maskTexture.load(self._maskImage)
self.mask.setTexture(self.maskTexture, 1)
def _createSimpleMarker(self, size, color = (1, 1, 1)):
halfSize = size * 0.5
cm = CardMaker('mazemap_simple_marker')
cm.setFrame(-halfSize, halfSize, -halfSize, halfSize)
markerNP = self.maskedLayer.attachNewNode(cm.generate())
markerNP.setColor(*color)