• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FreeImage_Load函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FreeImage_Load函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeImage_Load函数的具体用法?C++ FreeImage_Load怎么用?C++ FreeImage_Load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FreeImage_Load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FreeImage_Unload

void CPreview::SetFile(const char * fname)
{
	if (fname == m_fname) return;   // avoid flicker by continually redisplaying the same file
	m_fname = fname;

	if (m_dib != NULL)
	{
		FreeImage_Unload(m_dib);
		m_dib = NULL;
	}

	// If a file name was given
	if (fname != NULL && fname[0] != '\0')
	{
		FREE_IMAGE_FORMAT fmt = FreeImage_GetFileType(fname);  // Try to work out the file type
		m_dib = FreeImage_Load(fmt, fname);
	}

	Invalidate();
}
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:20,代码来源:Preview.cpp


示例2: GenericLoader

/** Generic image loader
	@param lpszPathName Pointer to the full file name
	@param flag Optional load flag constant
	@return Returns the loaded dib if successful, returns NULL otherwise
*/
FIBITMAP* GenericLoader(const char* lpszPathName, int flag) {
	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;

	// check the file signature and deduce its format
	// (the second argument is currently not used by FreeImage)
	fif = FreeImage_GetFileType(lpszPathName, 0);
	if(fif == FIF_UNKNOWN) {
		// no signature ?
		// try to guess the file format from the file extension
		fif = FreeImage_GetFIFFromFilename(lpszPathName);
	}
	// check that the plugin has reading capabilities ...
	if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
		// ok, let's load the file
		FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag);
		// unless a bad file format, we are done !
		return dib;
	}
	return NULL;
}
开发者ID:Afr0Games,项目名称:Project-Dollhouse,代码行数:25,代码来源:BatchLoad.cpp


示例3: FreeImage_GetFileType

//This method is used to load the skybox textures, since it is handled differently than a regular texture
int TextureLoader::LoadSkyboxTexture(const char* imagepath, GLuint skyTexture, GLenum side)
{    
    // Load image using the Free Image library
    FREE_IMAGE_FORMAT format = FreeImage_GetFileType(imagepath, 0);
    FIBITMAP* image = FreeImage_Load(format, imagepath);
    FIBITMAP* image32bits = FreeImage_ConvertTo32Bits(image);
    

    //Generate the cube map texture in Opengl
    //glActiveTexture (GL_TEXTURE0);
    glGenTextures (1, &skyTexture);
    //GLuint textureInd = 0;
    //glGenTextures(1, &textureInd);
    assert(skyTexture != 0);
    
    // Set OpenGL filtering properties (bi-linear interpolation)
    //Bind the texture to the cube map
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	//Texture parameters
    //Clamp-to-edge parameter helps to hide the seams of the cube textures
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    
    // Retrieve width and hight
    int width = FreeImage_GetWidth(image32bits);
    int height = FreeImage_GetHeight(image32bits);
    
    // This will upload the texture to the GPU memory
    glTexImage2D(side, 0, GL_RGBA8, width, height,
                 0, GL_BGRA, GL_UNSIGNED_BYTE, (void*)FreeImage_GetBits(image32bits));
    
    // Free images
    FreeImage_Unload(image);
    FreeImage_Unload(image32bits);
 
    return skyTexture;
}
开发者ID:GeoffreyBoom,项目名称:Noise,代码行数:42,代码来源:TextureLoader.cpp


示例4: FreeImage_GetFileType

bool GrayScaleHMap::loadMap(char* strFile)
{
	//image format
	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
	
	//pointer to the image, once loaded
	FIBITMAP *dib(0);
	
	//check the file signature and deduce its format
	fif = FreeImage_GetFileType(strFile, 0);
	
	//if still unknown, try to guess the file format from the file extension
	if(fif == FIF_UNKNOWN) 
		fif = FreeImage_GetFIFFromFilename(strFile);
	
	//if still unkown, return failure
	if(fif == FIF_UNKNOWN)
		return false;
	
	//check that the plugin has reading capabilities and load the file
	if(FreeImage_FIFSupportsReading(fif))
		dib = FreeImage_Load(fif, strFile);
	
	//if the image failed to load, return failure
	if(!dib)
		return false;
	
	//retrieve the image data
	bits = FreeImage_GetBits(dib);
	
	width = FreeImage_GetWidth(dib);
	height = FreeImage_GetHeight(dib);
	
	if((bits == NULL) || (width == 0) || (height == 0))
		return false;
	
	//Free FreeImage's copy of the data
	FreeImage_Unload(dib);
	
	return true;
}
开发者ID:gcuellar,项目名称:Terrain-Generator,代码行数:41,代码来源:GrayScaleHMap.cpp


示例5: printf

bool cTexture::loadTexture(const char* FilePath){
	//防止重复加载同一张图片
	if(strcmp(FilePath,_FilePath)==0){
		return true;
	}
	//获取图片
	fif=FreeImage_GetFileType(FilePath,0);									
	//识别图片格式
	if(fif == FIF_UNKNOWN){
		fif=FreeImage_GetFIFFromFilename(FilePath);
	}
	if(fif==FIF_UNKNOWN || !FreeImage_FIFSupportsReading(fif)){
		printf("FIError: not support type");
		return false;
	}
	//加载图片
	pic=FreeImage_Load(fif,FilePath);
	if(!pic){
		printf("Texture Error: cant not load!\n");
		return false;
	}
	//获取像素格式
	bits = FreeImage_GetBits(pic);
	width = FreeImage_GetWidth(pic);
	height = FreeImage_GetHeight(pic);
	show(width);show(height);
	if(bits==0 || width ==0 || height==0)
		return false;
	strcpy(_FilePath,FilePath);
	//加载texture 到显存
	glGenTextures(1, &texureId);
	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	glBindTexture(GL_TEXTURE_2D,texureId);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Linear Min Filter
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Mag Filter
	if(fif==FIF_PNG||fif==FIF_TARGA||fif==FIF_GIF)
		glTexImage2D(GL_TEXTURE_2D,0,3,width,height,0,GL_BGRA_EXT,GL_UNSIGNED_BYTE,bits);//支持透明的图片格式 需要设置格式为BGRA
	else
		glTexImage2D(GL_TEXTURE_2D,0,3,width,height,0,GL_BGR_EXT,GL_UNSIGNED_BYTE,bits);//不支持透明的图片格式 
	return true;
}
开发者ID:lizhw5,项目名称:2015openGL,代码行数:41,代码来源:Texture.cpp


示例6: FreeImage_GetFileType

void Texture::loadBMP(const char *fileName)
{

    //image format
    FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
    //check the file signature and deduce its format
    fif = FreeImage_GetFileType(fileName, 0);
    if(fif == FIF_UNKNOWN)
        return ;
    FIBITMAP *bitmap = FreeImage_Load(fif,fileName);
    BYTE *data (0);
    if(FreeImage_FIFSupportsReading(fif))
        data= FreeImage_GetBits(bitmap);
    if(!data)
        return;
    int width=FreeImage_GetWidth(bitmap);
    int height=FreeImage_GetHeight(bitmap);
    //

    glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glGenTextures(1,&m_textureID);
    glBindTexture(GL_TEXTURE_2D,m_textureID);
    //give the image to OpenGL
    glTexImage2D(GL_TEXTURE_2D          //Always GL_TEXTURE_2D
                 ,0                     //0 for now
                 ,GL_RGB                //Format OpenGL uses for image
                 ,width,height          //Width and height
                 ,0                     //The border of the image
                 ,GL_RGB                //GL_RGB, because pixels are stored in RGB format
                 ,GL_UNSIGNED_BYTE      //GL_UNSIGNED_BYTE, because pixels are stored as unsigned numbers
                 ,data                  //The actual pixel data
                );

    FreeImage_Unload(bitmap);

    //    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    //    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
开发者ID:keequenliu,项目名称:glut_opengl,代码行数:41,代码来源:Texture.cpp


示例7: glGenTextures

Texture::Texture(const char* filename, GLenum image_format, GLint internal_format, GLint level, GLint border)
{
	glGenTextures(1, &this->id);

	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
	FIBITMAP *dib(0);
	BYTE* bits(0);
	unsigned int width(0), height(0);
	GLuint gl_texID;

	fif = FreeImage_GetFileType(filename, 0);  //pobieranie typu tekstury
	if (fif == FIF_UNKNOWN)
		fif = FreeImage_GetFIFFromFilename(filename);
	if (fif == FIF_UNKNOWN){
		ReportWarning("Texture file format undefined");
		return;
	}


	if (FreeImage_FIFSupportsReading(fif))	//sprawdza czy moze odczytac
		dib = FreeImage_Load(fif, filename);	//odczytuje

	if (!dib)
		ReportWarning("Could not load texture");

	bits = FreeImage_GetBits(dib); //rozmiar piksela
	width = FreeImage_GetWidth(dib);	//wielkosc tekstury
	height = FreeImage_GetHeight(dib);

	
	glBindTexture(GL_TEXTURE_2D, this->id);		//bindowanie i ustawianie parametrow tekstury
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


	glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height,	//generowanie tekstury
		border, image_format, GL_UNSIGNED_BYTE, bits);


	FreeImage_Unload(dib);
}
开发者ID:dixiluk,项目名称:NfsProject,代码行数:41,代码来源:Texture.cpp


示例8: FreeImage_GetFileType

bool Image::load(std::string file)
{
    //image format
    FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
    //check the file signature and deduce its format
    fif = FreeImage_GetFileType(file.c_str(), 0);
    if(fif == FIF_UNKNOWN)
        return false;
    FIBITMAP *bitmap = FreeImage_Load(fif,file.c_str());
    if(FreeImage_FIFSupportsReading(fif))
    {
        m_data= FreeImage_GetBits(bitmap);
        if(!m_data)
            return false;
        m_width=FreeImage_GetWidth(bitmap);
        m_heigth=FreeImage_GetHeight(bitmap);
    }
    FreeImage_Unload(bitmap);

    return true;
}
开发者ID:keequenliu,项目名称:glut_opengl,代码行数:21,代码来源:image.cpp


示例9: FreeImage_GetFileType

FIBITMAP* CBigle3DApp::LoadFile(CString strFile)
{
    FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;

    // check the file signature and deduce its format
    // (the second argument is currently not used by FreeImage)
    fif = FreeImage_GetFileType(strFile, 0);
    if(fif == FIF_UNKNOWN) {
        // no signature ?
        // try to guess the file format from the file extension
        fif = FreeImage_GetFIFFromFilename(strFile);
    }
    // check that the plugin has reading capabilities ...
    if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
        // ok, let's load the file
        FIBITMAP *dib = FreeImage_Load(fif, strFile, 0);
        // unless a bad file format, we are done !
        return dib;
    }
    return NULL;
}
开发者ID:wernight,项目名称:bigle3d,代码行数:21,代码来源:Bigle+3D.cpp


示例10: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    FiaWindow *window = new FiaWindow;

    FIBITMAP *fib = FreeImage_Load(FIF_JPEG,
		"/home/glenn/Devel/Fia/Tests/FiaViewer/Test.jpg", JPEG_DEFAULT);

 
    window->viewer()->setImage(fib);

std::cout << "gg" << std::endl;

    //viewer->fitImageToViewer(false);
    //viewer->zoom(50.0);

    app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
    window->show();

    return app.exec();
}
开发者ID:atdgroup,项目名称:FreeImageAlgorithms,代码行数:21,代码来源:main.cpp


示例11: testSaveMemIO

void testSaveMemIO(const char *lpszPathName) {
    FIMEMORY *hmem = NULL;

    // load a regular file
    FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(lpszPathName);
    FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, 0);

    // open a memory handle
    hmem = FreeImage_OpenMemory();

    // save the file to memory
    FreeImage_SaveToMemory(fif, dib, hmem, 0);

    // at this point, hmem contains the entire PNG data in memory.
    // the amount of space used by the memory is equal to file_size
    long file_size = FreeImage_TellMemory(hmem);
    printf("File size : %ld\n", file_size);


    // its easy load an image from memory as well

    // seek to the start of the memory stream
    FreeImage_SeekMemory(hmem, 0L, SEEK_SET);

    // get the file type
    FREE_IMAGE_FORMAT mem_fif = FreeImage_GetFileTypeFromMemory(hmem, 0);

    // load an image from the memory handle
    FIBITMAP *check = FreeImage_LoadFromMemory(mem_fif, hmem, 0);

    // save as a regular file
    FreeImage_Save(FIF_PNG, check, "dump.png", PNG_DEFAULT);

    // make sure to free the data since FreeImage_SaveToMemory
    // will cause it to be malloc'd
    FreeImage_CloseMemory(hmem);

    FreeImage_Unload(check);
    FreeImage_Unload(dib);
}
开发者ID:ConnorShore,项目名称:Game,代码行数:40,代码来源:testMemIO.cpp


