bool QPixmap::save( QIODevice* device, const char* format, int quality ) const { if ( isNull() ) return FALSE; // nothing to save QImageIO io( device, format ); return doImageIO( &io, quality ); }
bool QPixmap::save( const QString &fileName, const char *format, int quality ) const { if ( isNull() ) return FALSE; // nothing to save QImageIO io( fileName, format ); return doImageIO( &io, quality ); }
void GLESTexture::prepareImpl() { if (mUsage & TU_RENDERTARGET) return; String baseName, ext; size_t pos = mName.find_last_of("."); baseName = mName.substr(0, pos); if (pos != String::npos) { ext = mName.substr(pos+1); } LoadedImages loadedImages = LoadedImages(new std::vector<Image>()); if (mTextureType == TEX_TYPE_2D) { doImageIO(mName, mGroup, ext, *loadedImages, this); // If this is a volumetric texture set the texture type flag accordingly. if ((*loadedImages)[0].getDepth() > 1) { OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "**** Unsupported 3D texture type ****", "GLESTexture::prepare" ); } // If PVRTC and 0 custom mipmap disable auto mip generation and disable software mipmap creation PixelFormat imageFormat = (*loadedImages)[0].getFormat(); if (imageFormat == PF_PVRTC_RGB2 || imageFormat == PF_PVRTC_RGBA2 || imageFormat == PF_PVRTC_RGB4 || imageFormat == PF_PVRTC_RGBA4) { size_t imageMips = (*loadedImages)[0].getNumMipmaps(); if (imageMips == 0) { mNumMipmaps = mNumRequestedMipmaps = imageMips; // Disable flag for auto mip generation mUsage &= ~TU_AUTOMIPMAP; } } } else { OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "**** Unknown texture type ****", "GLESTexture::prepare"); } mLoadedImages = loadedImages; }
void GLES2Texture::prepareImpl() { if (mUsage & TU_RENDERTARGET) return; String baseName, ext; size_t pos = mName.find_last_of("."); baseName = mName.substr(0, pos); if (pos != String::npos) { ext = mName.substr(pos+1); } LoadedImages loadedImages = LoadedImages(new vector<Image>::type()); if (mTextureType == TEX_TYPE_1D || mTextureType == TEX_TYPE_2D || mTextureType == TEX_TYPE_2D_ARRAY || mTextureType == TEX_TYPE_3D) { doImageIO(mName, mGroup, ext, *loadedImages, this); // If this is a volumetric texture set the texture type flag accordingly. // If this is a cube map, set the texture type flag accordingly. if ((*loadedImages)[0].hasFlag(IF_CUBEMAP)) mTextureType = TEX_TYPE_CUBE_MAP; // If this is a volumetric texture set the texture type flag accordingly. if((*loadedImages)[0].getDepth() > 1 && mTextureType != TEX_TYPE_2D_ARRAY) mTextureType = TEX_TYPE_3D; // If PVRTC and 0 custom mipmap disable auto mip generation and disable software mipmap creation if (PixelUtil::isCompressed((*loadedImages)[0].getFormat())) { size_t imageMips = (*loadedImages)[0].getNumMipmaps(); if (imageMips == 0) { mNumMipmaps = mNumRequestedMipmaps = imageMips; // Disable flag for auto mip generation mUsage &= ~TU_AUTOMIPMAP; } } } else if (mTextureType == TEX_TYPE_CUBE_MAP) { if(getSourceFileType() == "dds") { // XX HACK there should be a better way to specify whether // all faces are in the same file or not doImageIO(mName, mGroup, ext, *loadedImages, this); } else { vector<Image>::type images(6); ConstImagePtrList imagePtrs; static const String suffixes[6] = {"_rt", "_lf", "_up", "_dn", "_fr", "_bk"}; for(size_t i = 0; i < 6; i++) { String fullName = baseName + suffixes[i]; if (!ext.empty()) fullName = fullName + "." + ext; // find & load resource data intro stream to allow resource // group changes if required doImageIO(fullName, mGroup, ext, *loadedImages, this); } } } else { OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "**** Unknown texture type ****", "GLES2Texture::prepare"); } mLoadedImages = loadedImages; }