MCPcopy Create free account
hub / github.com/ImageEngine/cortex / imageData

Method imageData

src/IECoreImage/MPlayDisplayDriver.cpp:235–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void MPlayDisplayDriver::imageData( const Imath::Box2i &box, const float *data, size_t dataSize )
236{
237 for( size_t planeIndex = 0; planeIndex < m_planes.size(); planeIndex++ )
238 {
239 const Plane &plane = m_planes[planeIndex];
240
241 TileHeader planeHeader( planeIndex );
242 fwrite( &planeHeader, sizeof( planeHeader ), 1, m_imDisplayStdIn );
243
244 TileHeader tileHeader( box );
245 fwrite( &tileHeader, sizeof( tileHeader ), 1, m_imDisplayStdIn );
246
247 const size_t numPixels = ( box.size().x + 1 ) * ( box.size().y + 1 );
248
249 // need to create interleaved data for the channels in the current plane
250 std::vector<float> planeData( plane.channelIndices.size() * numPixels );
251 const float *in = data;
252 float *out = &planeData[0];
253 const size_t numInChannels = channelNames().size();
254 const size_t numOutChannels = plane.channelIndices.size();
255
256 for( size_t i=0; i<numPixels; ++i )
257 {
258 for( size_t c=0; c<numOutChannels; ++c )
259 {
260 *out++ = in[plane.channelIndices[c]];
261
262 }
263 in += numInChannels;
264 }
265
266 fwrite( &planeData[0], sizeof( float ), planeData.size(), m_imDisplayStdIn );
267 }
268}
269
270void MPlayDisplayDriver::imageClose()
271{

Callers

nothing calls this directly

Calls 2

channelNamesFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected