Editor::Editor () :IFrameWindow(ID_MAIN_WINDOW), title(this), flyText(ID_FLYTEXT, &toolBar), infoText(ID_INFOTEXT, this, this), flyHelpHandler(&flyText, &infoText, 0, 0), editWindow(ID_EDITOR, this, this), toolBar(ID_TOOLBAR, this, IToolBar::aboveClient, false, IToolBar::classDefaultStyle | IToolBar::dragDrop), cutButton (IC_ID_CUT, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::dragDelete ), copyButton (IC_ID_COPY, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::dragDelete ), pasteButton (IC_ID_PASTE, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::dragDelete ), boldButton (IC_ID_BOLD, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::transparentBitmap ), italicButton (IC_ID_ITALIC, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::transparentBitmap ), underscoreButton(IC_ID_UNDERSCORE, &toolBar, &toolBar, IRectangle(), IToolBarButton::defaultStyle() | IToolBarButton::transparentBitmap ), fontCombo(ID_FONTCOMBO, &toolBar, &toolBar, IRectangle(), IBaseComboBox::classDefaultStyle & ~IBaseComboBox::simpleType | IBaseComboBox::readOnlyDropDownType), menu(ID_MAIN_WINDOW,this), fontSelectHandler(*this), editFont(), commandhandler(&editFont, &toolBar, &editWindow, &menu) { /*----------------------------------------------------------------------------| | Set the icon and title text | -----------------------------------------------------------------------------*/ setIcon( id() ); title.setTitleText(ID_MAIN_WINDOW); /*----------------------------------------------------------------------------| | Add the buttons to the toolbar | -----------------------------------------------------------------------------*/ toolBar.addAsLast(&cutButton,true); toolBar.addAsLast(©Button); toolBar.addAsLast(&pasteButton); toolBar.addAsLast(&boldButton,true); toolBar.addAsLast(&italicButton); toolBar.addAsLast(&underscoreButton); toolBar.addAsLast(&fontCombo,true); /*----------------------------------------------------------------------------| | Set up latchable style for font property buttons | | Note: When in bitmapAndTextView, latching a toolbar button will show the | | gray background for the bitmap. To eliminate the gray background, set | | the transparent color to gray and turn on the transparent style for the | | button. If you do not use the bitmapAndTextView and you have many buttons | | with the latchable style, consider not enabling the transparent style as | | transparency incurs additional overhead and increases performance time. | -----------------------------------------------------------------------------*/ boldButton.enableLatching(); italicButton.enableLatching(); underscoreButton.enableLatching(); boldButton.setTransparentColor(IColor::kPaleGray); italicButton.setTransparentColor(IColor::kPaleGray); underscoreButton.setTransparentColor(IColor::kPaleGray); /*----------------------------------------------------------------------------| | Load up font combo box with face names | -----------------------------------------------------------------------------*/ fontCombo.setLimit(10); #ifndef IC_MOTIF IFont::FaceNameCursor fontCursor; for ( fontCursor.setToFirst(); fontCursor.isValid(); fontCursor.setToNext()) { IString faceName = IFont::faceNameAt(fontCursor); fontCombo.addAsLast(faceName); if (faceName.length() > fontCombo.limit()) fontCombo.setLimit(faceName.length()); } #endif /*----------------------------------------------------------------------------| | Set up title for toolbar when floating | -----------------------------------------------------------------------------*/ toolBar.setFloatingTitle(STR_TOOLBAR); /*----------------------------------------------------------------------------| | Setup the editor | -----------------------------------------------------------------------------*/ setClient(&editWindow); editWindow.setFont(editFont); try { editWindow.importFromFile("toolbar.not"); } catch( ... ) { IMessageBox msgBox( this ); msgBox.setTitle( STR_MSGBOX_TITLE ); msgBox.show( STR_FILE_NOT_FOUND, IMessageBox::okButton | IMessageBox::warningIcon); } editWindow.setTop(1); /*----------------------------------------------------------------------------| | Add the info frame extension | -----------------------------------------------------------------------------*/ addExtension(&infoText, IFrameWindow::belowClient); /*----------------------------------------------------------------------------| | Set up and add the help handler | -----------------------------------------------------------------------------*/ flyHelpHandler.setLongStringTableOffset(OFFSET_INFOTEXT); flyHelpHandler.handleEventsFor(&toolBar); /*----------------------------------------------------------------------------| | For Motif, disable the Floating menuitem. | -----------------------------------------------------------------------------*/ #ifdef IC_MOTIF // On Motif, changing a toolbar location // to floating is not allowed. Only // the initial location can be set // to floating. Therefore, disable // the menuitem on Motif since it // would have no effect. menu.enableItem( ID_TOOLBAR_FLOATING, false ); #endif /*----------------------------------------------------------------------------| | Attach the Command Handler to the frame | -----------------------------------------------------------------------------*/ commandhandler.handleEventsFor(this); /*----------------------------------------------------------------------------| | Allow the font select handler to handle events for font combo box. | -----------------------------------------------------------------------------*/ fontSelectHandler.handleEventsFor(&fontCombo); moveSizeToClient(IRectangle(IPoint(100,100), ISize(editFont.avgCharWidth()*80, editFont.maxCharHeight()*15))); }
//---------------------------------------------------------------------- void CLBaseClass::loadProgram(std::string& kernel_source, bool enable_fp64) { //Program Setup int pl; //unsigned int program_length; std::string updated_source(kernel_source); // if (enable_fp64) { updated_source = addExtension(kernel_source, getDeviceFP64Extension(deviceUsed), enable_fp64); } // std::cout << updated_source << std::endl; pl = updated_source.size(); printf("[CLBaseClass] building kernel source of size: %d\n", pl); // printf("KERNEL: \n %s\n", updated_source.c_str()); try { cl::Program::Sources source(1, std::make_pair(updated_source.c_str(), pl)); program = cl::Program(context, source); } catch (cl::Error er) { printf("[CLBaseClass::loadProgram] ERROR: %s(%s)\n", er.what(), oclErrorString(er.err())); } try { char* kernel_dir = getenv("CL_KERNELS"); char* cwd = getenv("PWD"); if (kernel_dir == NULL) { printf("\n**** [CLBaseClass] Error: You must set CL_KERNELS in your environment to run on the GPU!\n\n"); exit(EXIT_FAILURE); } // printf("Loading kernels from the directory: %s and .\n **** Specified by environment variable: CL_KERNELS\n", kernel_dir); char includes[PATH_MAX]; sprintf(includes, "-I%s -I%s", kernel_dir, cwd); err = program.build(devices, includes); } catch (cl::Error er) { printf("program.build: %s\n", oclErrorString(er.err())); std::cout << "Build Status: " << program.getBuildInfo<CL_PROGRAM_BUILD_STATUS>(devices[deviceUsed]) << std::endl; std::cout << "Build Options:\t" << program.getBuildInfo<CL_PROGRAM_BUILD_OPTIONS>(devices[deviceUsed]) << std::endl; std::cout << "Build Log:\t " << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(devices[deviceUsed]) << std::endl; exit(EXIT_FAILURE); } printf("[CLBaseClass] done building program\n"); #if 0 std::cout << "Build Status: " << program.getBuildInfo<CL_PROGRAM_BUILD_STATUS>(devices[deviceUsed]) << std::endl; std::cout << "Build Options:\t" << program.getBuildInfo<CL_PROGRAM_BUILD_OPTIONS>(devices[deviceUsed]) << std::endl; std::cout << "Build Log:\t " << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(devices[deviceUsed]) << std::endl; #endif }
MPVMVolumeReader::MPVMVolumeReader() : DataReaderType<Volume>() { addExtension(FileExtension("mpvm", "MPVM (Multiple PVMs) file format")); }
void RootWImage::setDefaultExtensions() { //addExtension("C"); addExtension("pdf"); addExtension("root"); }
QXmppClient::QXmppClient(QObject *parent) : QXmppLoggable(parent), d(new QXmppClientPrivate(this)) { bool check; Q_UNUSED(check); d->stream = new QXmppOutgoingClient(this); d->addProperCapability(d->clientPresence); check = connect(d->stream, SIGNAL(elementReceived(QDomElement,bool&)), this, SLOT(_q_elementReceived(QDomElement,bool&))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(messageReceived(QXmppMessage)), this, SIGNAL(messageReceived(QXmppMessage))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(presenceReceived(QXmppPresence)), this, SIGNAL(presenceReceived(QXmppPresence))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(iqReceived(QXmppIq)), this, SIGNAL(iqReceived(QXmppIq))); Q_ASSERT(check); check = connect(d->stream->socket(), SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(_q_socketStateChanged(QAbstractSocket::SocketState))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(connected()), this, SLOT(_q_streamConnected())); Q_ASSERT(check); check = connect(d->stream, SIGNAL(disconnected()), this, SLOT(_q_streamDisconnected())); Q_ASSERT(check); check = connect(d->stream, SIGNAL(error(QXmppClient::Error)), this, SLOT(_q_streamError(QXmppClient::Error))); Q_ASSERT(check); // reconnection d->reconnectionTimer = new QTimer(this); d->reconnectionTimer->setSingleShot(true); connect(d->reconnectionTimer, SIGNAL(timeout()), this, SLOT(_q_reconnect())); Q_ASSERT(check); // logging setLogger(QXmppLogger::getLogger()); // create managers // TODO move manager references to d->extensions d->rosterManager = new QXmppRosterManager(this); addExtension(d->rosterManager); d->vCardManager = new QXmppVCardManager; addExtension(d->vCardManager); d->versionManager = new QXmppVersionManager; addExtension(d->versionManager); addExtension(new QXmppEntityTimeManager()); QXmppDiscoveryManager *discoveryManager = new QXmppDiscoveryManager; addExtension(discoveryManager); // obsolete signal check = connect(discoveryManager, SIGNAL(infoReceived(QXmppDiscoveryIq)), this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq))); Q_ASSERT(check); check = connect(discoveryManager, SIGNAL(itemsReceived(QXmppDiscoveryIq)), this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq))); Q_ASSERT(check); }
QXmppClient::QXmppClient(QObject *parent) : QXmppLoggable(parent), d(new QXmppClientPrivate(this)) { d->stream = new QXmppOutgoingClient(this); d->addProperCapability(d->clientPresence); bool check = connect(d->stream, SIGNAL(elementReceived(const QDomElement&, bool&)), this, SLOT(slotElementReceived(const QDomElement&, bool&))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(messageReceived(const QXmppMessage&)), this, SIGNAL(messageReceived(const QXmppMessage&))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(presenceReceived(const QXmppPresence&)), this, SIGNAL(presenceReceived(const QXmppPresence&))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(iqReceived(const QXmppIq&)), this, SIGNAL(iqReceived(const QXmppIq&))); Q_ASSERT(check); check = connect(d->stream, SIGNAL(disconnected()), this, SIGNAL(disconnected())); Q_ASSERT(check); check = connect(d->stream, SIGNAL(connected()), this, SLOT(xmppConnected())); Q_ASSERT(check); check = connect(d->stream, SIGNAL(connected()), this, SIGNAL(connected())); Q_ASSERT(check); check = connect(d->stream, SIGNAL(error(QXmppClient::Error)), this, SIGNAL(error(QXmppClient::Error))); Q_ASSERT(check); check = setReconnectionManager(new QXmppReconnectionManager(this)); Q_ASSERT(check); // logging d->logger = 0; setLogger(QXmppLogger::getLogger()); // create managers // TODO move manager references to d->extensions d->rosterManager = new QXmppRosterManager(this); addExtension(d->rosterManager); d->vCardManager = new QXmppVCardManager; addExtension(d->vCardManager); d->versionManager = new QXmppVersionManager; addExtension(d->versionManager); addExtension(new QXmppEntityTimeManager()); QXmppDiscoveryManager *discoveryManager = new QXmppDiscoveryManager; addExtension(discoveryManager); // obsolete signal check = connect(discoveryManager, SIGNAL(infoReceived(QXmppDiscoveryIq)), this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq))); Q_ASSERT(check); check = connect(discoveryManager, SIGNAL(itemsReceived(QXmppDiscoveryIq)), this, SIGNAL(discoveryIqReceived(QXmppDiscoveryIq))); Q_ASSERT(check); }
AHelloWindow :: AHelloWindow(unsigned long windowId) : IFrameWindow(IFrameWindow::defaultStyle() | IFrameWindow::minimizedIcon | IFrameWindow::accelerator, windowId) ,menuBar(windowId, this) ,clientWindow(WND_CANVAS, this, this) ,helloCanvas(WND_HCANVAS, &clientWindow, &clientWindow, IRectangle(), IWindow::visible | ISplitCanvas::horizontal) ,hello(WND_HELLO, &helloCanvas, &helloCanvas) ,statusLine(WND_STATUS, this, this) ,earthWindow(WND_EARTH, &helloCanvas) ,listBox(WND_LISTBOX, &clientWindow, &clientWindow, IRectangle(), IListBox::defaultStyle() | IControl::tabStop | IListBox::noAdjustPosition) ,buttons(WND_BUTTONS, this, this) ,leftButton(MI_LEFT, &buttons, &buttons) ,centerButton(MI_CENTER, &buttons, &buttons) ,rightButton(MI_RIGHT, &buttons, &buttons) ,helpButton(MI_HELP, &buttons, &buttons, IRectangle(), IPushButton::defaultStyle() | IPushButton::help | IButton::noPointerFocus) ,infoArea(this) ,commandHandler(this) ,selectHandler(this) ,helpWindow(HELP_TABLE,this) { /*------------------------------------------------------------------------| | Set the clientWindow split canvas as the client window for the | | AHelloWorld frame. | | Set the HelloCanvas object to occupy 60% of the client canvas. | | Set the list box object to occupy 40% of the client canvas. | |------------------------------------------------------------------------*/ setClient(&clientWindow); clientWindow.setSplitWindowPercentage(&helloCanvas, 60); clientWindow.setSplitWindowPercentage(&listBox, 40); /*------------------------------------------------------------------------| | Add the status line as an extension to the frame above the client | | window with the height calculated from the maximum height of a | | character in the current font. | |------------------------------------------------------------------------*/ addExtension(&statusLine, IFrameWindow::aboveClient, IFont(&statusLine).maxCharHeight()); /*------------------------------------------------------------------------| | Add the different language versions of Hello World to the list box in | | ascending order. Hello World text strings are stored in the | | resource file with IDs beginning with HI_WORLD with each subsequent | | ID incremented up to HI_WORLD + HI_COUNT - 1. | | Have the select handler handle selections made in the list box. | | The select handler's selected() function is called to process | | list box selections. | |------------------------------------------------------------------------*/ for (int i=0;i<HI_COUNT;i++ ) listBox.addAscending(HI_WORLD+i); selectHandler.handleEventsFor(&listBox); /*------------------------------------------------------------------------| | Change the size of the information area using the maximum height of | | a character in the current font. | |------------------------------------------------------------------------*/ setExtensionSize(&infoArea, IFont(&infoArea).maxCharHeight()); /*------------------------------------------------------------------------| | Set the values for the text controls from strings in the resource file.| | The infoArea default text is displayed when no menu item is active. | |------------------------------------------------------------------------*/ hello.setText(STR_HELLO); leftButton.setText(STR_LEFTB); centerButton.setText(STR_CENTERB); rightButton.setText(STR_RIGHTB); helpButton.setText(STR_HELPB); infoArea.setDefaultText(STR_INFO); /*------------------------------------------------------------------------| | Enable the first button as a tab stop. | | Set the canvas margins and padding between buttons to zero. | | Add the set canvas that contains the push buttons to the frame window | | as an extension immediately below the client window with a height | | equal to the minimum height of the push buttons. You must set the | | text in the push buttons first. | |------------------------------------------------------------------------*/ leftButton.enableTabStop(); buttons.setMargin(ISize()); buttons.setPad(ISize()); addExtension(&buttons, IFrameWindow::belowClient, (unsigned long)buttons.minimumSize().height()); /*------------------------------------------------------------------------| | Have the command handler handle commands sent from the frame window. | | The command handler's command() function is called to process | | menu item, push button, and accelerator key selections. | |------------------------------------------------------------------------*/ commandHandler.handleEventsFor(this); /*------------------------------------------------------------------------| | Add the help library to the help window using addLibraries(). | | Set the help window title from a string in the resource file. | | Begin handling help events for the frame window. | |------------------------------------------------------------------------*/ try { helpWindow.addLibraries( "ahellow5.hlp" ); helpWindow.setTitle(STR_HTITLE); helpHandler.handleEventsFor(this); } catch( ... ) { IMessageBox msgBox( this ); msgBox.show( STR_HELP_NOT_FOUND, IMessageBox::warning ); } /*------------------------------------------------------------------------| | Align the static text, set the status line, and set the check mark in | | the menu bar. | |------------------------------------------------------------------------*/ setTextAlignment(center); } /* end AHelloWindow :: AHelloWindow(...) */
void JPlugin::init() { qRegisterMetaType<QSet<QString> >("QSet<QString>"); ExtensionIcon jabberIcon("im-jabber"); setInfo(QT_TRANSLATE_NOOP("Plugin", "Jabber"), QT_TRANSLATE_NOOP("Plugin", "Jabber protocol"), PLUGIN_VERSION(0, 0, 1, 0), jabberIcon); addAuthor(QLatin1String("reindeer")); addAuthor(QT_TRANSLATE_NOOP("Author", "Nikita Belov"), QT_TRANSLATE_NOOP("Task", "Author"), QLatin1String("*****@*****.**")); addAuthor(QLatin1String("euroelessar")); addAuthor(QLatin1String("sauron")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber"), QT_TRANSLATE_NOOP("Plugin", "Jabber protocol"), new GeneralGenerator<JProtocol>(), jabberIcon); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber account creator"), QT_TRANSLATE_NOOP("Plugin", "Account creator for Jabber protocol"), new GeneralGenerator<JAccountWizard>(), jabberIcon); addExtension(QT_TRANSLATE_NOOP("Plugin", "LiveJournal account creator"), QT_TRANSLATE_NOOP("Plugin", "Account creator for LiveJournal"), new GeneralGenerator<LJAccountWizard>(), ExtensionIcon("im-livejournal")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Google Talk account creator"), QT_TRANSLATE_NOOP("Plugin", "Account creator for Google Talk"), new GeneralGenerator<GTAccountWizard>(), ExtensionIcon("im-gtalk")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Yandex.Online account creator"), QT_TRANSLATE_NOOP("Plugin", "Account creator for Yandex.Online"), new GeneralGenerator<YAccountWizard>(), ExtensionIcon("im-yandex")); addExtension(QT_TRANSLATE_NOOP("Plugin", "QIP account creator"), QT_TRANSLATE_NOOP("Plugin", "Account creator for QIP"), new GeneralGenerator<QIPAccountWizard>(), ExtensionIcon("im-qip")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber XML console"), QT_TRANSLATE_NOOP("Plugin", "XML console for low-level protocol debugging"), new GeneralGenerator<XmlConsole, JabberExtension>(), ExtensionIcon("utilities-terminal")); // addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber AdHoc"), // QT_TRANSLATE_NOOP("Plugin", "Implementation of Ad-hoc Commands"), // new GeneralGenerator<JAdHocModule, JabberExtension>(), // ExtensionIcon("utilities-terminal")); // addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Remote Control"), // QT_TRANSLATE_NOOP("Plugin", "Implementation of client remote controlling"), // new GeneralGenerator<RemoteControl, JabberExtension>(), // ExtensionIcon("utilities-terminal")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Service Browser"), QT_TRANSLATE_NOOP("Plugin", "Implementation of service browser"), new GeneralGenerator<JServiceBrowserModule, JabberExtension>(), ExtensionIcon("services")); // addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber File Transfer"), // QT_TRANSLATE_NOOP("Plugin", "Implementation of XEP-0096"), // new GeneralGenerator<JFileTransferFactory>(), // ExtensionIcon("document-save")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Personal Events support"), QT_TRANSLATE_NOOP("Plugin", "Implementation of personal events protocol"), new GeneralGenerator<JPersonEventSupport, JabberExtension>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber VCard support"), QT_TRANSLATE_NOOP("Plugin", "Implementation of VCard info requests"), new GeneralGenerator<JVCardManager, JabberExtension>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber User Mood support"), QT_TRANSLATE_NOOP("Plugin", "Convertes internal XMPP data of mood to Qt data types"), new GeneralGenerator<JPersonMoodConverter, PersonEventConverter>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Mood Chooser"), QT_TRANSLATE_NOOP("Plugin", "Provides the dialog to set your mood"), new GeneralGenerator<JMoodChooser, JabberExtension>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber User Tune support"), QT_TRANSLATE_NOOP("Plugin", "Convertes internal XMPP data of tune to Qt data types"), new GeneralGenerator<JPersonTuneConverter, PersonEventConverter>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber User Activity support"), QT_TRANSLATE_NOOP("Plugin", "Convertes internal XMPP data of activity to Qt data types"), new GeneralGenerator<JPersonActivityConverter, PersonEventConverter>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Activity Chooser"), QT_TRANSLATE_NOOP("Plugin", "Provides the dialog to set your activity"), new GeneralGenerator<JActivityChooser, JabberExtension>(), ExtensionIcon("")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber proxy support"), QT_TRANSLATE_NOOP("Plugin", "Jabber proxy support"), new SingletonGenerator<JProxyManager, NetworkProxyManager>(), ExtensionIcon("im-jabber")); addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber Attention support"), QT_TRANSLATE_NOOP("Plugin", "Jabber Attention support (XEP-0224)"), new SingletonGenerator<JAttention, JabberExtension>(), ExtensionIcon("dialog-warning")); #if 0 #ifdef JABBER_HAVE_MULTIMEDIA addExtension(QT_TRANSLATE_NOOP("Plugin", "Jabber VoIP support"), QT_TRANSLATE_NOOP("Plugin", "Allows to talk by voice and video"), new GeneralGenerator<JingleSupport, JabberExtension>(), ExtensionIcon("")); #endif #endif }
static void CompressTextureSet( Vector<VirtFS::VirtDesc>& files, Pair<CString, ImageProcessor> const& file, FileProcessor* cooker, TerminalCursor& cursor) { Resource r(MkUrl(file.first.c_str())); auto outName = Path(file.first).removeExt(); PixCmp cmp = PixCmp::RGBA; BitFmt bfmt; Bytes data; Size size; auto decoder = image_decoders.find(file.second); if(decoder == image_decoders.end()) return; if(!decoder->second(cooker, file, cmp, bfmt, size, data, r)) return; if(size.area() == 0) { return; } texture_settings_t settings; settings.flags = stb::ImageHint::Undefined; settings.max_size = max_texture_size; settings.min_size = min_texture_size; settings.channels = 4; settings.formats = Compress_ALL; /*!< Use all formats by default */ settings.parse(outName); if(size.w < settings.max_size && size.h < settings.max_size) { std::tie(data, size) = ScaleImage( std::move(data), size, settings.max_size, settings.flags); } else if(size.w > settings.max_size && size.h > settings.max_size) { std::tie(data, size) = ScaleImage( std::move(data), size, settings.max_size, settings.flags); } common_tools_t tools = {cooker, cursor, settings, files}; if(settings.formats & Compress_DXT) CompressDXT(tools, file, size, data, outName); #if defined(HAVE_ETC2COMP) if(settings.formats & Compress_ETC) CompressETC12(tools, size, data, outName); #endif if(settings.formats & Compress_RAW) { /* Just export the raw image as RGBA8 */ IMG::serial_image img; img.size = size; img.v2.bit_fmt = BitFmt::UByte; img.v2.format.base_fmt = PixFmt::RGBA8; img.v2.format.c_flags = CompFlags::CompressionNone; img.v2.format.p_flags = PixFlg::None; auto rawName = outName.addExtension("raw"); files.emplace_back(rawName, Bytes(), 0); auto& rawData = files.back().data; rawData = Bytes::Alloc(sizeof(img) + data.size); MemCpy(Bytes::From(img), rawData.at(0, sizeof(img))); MemCpy(data, rawData.at(sizeof(img))); cursor.progress( TEXCOMPRESS_API "Exporting raw RGBA for {0}", file.first); } }
PVMVolumeWriter::PVMVolumeWriter() : DataWriterType<Volume>() { addExtension(FileExtension("pvm", "PVM file format")); }