示例12: GetParameters

    void GLTexture2D::Load()
    {
        auto fileOptions = GetParameters();
        auto filename = application->GetConfig().resourceBase + "/" + fileOptions[0];
        if (!boost::filesystem::exists(filename)) {
            LOG(ERROR) << "File \"" << filename.c_str() << L"\" cannot be opened.";
            throw resource_loading_error() << ::boost::errinfo_file_name(filename) << resid_info(id)
                << errdesc_info("Cannot open include file.");
        }

        auto format = FreeImage_GetFileType(filename.c_str());
        auto flags = 0;

        if (format == FIF_JPEG) {
            flags = JPEG_ACCURATE;
        } else if (format == FIF_TARGA) {
            flags = TARGA_LOAD_RGB888;
        }

        auto bitmap = FreeImage_Load(format, filename.c_str(), flags);
        auto bitmap32 = FreeImage_ConvertTo32Bits(bitmap);
        auto width = FreeImage_GetWidth(bitmap32);
        auto height = FreeImage_GetHeight(bitmap32);
        auto redMask = FreeImage_GetRedMask(bitmap32);
        auto greenMask = FreeImage_GetGreenMask(bitmap32);
        auto blueMask = FreeImage_GetBlueMask(bitmap32);
        void* data = FreeImage_GetBits(bitmap32);
        GLenum fmt = GL_RGBA;
        if (redMask > greenMask && greenMask > blueMask) fmt = GL_BGRA;
        auto internalFmt = GL_RGBA8;
        for (unsigned int i = 1; i < fileOptions.size(); ++i) {
            boost::trim(fileOptions[i]);
            if (fileOptions[i] == "sRGB" && application->GetConfig().useSRGB) internalFmt = GL_SRGB8_ALPHA8;
        }
        TextureDescriptor texDesc(4, internalFmt, fmt, GL_UNSIGNED_BYTE);
        texture = std::make_unique<GLTexture>(width, height, texDesc, data);
        FreeImage_Unload(bitmap32);
        FreeImage_Unload(bitmap);
        Resource::Load();
    }
开发者ID:dasmysh,项目名称:OGLFramework_uulm,代码行数:40,代码来源:GLTexture2D.cpp


示例13: FreeImage_GetFileType

void atTexture::Load( const char* filename ) {
    FREE_IMAGE_FORMAT format = FreeImage_GetFileType(filename,0);//Automatocally detects the format(from over 20 formats!)
    if (format == FIF_UNKNOWN) {
        atContext::log->Error("Error derecting imaga file format of %s", filename);
    }
    FIBITMAP* image = FreeImage_Load(format, filename);
    if (!image) {
        atContext::log->Error("There was an error loading the texture");
    }

    FIBITMAP* temp = image;
    image = FreeImage_ConvertTo32Bits(image);
    FreeImage_Unload(temp);

    int w = FreeImage_GetWidth(image);
    int h = FreeImage_GetHeight(image);

    GLubyte* texture = new GLubyte[4*w*h];
    char* pixels = (char*)FreeImage_GetBits(image);

    for(int j= 0; j<w*h; j++){
        texture[j*4+0]= pixels[j*4+2];
        texture[j*4+1]= pixels[j*4+1];
        texture[j*4+2]= pixels[j*4+0];
        texture[j*4+3]= pixels[j*4+3];
    }

    glGenTextures(1, &m_TextureID);
    glBindTexture(GL_TEXTURE_2D, m_TextureID);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA, w, h, 0, GL_RGBA,GL_UNSIGNED_BYTE,(GLvoid*)texture );
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    GLenum huboError = glGetError();
    if(huboError){
        atContext::log->Error("There was an error loading the texture");
    }
}
开发者ID:ArnauPrat,项目名称:Sacman,代码行数:40,代码来源:Texture.cpp


