def createImage(): w = 320 h = 240 b = n.V3fBuffer(w * h, p.V3f(0, 0, 0)) print '# creating pixel data' for y in range(h): for x in range(w): s = float(x) / w t = float(y) / h b[y * w + x] = p.V3f(s, t, 0) img = n.ObjectTable() img['xres'] = w img['yres'] = h img['pixels'] = b # check that this is a valid napalm image assert ni.isValid(img, True) return img
def verifyImage(a, b): assert ni.isValid(a, True) assert ni.isValid(b, True) assert a['xres'] == b['xres'] assert a['yres'] == b['yres'] diffPixelData(a['pixels'].contents, b['pixels'].contents)