本文整理汇总了Python中panda3d.core.PNMImage.get_y_size方法的典型用法代码示例。如果您正苦于以下问题:Python PNMImage.get_y_size方法的具体用法?Python PNMImage.get_y_size怎么用?Python PNMImage.get_y_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.PNMImage
的用法示例。
在下文中一共展示了PNMImage.get_y_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panda3d.core import PNMImage [as 别名]
# 或者: from panda3d.core.PNMImage import get_y_size [as 别名]
class AtlasEntry:
def __init__(self, verbose_name, source_path):
self.name = verbose_name
self.path = source_path
self.tex = PNMImage(source_path)
self.w = self.tex.get_x_size()
self.h = self.tex.get_y_size()
self.area = self.w * self.h
self.assigned_pos = None
def __repr__(self):
return self.name
示例2: PNMImage
# 需要导入模块: from panda3d.core import PNMImage [as 别名]
# 或者: from panda3d.core.PNMImage import get_y_size [as 别名]
"""
from __future__ import print_function
from panda3d.core import PNMImage
source_a = "scene.png"
source_b = "scene-rp.png"
write_diff_img = False
img_a = PNMImage(source_a)
img_b = PNMImage(source_b)
w, h = img_a.get_x_size(), img_a.get_y_size()
img_dest = PNMImage(w, h, 3)
error_scale = 10.0
total_diff = 0.0
for x in xrange(w):
for y in xrange(h):
val_a = img_a.get_xel(x, y)
val_b = img_b.get_xel(x, y)
abs_diff = (val_a - val_b) * error_scale
r, g, b = abs(abs_diff.x), abs(abs_diff.y), abs(abs_diff.z)
img_dest.set_xel(x, y, r, g, b)