示例14: loadTexture

	static GLuint loadTexture(const char *filename) {

		FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
		FIBITMAP *dib(0);
		BYTE* bits(0);
		GLuint gl_texID;
		unsigned int width(0), height(0);

		fif = FreeImage_GetFileType(filename, 0);
		if(fif == FIF_UNKNOWN) {
			fif = FreeImage_GetFIFFromFilename(filename);
			return 0;
		}

		if(FreeImage_FIFSupportsReading(fif))
			dib = FreeImage_Load(fif, filename);
		if(!dib)
			return false;

		dib = FreeImage_ConvertTo24Bits(dib);
		bits = FreeImage_GetBits(dib);
		width = FreeImage_GetWidth(dib);
		height = FreeImage_GetHeight(dib);
		if((bits == 0) || (width == 0) || (height == 0))
			return 0;

		glGenTextures(1, &gl_texID);
		glBindTexture(GL_TEXTURE_2D, gl_texID);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
		glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, bits);
		// FreeImage loads textures in BGR format.

		FreeImage_Unload(dib);

		return gl_texID;
	}
开发者ID:Celcius,项目名称:AVT---project,代码行数:40,代码来源:MyTexturedBox.cpp


示例15: Base

Image::Image(const Path& path)
	: Base(path)
{
	// Open the file
	FREE_IMAGE_FORMAT format = FreeImage_GetFileType(path.ToString().Cstr());
	FIBITMAP* image = FreeImage_Load(format, path.ToString().Cstr(), 0);

	if (!image)
	{
		Console::Warning("'@' could not be opened", path);
		return;
	}

	FIBITMAP* temp = image;
	_bitmap = (uint32*)FreeImage_ConvertTo32Bits(image);
	FreeImage_Unload(temp);

	_width = FreeImage_GetWidth(image);
	_height = FreeImage_GetHeight(image);

	Console::WriteLine("'@' loaded successfully", path);
}
开发者ID:dreamsxin,项目名称:WillowEngine,代码行数:22,代码来源:Image.cpp


示例16: LoadTexture

	GLuint LoadTexture(char* szFileName)
	{
		GLuint glTexture;

		FIBITMAP* pBitmap = FreeImage_Load(FreeImage_GetFileType("Images/Charmander.png", 0), "Images/Charmander.png");
		FIBITMAP* pImage = FreeImage_ConvertTo32Bits(pBitmap);

		int iWidth = FreeImage_GetWidth(pImage);
		int iHeight = FreeImage_GetHeight(pImage);

		glGenTextures(1, &glTexture);

		glBindTexture(GL_TEXTURE_2D, glTexture);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, iWidth, iHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, (void*)FreeImage_GetBits(pImage));

		FreeImage_Unload(pImage);

		return glTexture;
	}
开发者ID:bennybroseph,项目名称:SolarSystem,代码行数:22,代码来源:Graphics.cpp


示例17: FreeImage_Initialise

  unsigned char* Texture::loadTexture( const char* fileName_,
                                       unsigned int &width_,
                                       unsigned int &height_ )
  {
    FreeImage_Initialise(TRUE);

    FREE_IMAGE_FORMAT format = FreeImage_GetFileType(fileName_, 0);
    if (format == FIF_UNKNOWN)
      format = FreeImage_GetFIFFromFilename(fileName_);
    if ((format == FIF_UNKNOWN) || !FreeImage_FIFSupportsReading(format))
      return NULL;

    FIBITMAP* img = FreeImage_Load(format, fileName_);
    if (img == NULL)
      return NULL;

    FIBITMAP* tempImg = img;
    img = FreeImage_ConvertTo32Bits(img);
    FreeImage_Unload(tempImg);

    width_ = FreeImage_GetWidth(img);
    height_ = FreeImage_GetHeight(img);

    //BGRA a RGBA
    unsigned char * map = new unsigned char[4 * width_*height_];
    char *buff = (char*)FreeImage_GetBits(img);

    for (unsigned int j = 0; j<width_*height_; j++){
      map[j * 4 + 0] = buff[j * 4 + 2];
      map[j * 4 + 1] = buff[j * 4 + 1];
      map[j * 4 + 2] = buff[j * 4 + 0];
      map[j * 4 + 3] = buff[j * 4 + 3];
    }

    FreeImage_Unload(img);
    FreeImage_DeInitialise();

    return map;
  }
