mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
PyAPI: add planes argument to imbuf.new & improve planes docstring
This makes it possible to create grayscale/RGB images, with/without an alpha channel.
This commit is contained in:
parent
3152423683
commit
6944a44e2a
2 changed files with 43 additions and 7 deletions
|
|
@ -393,6 +393,20 @@ class TestImBufIO(unittest.TestCase):
|
|||
ibuf_loaded.free()
|
||||
|
||||
|
||||
class TestImBufPlanes(unittest.TestCase):
|
||||
|
||||
def test_new_planes_values(self):
|
||||
for p in (8, 16, 24, 32):
|
||||
ibuf = imbuf.new((2, 2), planes=p)
|
||||
self.assertEqual(ibuf.planes, p)
|
||||
ibuf.free()
|
||||
|
||||
def test_new_planes_invalid(self):
|
||||
for p in (0, 4, 12, 64):
|
||||
with self.assertRaises(ValueError):
|
||||
imbuf.new((2, 2), planes=p)
|
||||
|
||||
|
||||
def main():
|
||||
import sys
|
||||
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue