MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / read_tile

Method read_tile

src/python/py_imageinput.cpp:296–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294
295
296object
297ImageInputWrap::read_tile (int x, int y, int z, TypeDesc format)
298{
299 // Allocate our own temp buffer and try to read the scanline into it.
300 // If the read fails, return None.
301 const ImageSpec &spec = m_input->spec();
302 size_t size = (size_t) spec.tile_pixels() * spec.nchannels * format.size();
303 char *data = new char[size];
304 if (!m_input->read_tile (x, y, z, format, data)) {
305 delete [] data; // never mind
306 return object(handle<>(Py_None));
307 }
308
309 object array = C_array_to_Python_array (data, format, size);
310
311 // clean up and return the array handle
312 delete [] data;
313 return array;
314}
315
316
317object

Callers 4

test_readtileFunction · 0.45
copy_subimageFunction · 0.45

Calls 4

C_array_to_Python_arrayFunction · 0.85
specMethod · 0.45
tile_pixelsMethod · 0.45
sizeMethod · 0.45

Tested by 2

test_readtileFunction · 0.36
copy_subimageFunction · 0.36