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

Method write

src/libOpenImageIO/imagebuf.cpp:889–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887
888
889bool
890ImageBuf::write (ImageOutput *out,
891 ProgressCallback progress_callback,
892 void *progress_callback_data) const
893{
894 stride_t as = AutoStride;
895 bool ok = true;
896 const ImageBufImpl *impl = this->impl();
897 impl->validate_pixels ();
898 const ImageSpec &m_spec (impl->m_spec);
899 if (impl->m_localpixels) {
900 // In-core pixel buffer for the whole image
901 ok = out->write_image (m_spec.format, impl->m_localpixels, as, as, as,
902 progress_callback, progress_callback_data);
903 } else if (deep()) {
904 // Deep image record
905 ok = out->write_deep_image (impl->m_deepdata);
906 } else {
907 // Backed by ImageCache
908 boost::scoped_array<char> tmp (new char [m_spec.image_bytes()]);
909 get_pixels (xbegin(), xend(), ybegin(), yend(), zbegin(), zend(),
910 m_spec.format, &tmp[0]);
911 ok = out->write_image (m_spec.format, &tmp[0], as, as, as,
912 progress_callback, progress_callback_data);
913 // FIXME -- not good for huge images. Instead, we should read
914 // little bits at a time (scanline or tile blocks).
915 }
916 if (! ok)
917 error ("%s", out->geterror ());
918 return ok;
919}
920
921
922

Callers 4

write_mipmapFunction · 0.45
time_write_imagebufFunction · 0.45
ImageBuf_test_appbufferFunction · 0.45
visualize_ellipseMethod · 0.45

Calls 15

get_pixelsFunction · 0.85
errorFunction · 0.85
implFunction · 0.85
validate_pixelsMethod · 0.80
image_bytesMethod · 0.80
geterrorFunction · 0.70
writeFunction · 0.50
write_imageMethod · 0.45
geterrorMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
supportsMethod · 0.45

Tested by 2

time_write_imagebufFunction · 0.36
ImageBuf_test_appbufferFunction · 0.36