/*! \function CalendarModulePreferencesView::CalendarModulePreferencesView * \brief Default constructor * \param[in] frame The rectangle enclosing the view * \param[in] name Name of the view. Will be passed to BView's constructor. * */ CalendarModulePreferencesView::CalendarModulePreferencesView( BRect frame, const char* name, BString ) : BTab(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS ) { BMenuItem* toAdd = NULL; BMessage* toSend = NULL; CalendarModule* currentCalModule = NULL; BRect tempFrame( frame ); // Got the boundaries }
void EXRReader::read(Frame & frame, const Params &/*params*/) { if ( !isOpen() ) open(); // helpers... InputFile& file = m_data->file_; Box2i& dtw = m_data->dtw_; pfs::Frame tempFrame( width(), height() ); pfs::Channel *X, *Y, *Z; tempFrame.createXYZChannels( X, Y, Z ); FrameBuffer frameBuffer; frameBuffer.insert( "R", // name Slice( FLOAT, // type (char*)(X->data() - dtw.min.x - dtw.min.y * width()), sizeof(float), // xStride sizeof(float) * width(), // yStride 1, 1, // x/y sampling 0.0)); // fillValue frameBuffer.insert( "G", // name Slice( FLOAT, // type (char*)(Y->data() - dtw.min.x - dtw.min.y * width()), sizeof(float), // xStride sizeof(float) * width(), // yStride 1, 1, // x/y sampling 0.0)); // fillValue frameBuffer.insert( "B", // name Slice( FLOAT, // type (char*)(Z->data() - dtw.min.x - dtw.min.y * width()), sizeof(float), // xStride sizeof(float) * width(), // yStride 1, 1, // x/y sampling 0.0)); // fillValue // I know I have the channels I need because I have checked that I have the // RGB channels. Hence, I don't load any further that that... /* const ChannelList &channels = file.header().channels(); for ( ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i ) { if ( !strcmp( i.name(), "R" ) || !strcmp( i.name(), "G" ) || !strcmp( i.name(), "B" ) ) continue; std::string channelName( i.name() ); if ( channelName == "Z" ) { channelName = "DEPTH"; } pfs::Channel *pfsCh = tempFrame.createChannel( channelName ); frameBuffer.insert( i.name(), // name Slice( FLOAT, // type (char *)(pfsCh->data() - dtw.min.x - dtw.min.y * width()), sizeof(float), // xStride sizeof(float) * width(), // yStride 1, 1, // x/y sampling 0.0)); // fillValue } */ // Copy attributes to tags for ( Header::ConstIterator it = file.header().begin(), itEnd = file.header().end(); it != itEnd; ++it ) { const char *attribName = it.name(); const StringAttribute *attrib = file.header().findTypedAttribute<StringAttribute>(attribName); if ( attrib == NULL ) continue; // Skip if type is not String // fprintf( stderr, "Tag: %s = %s\n", attribName, attrib->value().c_str() ); const char *colon = strstr( attribName, ":" ); if ( colon == NULL ) // frame tag { tempFrame.getTags().setTag( attribName, escapeString(attrib->value()) ); } else // channel tag { std::string channelName = string( attribName, colon-attribName ); pfs::Channel *ch = tempFrame.getChannel( channelName ); if ( ch == NULL ) { std::cerr << " Warning! Can not set tag for " << channelName << " channel because it does not exist\n"; } else { ch->getTags().setTag(colon + 1, escapeString( attrib->value() )); } } } file.setFrameBuffer( frameBuffer ); file.readPixels( dtw.min.y, dtw.max.y ); // Rescale values if WhiteLuminance is present if ( hasWhiteLuminance( file.header() ) ) { float scaleFactor = whiteLuminance( file.header() ); int pixelCount = tempFrame.getHeight()*tempFrame.getWidth(); for ( int i = 0; i < pixelCount; i++ ) { (*X)(i) *= scaleFactor; (*Y)(i) *= scaleFactor; (*Z)(i) *= scaleFactor; } // const StringAttribute *relativeLum = // file.header().findTypedAttribute<StringAttribute>("RELATIVE_LUMINANCE"); std::string luminanceTag = tempFrame.getTags().getTag("LUMINANCE"); if ( luminanceTag.empty() ) { tempFrame.getTags().setTag("LUMINANCE", "ABSOLUTE"); } } tempFrame.getTags().setTag( "FILE_NAME", filename() ); frame.swap( tempFrame ); }