开发者ID:maldicion069,项目名称:OpenRender,代码行数:39,代码来源:Texture.cpp


示例18: load_o14_FromHDtoSystemRAM

void load_o14_FromHDtoSystemRAM(void*) 
{                                                                           
    fifmt_o14 = FreeImage_GetFileType(o14_FilePath, 0);                       
    dib_o14   = FreeImage_Load(fifmt_o14, o14_FilePath, 0);                    
    temp_o14  = dib_o14;                                                      
    dib_o14   = FreeImage_ConvertTo32Bits(temp_o14);                          
    FreeImage_Unload(temp_o14);                                            

    if( dib_o14 != NULL )                                                    
    {                                                                       
        pixels_o14 = (BYTE*)FreeImage_GetBits(dib_o14);                       
    }                                                                     

    o14_isLoadedFromDriveAndWaiting = true;                                  
    //---------------------                                                 
    if(MAX_THREADS > 0)                                                     
    {                                                                       
         MAX_THREADS -= 1;                                                  
    }                                                                       
    //---------------------                                                 
    _endthread();                                                           
}                                                                           
开发者ID:marcclintdion,项目名称:startHere_threadStable-4,代码行数:22,代码来源:o14_ASSET_STREAM.cpp


示例19: load_copperEntrance_FromHDtoSystemRAM

void load_copperEntrance_FromHDtoSystemRAM(void*) 
{                                                                           
    fifmt_copperEntrance = FreeImage_GetFileType(copperEntrance_FilePath, 0);                       
    dib_copperEntrance   = FreeImage_Load(fifmt_copperEntrance, copperEntrance_FilePath, 0);                    
    temp_copperEntrance  = dib_copperEntrance;                                                      
    dib_copperEntrance   = FreeImage_ConvertTo32Bits(temp_copperEntrance);                          
    FreeImage_Unload(temp_copperEntrance);                                            

    if( dib_copperEntrance != NULL )                                                    
    {                                                                       
        pixels_copperEntrance = (BYTE*)FreeImage_GetBits(dib_copperEntrance);                       
    }                                                                     

    copperEntrance_isLoadedFromDriveAndWaiting = true;                                  
    //---------------------                                                 
    if(MAX_THREADS > 0)                                                     
    {                                                                       
         MAX_THREADS -= 1;                                                  
    }                                                                       
    //---------------------                                                 
    _endthread();                                                           
}                                                                           
开发者ID:marcclintdion,项目名称:startHere_threadStable-4,代码行数:22,代码来源:copperEntrance_ASSET_STREAM.cpp


示例20: load_rocks_o15_FromHDtoSystemRAM

void load_rocks_o15_FromHDtoSystemRAM(void*) 
{                                                                           
    fifmt_rocks_o15 = FreeImage_GetFileType(rocks_o15_FilePath, 0);                       
    dib_rocks_o15   = FreeImage_Load(fifmt_rocks_o15, rocks_o15_FilePath, 0);                    
    temp_rocks_o15  = dib_rocks_o15;                                                      
    dib_rocks_o15   = FreeImage_ConvertTo32Bits(temp_rocks_o15);                          
    FreeImage_Unload(temp_rocks_o15);                                            

    if( dib_rocks_o15 != NULL )                                                    
    {                                                                       
        pixels_rocks_o15 = (BYTE*)FreeImage_GetBits(dib_rocks_o15);                       
    }                                                                     

    rocks_o15_isLoadedFromDriveAndWaiting = true;                                  
    //---------------------                                                 
    if(MAX_THREADS > 0)                                                     
    {                                                                       
         MAX_THREADS -= 1;                                                  
    }                                                                       
    //---------------------                                                 
    _endthread();                                                           
}                                                                           
开发者ID:marcclintdion,项目名称:startHere_threadStable-4,代码行数:22,代码来源:rocks_o15_ASSET_STREAM.cpp



注:本文中的FreeImage_Load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FreeImage_OpenMemory函数代码示例发布时间:2022-05-30
下一篇:
C++ FreeImage_Initialise函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap