您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FreeImage_Load函数代码示例

51自学网 2021-06-01 20:48:31
  C++
这篇教程C++ FreeImage_Load函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例3: FreeImage_GetFileType

//This method is used to load the skybox textures, since it is handled differently than a regular textureint 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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: load_png

/// Loading a PNG filegli::texture2D load_png(char const * Filename){	FreeImageInit();	FIBITMAP * Bitmap = FreeImage_Load(FIF_PNG, Filename, 0);	if(!Bitmap)		return gli::texture2D();	glm::uint BPP = FreeImage_GetBPP(Bitmap);	glm::uint Width = FreeImage_GetWidth(Bitmap);	glm::uint Height = FreeImage_GetHeight(Bitmap);	gli::texture2D Texture(1, BPP == 24 ? gli::RGB8_UNORM : gli::RGBA8_UNORM, gli::texture2D::dimensions_type(Width, Height));	memcpy(Texture.data(), FreeImage_GetBits(Bitmap), Texture.size());	FreeImage_Unload(Bitmap);	switch(gli::component_count(Texture.format()))	{	default:		assert(0);		break;	case 3:		for(std::size_t Offset = 0; Offset < Texture.size() / 3; ++Offset)		{			glm::u8vec3 Src = *(reinterpret_cast<glm::u8vec3 const *>(Texture.data()) + Offset);			*(reinterpret_cast<glm::u8vec3*>(Texture.data()) + Offset) = glm::u8vec3(Src.z, Src.y, Src.x);		}		break;	case 4:		for(std::size_t Offset = 0; Offset < Texture.size() / 4; ++Offset)		{			glm::u8vec4 Src = *(reinterpret_cast<glm::u8vec4 const *>(Texture.data()) + Offset);			*(reinterpret_cast<glm::u8vec4*>(Texture.data()) + Offset) = glm::u8vec4(Src.z, Src.y, Src.x, Src.w);		}		break;	}	return Texture;}
开发者ID:LeoYao,项目名称:ogl-samples,代码行数:40,


示例22: FreeImage_Initialise

Image::Image(int width, int height, const char *fname) {    FreeImage_Initialise();    FIBITMAP *bitmap = FreeImage_Load(FIF_BMP, fname, BMP_DEFAULT);    FIBITMAP *bitmap32 = FreeImage_ConvertTo32Bits(bitmap);    _width = width;    _height = height;    if (!bitmap || !bitmap32) {        throw "Failed to load image!";    }    //image scaling    FIBITMAP *bitmap32scale = FreeImage_Rescale(bitmap32, width, height, FILTER_BICUBIC);    BYTE* texturebits = FreeImage_GetBits(bitmap32scale);    _pixels = new Pixel[_width*_height];    Pixel *texture = (Pixel*)texturebits;    for (unsigned int i = 0; i<_width*_height; ++i) {        _pixels[i].setRGBA(texture[i].getB(), texture[i].getG(),                texture[i].getR(), texture[i].getA());    }    FreeImage_Unload(bitmap);}
开发者ID:ionaic,项目名称:barbs-bandits,代码行数:22,


示例23: loadImage

    /// Load a gray-scale image from disk.    void     loadImage(const std::string & rFileName, ImageCPU_8u_C1 & rImage)    {	            // set your own FreeImage error handler	    FreeImage_SetOutputMessage(FreeImageErrorHandler);        FREE_IMAGE_FORMAT eFormat = FreeImage_GetFileType(rFileName.c_str());                // no signature? try to guess the file format from the file extension        if (eFormat == FIF_UNKNOWN)            eFormat = FreeImage_GetFIFFromFilename(rFileName.c_str());        NPP_ASSERT(eFormat != FIF_UNKNOWN);                // check that the plugin has reading capabilities ...        FIBITMAP * pBitmap;        if (FreeImage_FIFSupportsReading(eFormat))             pBitmap = FreeImage_Load(eFormat, rFileName.c_str());        NPP_ASSERT(pBitmap != 0);                // make sure this is an 8-bit single channel image        NPP_ASSERT(FreeImage_GetColorType(pBitmap) == FIC_MINISBLACK);        NPP_ASSERT(FreeImage_GetBPP(pBitmap) == 8);                        // create an ImageCPU to receive the loaded image data        ImageCPU_8u_C1 oImage(FreeImage_GetWidth(pBitmap), FreeImage_GetHeight(pBitmap));                        // Copy the FreeImage data into the new ImageCPU        unsigned int nSrcPitch = FreeImage_GetPitch(pBitmap);        const Npp8u * pSrcLine = FreeImage_GetBits(pBitmap) + nSrcPitch * (FreeImage_GetHeight(pBitmap) -1);        Npp8u * pDstLine = oImage.data();        unsigned int nDstPitch = oImage.pitch();        for (size_t iLine = 0; iLine < oImage.height(); ++iLine)        {            memcpy(pDstLine, pSrcLine, oImage.width() * sizeof(Npp8u));            pSrcLine -= nSrcPitch;            pDstLine += nDstPitch;        }                        // swap the user given image with our result image, effecively                // moving our newly loaded image data into the user provided shell        oImage.swap(rImage);    }
开发者ID:D2LSystem,项目名称:GPU-Computing-SDK-4.2.9,代码行数:40,


示例24: FreeImage_Initialise

Image::Image(const char *image_path, GLuint textureUnit, bool& success) {	success = true;	FreeImage_Initialise();	texture_unit = textureUnit;	// Load Texture	FREE_IMAGE_FORMAT image_format = FreeImage_GetFileType(image_path,0);	FIBITMAP* image_bgr = FreeImage_Load(image_format, image_path);	if (!image_bgr) {		fprintf(stdout, "Failed to load image %s", image_path);		success = false;	}	FIBITMAP* temp = image_bgr;	image_bgr = FreeImage_ConvertTo32Bits(image_bgr);	FreeImage_Unload(temp);	im_width = FreeImage_GetWidth(image_bgr);	im_height = FreeImage_GetHeight(image_bgr);	GLubyte* image_texture = new GLubyte[4*im_width*im_height];	char* image_pixeles = (char*)FreeImage_GetBits(image_bgr);	//FreeImage loads in BGR format, so you need to swap some bytes(Or use GL_BGR).	for(int j= 0; j<im_width*im_height; j++){		image_texture[j*4+0]= image_pixeles[j*4+2];		image_texture[j*4+1]= image_pixeles[j*4+1];		image_texture[j*4+2]= image_pixeles[j*4+0];		image_texture[j*4+3]= image_pixeles[j*4+3];	}	FreeImage_DeInitialise();	// Create one OpenGL texture	glGenTextures(1, &texture_handle);	glActiveTexture(GL_TEXTURE0 + textureUnit);	glBindTexture(GL_TEXTURE_2D, texture_handle);	glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA, im_width, im_height, 0, GL_RGBA,GL_UNSIGNED_BYTE,(GLvoid*)image_texture );	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_MAG_FILTER, GL_NEAREST);	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 	glGenerateMipmap(GL_TEXTURE_2D);	glBindTexture(GL_TEXTURE_2D,0);}
开发者ID:falichs,项目名称:Depixelizing-Pixel-Art-on-GPUs,代码行数:38,


示例25: OpenImage

bool OpenImage(Graphics::TBitmap* picture, const AnsiString& path){	FREE_IMAGE_FORMAT imgFormat;		imgFormat = FreeImage_GetFileType(path.c_str(), 0);		if(imgFormat != FIF_UNKNOWN)	{		FIBITMAP *image = FreeImage_Load(imgFormat, path.c_str(), 0);				if(image)		{			FIBITMAP* tempImage = FreeImage_ConvertTo32Bits(image);			if(!tempImage)			{				FreeImage_Unload(image);				return false;			}			if(LoadImage(tempImage, picture))			{				FreeImage_Unload(image);				FreeImage_Unload(tempImage);				return true;			}			else			{				FreeImage_Unload(image);				FreeImage_Unload(tempImage);				return false;			}		}		else 		{			return false;		}	}	return false;	}
开发者ID:ClockMan,项目名称:edytorgraficzny,代码行数:38,


示例26: dib

bool CTexture::ReloadTexture(){	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;	FIBITMAP* dib(0);	fif = FreeImage_GetFileType(sPath.c_str(), 0); // Check the file signature and deduce its format	if(fif == FIF_UNKNOWN) // If still unknown, try to guess the file format from the file extension		fif = FreeImage_GetFIFFromFilename(sPath.c_str());		if(fif == FIF_UNKNOWN) // If still unknown, return failure		return false;	if(FreeImage_FIFSupportsReading(fif)) // Check if the plugin has reading capabilities and load the file		dib = FreeImage_Load(fif, sPath.c_str());	if(!dib)		return false;	BYTE* bDataPointer = FreeImage_GetBits(dib); // Retrieve the image data	// If somehow one of these failed (they shouldn't), return failure	if(bDataPointer == NULL || FreeImage_GetWidth(dib) == 0 || FreeImage_GetHeight(dib) == 0)		return false;	GLenum format;	int bada = FreeImage_GetBPP(dib);	if(FreeImage_GetBPP(dib) == 32)format = GL_RGBA;	if(FreeImage_GetBPP(dib) == 24)format = GL_BGR;	if(FreeImage_GetBPP(dib) == 8)format = GL_LUMINANCE;	glBindTexture(GL_TEXTURE_2D, uiTexture);	glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iWidth, iHeight, format, GL_UNSIGNED_BYTE, bDataPointer);	if(bMipMapsGenerated)glGenerateMipmap(GL_TEXTURE_2D);		FreeImage_Unload(dib);	return true; // Success}
开发者ID:MorkovkAs,项目名称:Computer-Graphics-OpenGL,代码行数:38,


示例27: serviceLoad

static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam){	char *lpszFilename = (char *)wParam;	if(lpszFilename==NULL) return 0;	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;	if(lParam & IMGL_WCHAR)		fif = FreeImage_GetFileTypeU((wchar_t *)lpszFilename, 0);	else		fif = FreeImage_GetFileType(lpszFilename, 0);	if(fif == FIF_UNKNOWN) {		if(lParam & IMGL_WCHAR)			fif = FreeImage_GetFIFFromFilenameU((wchar_t *)lpszFilename);		else			fif = FreeImage_GetFIFFromFilename(lpszFilename);	}	// check that the plugin has reading capabilities ...	if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {		// ok, let's load the file		FIBITMAP *dib;		if (lParam & IMGL_WCHAR)			dib = FreeImage_LoadU(fif, (wchar_t *)lpszFilename, 0);		else			dib = FreeImage_Load(fif, lpszFilename, 0);		if(dib == NULL || (lParam & IMGL_RETURNDIB))			return (INT_PTR)dib;		HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(dib);		FreeImage_Unload(dib);		FI_CorrectBitmap32Alpha(hbm, FALSE);		return ((INT_PTR)hbm);	}	return NULL;}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:38,


示例28: picture_load

uint8_t picture_load(const char* filename) {  FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;  int flag = 0;  FIBITMAP *temp;  fif=FreeImage_GetFileType(filename, 0);  if(fif == FIF_UNKNOWN) {    fif=FreeImage_GetFIFFromFilename(filename);  }  if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {    temp = FreeImage_Load(fif, filename,flag);    if(temp) {      dib = FreeImage_ConvertTo24Bits(temp);      FreeImage_Unload(temp);      if(dib) {        w = FreeImage_GetWidth(dib);        h = FreeImage_GetHeight(dib);        if(w == 0 || h == 0) {          FreeImage_Unload(dib);          dib=NULL;          return (last_error = PIC_LOADING);        } else if(w > 1000 || h > 4000) {          FreeImage_Unload(dib);          dib=NULL;          return (last_error = PIC_SIZE);        } else {          return (last_error = analyze());        }      } else {        return (last_error = PIC_CONVERT);      }    } else {      return (last_error = PIC_LOADING);    }  } else {    return (last_error = PIC_FORMAT);  }}
开发者ID:bpabel,项目名称:knittington,代码行数:37,



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


C++ FreeImage_OpenMemory函数代码示例
C++ FreeImage_Initialise函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。