这篇教程C++ FreeImage_OutputMessageProc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FreeImage_OutputMessageProc函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeImage_OutputMessageProc函数的具体用法?C++ FreeImage_OutputMessageProc怎么用?C++ FreeImage_OutputMessageProc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FreeImage_OutputMessageProc函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: openStdIOstatic BOOLopenStdIO(const char* src_file, const char* dst_file, FreeImageIO* dst_io, fi_handle* src_handle, fi_handle* dst_handle) { *src_handle = NULL; *dst_handle = NULL; FreeImageIO io; SetDefaultIO (&io); const BOOL isSameFile = (dst_file && (strcmp(src_file, dst_file) == 0)) ? TRUE : FALSE; FILE* srcp = NULL; FILE* dstp = NULL; if(isSameFile) { srcp = fopen(src_file, "r+b"); dstp = srcp; } else { srcp = fopen(src_file, "rb"); if(dst_file) { dstp = fopen(dst_file, "wb"); } } if(!srcp || (dst_file && !dstp)) { if(!srcp) { FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open /"%s/" for reading", src_file); } else { FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open /"%s/" for writing", dst_file); } closeStdIO(srcp, dstp); return FALSE; } if(FreeImage_GetFileTypeFromHandle(&io, srcp) != FIF_JPEG) { FreeImage_OutputMessageProc(FIF_JPEG, " Source file /"%s/" is not jpeg", src_file); closeStdIO(srcp, dstp); return FALSE; } *dst_io = io; *src_handle = srcp; *dst_handle = dstp; return TRUE;}
开发者ID:Remotion,项目名称:freeimage,代码行数:46,
示例2: ls_jpeg_output_messagels_jpeg_output_message (j_common_ptr cinfo) { char buffer[JMSG_LENGTH_MAX]; // create the message (*cinfo->err->format_message)(cinfo, buffer); // send it to user's message proc FreeImage_OutputMessageProc(FIF_JPEG, buffer);}
开发者ID:Remotion,项目名称:freeimage,代码行数:8,
示例3: Loadstatic FIBITMAP * DLL_CALLCONVLoad(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { if (handle != NULL) { BITMAPFILEHEADER bitmapfileheader; DWORD type = 0; BYTE magic[2]; // we use this offset value to make seemingly absolute seeks relative in the file long offset_in_file = io->tell_proc(handle); // read the magic io->read_proc(&magic, sizeof(magic), 1, handle); // compare the magic with the number we know // somebody put a comment here explaining the purpose of this loop while (memcmp(&magic, "BA", 2) == 0) { io->read_proc(&bitmapfileheader.bfSize, sizeof(DWORD), 1, handle); io->read_proc(&bitmapfileheader.bfReserved1, sizeof(WORD), 1, handle); io->read_proc(&bitmapfileheader.bfReserved2, sizeof(WORD), 1, handle); io->read_proc(&bitmapfileheader.bfOffBits, sizeof(DWORD), 1, handle); io->read_proc(&magic, sizeof(magic), 1, handle); } // read the fileheader io->seek_proc(handle, 0 - sizeof(magic), SEEK_CUR); io->read_proc(&bitmapfileheader, sizeof(BITMAPFILEHEADER), 1, handle);#ifdef FREEIMAGE_BIGENDIAN SwapFileHeader(&bitmapfileheader);#endif // read the first byte of the infoheader io->read_proc(&type, sizeof(DWORD), 1, handle); io->seek_proc(handle, 0 - sizeof(DWORD), SEEK_CUR);#ifdef FREEIMAGE_BIGENDIAN SwapLong(&type);#endif // call the appropriate load function for the found bitmap type if (type == 40) return LoadWindowsBMP(io, handle, flags, offset_in_file + bitmapfileheader.bfOffBits); if (type == 12) return LoadOS21XBMP(io, handle, flags, offset_in_file + bitmapfileheader.bfOffBits); if (type <= 64) return LoadOS22XBMP(io, handle, flags, offset_in_file + bitmapfileheader.bfOffBits); FreeImage_OutputMessageProc(s_format_id, "unknown bmp subtype with id %d", type); } return NULL;}
开发者ID:MichaelH13,项目名称:sdkpub,代码行数:58,
示例4: compression/**Save using EXR_LC compression (works only with RGB[A]F images)*/static BOOLSaveAsEXR_LC(C_OStream& ostream, FIBITMAP *dib, Imf::Header& header, int width, int height) { int x, y; Imf::RgbaChannels rgbaChannels; try { FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib); // convert from float to half Imf::Array2D<Imf::Rgba> pixels(height, width); switch(image_type) { case FIT_RGBF: rgbaChannels = Imf::WRITE_YC; for(y = 0; y < height; y++) { FIRGBF *src_bits = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y); for(x = 0; x < width; x++) { Imf::Rgba &dst_bits = pixels[y][x]; dst_bits.r = src_bits[x].red; dst_bits.g = src_bits[x].green; dst_bits.b = src_bits[x].blue; } } break; case FIT_RGBAF: rgbaChannels = Imf::WRITE_YCA; for(y = 0; y < height; y++) { FIRGBAF *src_bits = (FIRGBAF*)FreeImage_GetScanLine(dib, height - 1 - y); for(x = 0; x < width; x++) { Imf::Rgba &dst_bits = pixels[y][x]; dst_bits.r = src_bits[x].red; dst_bits.g = src_bits[x].green; dst_bits.b = src_bits[x].blue; dst_bits.a = src_bits[x].alpha; } } break; default: THROW (Iex::IoExc, "Bad image type"); break; } // write the data Imf::RgbaOutputFile file(ostream, header, rgbaChannels); file.setFrameBuffer (&pixels[0][0], 1, width); file.writePixels (height); return TRUE; } catch(Iex::BaseExc & e) { FreeImage_OutputMessageProc(s_format_id, e.what()); return FALSE; }}
开发者ID:respu,项目名称:xsilium-engine,代码行数:59,
示例5: rgbe_Error/**Default error routine. change this to change error handling */static BOOL rgbe_Error(rgbe_error_code error_code, const char *msg) { switch (error_code) { case rgbe_read_error: FreeImage_OutputMessageProc(s_format_id, "RGBE read error"); break; case rgbe_write_error: FreeImage_OutputMessageProc(s_format_id, "RGBE write error"); break; case rgbe_format_error: FreeImage_OutputMessageProc(s_format_id, "RGBE bad file format: %s/n", msg); break; default: case rgbe_memory_error: FreeImage_OutputMessageProc(s_format_id, "RGBE error: %s/n",msg); } return FALSE;}
开发者ID:FlyApple,项目名称:_3rdParty,代码行数:22,
示例6: Loadstatic FIBITMAP * DLL_CALLCONVLoad(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { FIBITMAP *dib = NULL; if(!handle) { return NULL; } BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS; try { rgbeHeaderInfo header_info; unsigned width, height; // Read the header if(rgbe_ReadHeader(io, handle, &width, &height, &header_info) == FALSE) { return NULL; } // allocate a RGBF image dib = FreeImage_AllocateHeaderT(header_only, FIT_RGBF, width, height); if(!dib) { throw FI_MSG_ERROR_MEMORY; } // set the metadata as comments rgbe_ReadMetadata(dib, &header_info); if(header_only) { // header only mode return dib; } // read the image pixels and fill the dib for(unsigned y = 0; y < height; y++) { FIRGBF *scanline = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y); if(!rgbe_ReadPixels_RLE(io, handle, scanline, width, 1)) { FreeImage_Unload(dib); return NULL; } } } catch(const char *text) { if(dib != NULL) { FreeImage_Unload(dib); } FreeImage_OutputMessageProc(s_format_id, text); } return dib;}
开发者ID:FlyApple,项目名称:_3rdParty,代码行数:54,
示例7: libraw_LoadEmbeddedPreview/** Get the embedded JPEG preview image from RAW picture with included Exif Data. @param RawProcessor Libraw handle@param flags JPEG load flags@return Returns the loaded dib if successfull, returns NULL otherwise*/static FIBITMAP * libraw_LoadEmbeddedPreview(LibRaw *RawProcessor, int flags) { FIBITMAP *dib = NULL; libraw_processed_image_t *thumb_image = NULL; try { // unpack data if(RawProcessor->unpack_thumb() != LIBRAW_SUCCESS) { // run silently "LibRaw : failed to run unpack_thumb" return NULL; } // retrieve thumb image int error_code = 0; thumb_image = RawProcessor->dcraw_make_mem_thumb(&error_code); if(thumb_image) { if(thumb_image->type != LIBRAW_IMAGE_BITMAP) { // attach the binary data to a memory stream FIMEMORY *hmem = FreeImage_OpenMemory((BYTE*)thumb_image->data, (DWORD)thumb_image->data_size); // get the file type FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(hmem, 0); if(fif == FIF_JPEG) { // rotate according to Exif orientation flags |= JPEG_EXIFROTATE; } // load an image from the memory stream dib = FreeImage_LoadFromMemory(fif, hmem, flags); // close the stream FreeImage_CloseMemory(hmem); } else if((flags & FIF_LOAD_NOPIXELS) != FIF_LOAD_NOPIXELS) { // convert processed data to output dib dib = libraw_ConvertProcessedImageToDib(thumb_image); } } else { throw "LibRaw : failed to run dcraw_make_mem_thumb"; } // clean-up and return RawProcessor->dcraw_clear_mem(thumb_image); return dib; } catch(const char *text) { // clean-up and return if(thumb_image) { RawProcessor->dcraw_clear_mem(thumb_image); } if(text != NULL) { FreeImage_OutputMessageProc(s_format_id, text); } } return NULL;}
开发者ID:TLeonardUK,项目名称:MicroBuild,代码行数:60,
示例8: FreeImage_CloneTagFITAG * DLL_CALLCONV FreeImage_CloneTag(FITAG *tag) { if(!tag) return NULL; // allocate a new tag FITAG *clone = FreeImage_CreateTag(); if(!clone) return NULL; try { // copy the tag FITAGHEADER *src_tag = (FITAGHEADER *)tag->data; FITAGHEADER *dst_tag = (FITAGHEADER *)clone->data; // tag ID dst_tag->id = src_tag->id; // tag key if(src_tag->key) { dst_tag->key = (char*)malloc((strlen(src_tag->key) + 1) * sizeof(char)); if(!dst_tag->key) { throw FI_MSG_ERROR_MEMORY; } strcpy(dst_tag->key, src_tag->key); } // tag description if(src_tag->description) { dst_tag->description = (char*)malloc((strlen(src_tag->description) + 1) * sizeof(char)); if(!dst_tag->description) { throw FI_MSG_ERROR_MEMORY; } strcpy(dst_tag->description, src_tag->description); } // tag data type dst_tag->type = src_tag->type; // tag count dst_tag->count = src_tag->count; // tag length dst_tag->length = src_tag->length; // tag value dst_tag->value = (BYTE*)malloc(src_tag->length * sizeof(BYTE)); if(!dst_tag->value) { throw FI_MSG_ERROR_MEMORY; } memcpy(dst_tag->value, src_tag->value, src_tag->length); return clone; } catch(const char *message) { FreeImage_DeleteTag(clone); FreeImage_OutputMessageProc(FIF_UNKNOWN, message); return NULL; }}
开发者ID:respu,项目名称:xsilium-engine,代码行数:52,
示例9: libraw_ConvertProcessedImageToDib/**Convert a processed raw image to a FIBITMAP@param image Processed raw image@return Returns the converted dib if successfull, returns NULL otherwise@see libraw_LoadEmbeddedPreview*/static FIBITMAP * libraw_ConvertProcessedImageToDib(libraw_processed_image_t *image) { FIBITMAP *dib = NULL; try { unsigned width = image->width; unsigned height = image->height; unsigned bpp = image->bits; if(bpp == 16) { // allocate output dib dib = FreeImage_AllocateT(FIT_RGB16, width, height); if(!dib) { throw FI_MSG_ERROR_DIB_MEMORY; } // write data WORD *raw_data = (WORD*)image->data; for(unsigned y = 0; y < height; y++) { FIRGB16 *output = (FIRGB16*)FreeImage_GetScanLine(dib, height - 1 - y); for(unsigned x = 0; x < width; x++) { output[x].red = raw_data[0]; output[x].green = raw_data[1]; output[x].blue = raw_data[2]; raw_data += 3; } } } else if(bpp == 8) { // allocate output dib dib = FreeImage_AllocateT(FIT_BITMAP, width, height, 24); if(!dib) { throw FI_MSG_ERROR_DIB_MEMORY; } // write data BYTE *raw_data = (BYTE*)image->data; for(unsigned y = 0; y < height; y++) { RGBTRIPLE *output = (RGBTRIPLE*)FreeImage_GetScanLine(dib, height - 1 - y); for(unsigned x = 0; x < width; x++) { output[x].rgbtRed = raw_data[0]; output[x].rgbtGreen = raw_data[1]; output[x].rgbtBlue = raw_data[2]; raw_data += 3; } } } return dib; } catch(const char *text) { FreeImage_Unload(dib); FreeImage_OutputMessageProc(s_format_id, text); return NULL; }}
开发者ID:TLeonardUK,项目名称:MicroBuild,代码行数:58,
示例10: marker/** Read JPEG_APP1 marker (Exif profile) @param dib Input FIBITMAP @param dataptr Pointer to the APP1 marker @param datalen APP1 marker length @return Returns TRUE if successful, FALSE otherwise*/BOOL jpeg_read_exif_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { // marker identifying string for Exif = "Exif/0/0" BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; BYTE lsb_first[4] = { 0x49, 0x49, 0x2A, 0x00 }; // Intel order BYTE msb_first[4] = { 0x4D, 0x4D, 0x00, 0x2A }; // Motorola order unsigned int length = datalen; BYTE *profile = (BYTE*)dataptr; // verify the identifying string if(memcmp(exif_signature, profile, sizeof(exif_signature)) == 0) { // Exif profile profile += sizeof(exif_signature); length -= sizeof(exif_signature); // check the endianess order BOOL bMotorolaOrder = TRUE; if(memcmp(profile, lsb_first, sizeof(lsb_first)) == 0) { // Exif section in Intel order bMotorolaOrder = FALSE; } else { if(memcmp(profile, msb_first, sizeof(msb_first)) == 0) { // Exif section in Motorola order bMotorolaOrder = TRUE; } else { // Invalid Exif alignment marker return FALSE; } } // this is the offset to the first IFD unsigned long first_offset = ReadUint32(bMotorolaOrder, profile + 4); if (first_offset < 8 || first_offset > 16) { // This is usually set to 8 // but PENTAX Optio 230 has it set differently, and uses it as offset. FreeImage_OutputMessageProc(FIF_JPEG, "Exif: Suspicious offset of first IFD value"); return FALSE; } // process Exif directories return jpeg_read_exif_dir(dib, profile, first_offset, length, bMotorolaOrder); } return FALSE;}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:58,
示例11: throwFIBITMAP* psdParser::Load(FreeImageIO *io, fi_handle handle, int s_format_id) { FIBITMAP *Bitmap = NULL; try { if (NULL == handle) { throw("Cannot open file"); } if (!_headerInfo.Read(io, handle)) { throw("Error in header"); } if (!_colourModeData.Read(io, handle)) { throw("Error in ColourMode Data"); } if (!ReadImageResource(io, handle)) { throw("Error in Image Resource"); } if (!ReadLayerAndMaskInfoSection(io, handle)) { throw("Error in Mask Info"); } Bitmap = ReadImageData(io, handle); if (NULL == Bitmap) { throw("Error in Image Data"); } // set resolution info if(NULL != Bitmap) { unsigned res_x = 2835; // 72 dpi unsigned res_y = 2835; // 72 dpi if (_bResolutionInfoFilled) { _resolutionInfo.GetResolutionInfo(res_x, res_y); } FreeImage_SetDotsPerMeterX(Bitmap, res_x); FreeImage_SetDotsPerMeterY(Bitmap, res_y); } // set ICC profile if(NULL != _iccProfile._ProfileData) { FreeImage_CreateICCProfile(Bitmap, _iccProfile._ProfileData, _iccProfile._ProfileSize); } } catch(const char *text) { FreeImage_OutputMessageProc(s_format_id, text); } return Bitmap;}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:51,
示例12: libraw_ConvertProcessedRawToDib/**Convert a processed raw data array to a FIBITMAP@param RawProcessor LibRaw handle containing the processed raw image@return Returns the converted dib if successfull, returns NULL otherwise*/static FIBITMAP * libraw_ConvertProcessedRawToDib(LibRaw *RawProcessor) { FIBITMAP *dib = NULL; int width, height, colors, bpp; try { int bgr = 0; // pixel copy order: RGB if (bgr == 0) and BGR otherwise // get image info RawProcessor->get_mem_image_format(&width, &height, &colors, &bpp); // only 3-color images supported... if(colors != 3) { throw "LibRaw : only 3-color images supported"; } if(bpp == 16) { // allocate output dib dib = FreeImage_AllocateT(FIT_RGB16, width, height); if(!dib) { throw FI_MSG_ERROR_DIB_MEMORY; } } else if(bpp == 8) {#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR bgr = 1; // only useful for FIT_BITMAP types#endif // allocate output dib dib = FreeImage_AllocateT(FIT_BITMAP, width, height, 24); if(!dib) { throw FI_MSG_ERROR_DIB_MEMORY; } } // copy post-processed bitmap data into FIBITMAP buffer if(RawProcessor->copy_mem_image(FreeImage_GetBits(dib), FreeImage_GetPitch(dib), bgr) != LIBRAW_SUCCESS) { throw "LibRaw : failed to copy data into dib"; } // flip vertically FreeImage_FlipVertical(dib); return dib; } catch(const char *text) { FreeImage_Unload(dib); FreeImage_OutputMessageProc(s_format_id, text); return NULL; }}
开发者ID:TLeonardUK,项目名称:MicroBuild,代码行数:56,
示例13: bitdepth/**Load raw data and convert to FIBITMAP@param RawProcessor Libraw handle@param bitspersample Output bitdepth (8- or 16-bit)@return Returns the loaded dib if successfull, returns NULL otherwise*/static FIBITMAP * libraw_LoadRawData(LibRaw *RawProcessor, int bitspersample) { FIBITMAP *dib = NULL; try { // set decoding parameters // ----------------------- // (-6) 16-bit or 8-bit RawProcessor->imgdata.params.output_bps = bitspersample; // (-g power toe_slope) if(bitspersample == 16) { // set -g 1 1 for linear curve RawProcessor->imgdata.params.gamm[0] = 1; RawProcessor->imgdata.params.gamm[1] = 1; } else if(bitspersample == 8) { // by default settings for rec. BT.709 are used: power 2.222 (i.e. gamm[0]=1/2.222) and slope 4.5 RawProcessor->imgdata.params.gamm[0] = 1/2.222; RawProcessor->imgdata.params.gamm[1] = 4.5; } // (-W) Don't use automatic increase of brightness by histogram RawProcessor->imgdata.params.no_auto_bright = 1; // (-a) Use automatic white balance obtained after averaging over the entire image RawProcessor->imgdata.params.use_auto_wb = 1; // (-q 3) Adaptive homogeneity-directed demosaicing algorithm (AHD) RawProcessor->imgdata.params.user_qual = 3; // ----------------------- // unpack data if(RawProcessor->unpack() != LIBRAW_SUCCESS) { throw "LibRaw : failed to unpack data"; } // process data (... most consuming task ...) if(RawProcessor->dcraw_process() != LIBRAW_SUCCESS) { throw "LibRaw : failed to process data"; } // retrieve processed image dib = libraw_ConvertProcessedRawToDib(RawProcessor); return dib; } catch(const char *text) { FreeImage_OutputMessageProc(s_format_id, text); return NULL; }}
开发者ID:TLeonardUK,项目名称:MicroBuild,代码行数:55,
示例14: mymngerrormng_boolmymngerror(mng_handle mng, mng_int32 code, mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar text) { char msg[256]; if((code == MNG_SEQUENCEERROR) && (chunktype == MNG_UINT_TERM)) { // ignore sequence error for TERM return MNG_TRUE; } if(text) { // text can be null depending on compiler options sprintf(msg, "Error reported by libmng (%d)/r/n/r/n%s", code, text); } else { sprintf(msg, "Error %d reported by libmng", code); } FreeImage_OutputMessageProc(s_format_id, msg); return MNG_FALSE;}
开发者ID:Ayane,项目名称:BLPConverter,代码行数:16,
示例15: FreeImage_ZLibCompress/**Compresses a source buffer into a target buffer, using the ZLib library. Upon entry, target_size is the total size of the destination buffer, which must be at least 0.1% larger than source_size plus 12 bytes. @param target Destination buffer@param target_size Size of the destination buffer, in bytes@param source Source buffer@param source_size Size of the source buffer, in bytes@return Returns the actual size of the compressed buffer, returns 0 if an error occured@see FreeImage_ZLibUncompress*/DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size; int zerr = compress(target, &dest_len, source, source_size); switch(zerr) { case Z_MEM_ERROR: // not enough memory case Z_BUF_ERROR: // not enough room in the output buffer FreeImage_OutputMessageProc(FIF_UNKNOWN, "Zlib error : %s", zError(zerr)); return 0; case Z_OK: return dest_len; } return 0;}
开发者ID:Ali-il,项目名称:gamekit,代码行数:28,
示例16: FreeImage_ZLibUncompress/**Decompresses a source buffer into a target buffer, using the ZLib library. Upon entry, target_size is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.@param target Destination buffer@param target_size Size of the destination buffer, in bytes@param source Source buffer@param source_size Size of the source buffer, in bytes@return Returns the actual size of the uncompressed buffer, returns 0 if an error occured@see FreeImage_ZLibCompress*/DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { DWORD dest_len = target_size; int zerr = uncompress(target, &dest_len, source, source_size); switch(zerr) { case Z_MEM_ERROR: // not enough memory case Z_BUF_ERROR: // not enough room in the output buffer case Z_DATA_ERROR: // input data was corrupted FreeImage_OutputMessageProc(FIF_UNKNOWN, "Zlib error : %s", zError(zerr)); return 0; case Z_OK: return dest_len; } return 0;}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:32,
示例17: SetPreviewImage/**Set the preview image using the dib embedded thumbnail*/static BOOLSetPreviewImage(FIBITMAP *dib, Imf::Header& header) { if(!FreeImage_GetThumbnail(dib)) { return FALSE; } FIBITMAP* thumbnail = FreeImage_GetThumbnail(dib); if((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 32)) { // invalid thumbnail - ignore it FreeImage_OutputMessageProc(s_format_id, FI_MSG_WARNING_INVALID_THUMBNAIL); } else { const unsigned thWidth = FreeImage_GetWidth(thumbnail); const unsigned thHeight = FreeImage_GetHeight(thumbnail); Imf::PreviewImage preview(thWidth, thHeight); // copy thumbnail to 32-bit RGBA preview image const BYTE* src_line = FreeImage_GetScanLine(thumbnail, thHeight - 1); Imf::PreviewRgba* dst_line = preview.pixels(); const unsigned srcPitch = FreeImage_GetPitch(thumbnail); for (unsigned y = 0; y < thHeight; y++) { const RGBQUAD* src_pixel = (RGBQUAD*)src_line; Imf::PreviewRgba* dst_pixel = dst_line; for(unsigned x = 0; x < thWidth; x++) { dst_pixel->r = src_pixel->rgbRed; dst_pixel->g = src_pixel->rgbGreen; dst_pixel->b = src_pixel->rgbBlue; dst_pixel->a = src_pixel->rgbReserved; src_pixel++; dst_pixel++; } src_line -= srcPitch; dst_line += thWidth; } header.setPreviewImage(preview); } return TRUE;}
开发者ID:respu,项目名称:xsilium-engine,代码行数:48,
示例18: FreeImage_SaveToMemoryBOOL DLL_CALLCONVFreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags) { if (stream) { FreeImageIO io; SetMemoryIO(&io); FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data); if(mem_header->delete_me == TRUE) { return FreeImage_SaveToHandle(fif, dib, &io, (fi_handle)stream, flags); } else { // do not save in a user buffer FreeImage_OutputMessageProc(fif, "Memory buffer is read only"); } } return FALSE;}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:18,
示例19: FreeImage_WriteMemory/**Writes data to a memory stream.@param buffer Pointer to data to be written@param size Item size in bytes@param count Maximum number of items to be written@param stream Pointer to FIMEMORY structure@return Returns the number of full items actually written, which may be less than count if an error occurs*/unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream) { if (stream != NULL) { FreeImageIO io; SetMemoryIO(&io); FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(((FIMEMORY*)stream)->data); if(mem_header->delete_me == TRUE) { return io.write_proc((void *)buffer, size, count, stream); } else { // do not write in a user buffer FreeImage_OutputMessageProc(FIF_UNKNOWN, "Memory buffer is read only"); } } return 0;}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:26,
示例20: Loadstatic FIBITMAP * DLL_CALLCONVLoad(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { FIBITMAP *dib = NULL; if(handle) { try { rgbeHeaderInfo header_info; unsigned width, height; // Read the header if(rgbe_ReadHeader(io, handle, &width, &height, &header_info) == FALSE) return NULL; // allocate a RGBF image dib = FreeImage_AllocateT(FIT_RGBF, width, height); if(!dib) { throw "Memory allocation failed"; } // read the image pixels and fill the dib for(unsigned y = 0; y < height; y++) { FIRGBF *scanline = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y); if(!rgbe_ReadPixels_RLE(io, handle, scanline, width, 1)) { FreeImage_Unload(dib); return NULL; } } // set the metadata as comments rgbe_ReadMetadata(dib, &header_info); } catch(const char *text) { if(dib != NULL) { FreeImage_Unload(dib); } FreeImage_OutputMessageProc(s_format_id, text); } } return dib;}
开发者ID:BackupTheBerlios,项目名称:mimplugins-svn,代码行数:44,
示例21: FIA_FFTFIBITMAP* DLL_CALLCONVFIA_FFT(FIBITMAP *src){ if(!src) return NULL; // Convert from src_type to FIT_BITMAP FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(src); switch (src_type) { case FIT_BITMAP: // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit if(FreeImage_GetBPP(src) == 8) return fftUCharImage.FFT(src); break; case FIT_UINT16: // array of unsigned short: unsigned 16-bit return fftUShortImage.FFT(src); case FIT_INT16: // array of short: signed 16-bit return fftShortImage.FFT(src); case FIT_UINT32: // array of unsigned long: unsigned 32-bit return fftULongImage.FFT(src); case FIT_INT32: // array of long: signed 32-bit return fftLongImage.FFT(src); case FIT_FLOAT: // array of float: 32-bit return fftFloatImage.FFT(src); case FIT_DOUBLE: // array of double: 64-bit return fftDoubleImage.FFT(src); default: break; } FreeImage_OutputMessageProc(FIF_UNKNOWN, "FREE_IMAGE_TYPE: Unable to perform FFT for type %d.", src_type); return NULL;}
开发者ID:atdgroup,项目名称:FreeImageAlgorithms,代码行数:42,
示例22: FreeImage_JPEGTransformBOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect) { try { // check the src file format if(FreeImage_GetFileType(src_file) != FIF_JPEG) { throw FI_MSG_ERROR_MAGIC_NUMBER; } // setup IO FilenameIO filenameIO; memset(&filenameIO, 0, sizeof(FilenameIO)); filenameIO.src_file = src_file; filenameIO.dst_file = dst_file; // perform the transformation return LosslessTransform(&filenameIO, operation, NULL, perfect); } catch(const char *text) { FreeImage_OutputMessageProc(FIF_JPEG, text); return FALSE; }}
开发者ID:AntiMoron,项目名称:YSLib,代码行数:22,
示例23: getMemIOstatic BOOLgetMemIO(FIMEMORY* src_stream, FIMEMORY* dst_stream, FreeImageIO* dst_io, fi_handle* src_handle, fi_handle* dst_handle) { *src_handle = NULL; *dst_handle = NULL; FreeImageIO io; SetMemoryIO (&io); if(dst_stream) { FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(dst_stream->data); if(mem_header->delete_me != TRUE) { // do not save in a user buffer FreeImage_OutputMessageProc(FIF_JPEG, "Destination memory buffer is read only"); return FALSE; } } *dst_io = io; *src_handle = src_stream; *dst_handle = dst_stream; return TRUE;}
开发者ID:Remotion,项目名称:freeimage,代码行数:23,
示例24: Savestatic BOOL DLL_CALLCONVSave(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) { if(!dib) return FALSE; FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib); if(src_type != FIT_RGBF) { FreeImage_OutputMessageProc(s_format_id, "FREE_IMAGE_TYPE: Unable to convert from type %d to type %d./n No such conversion exists.", src_type, FIT_RGBF); return FALSE; } unsigned width = FreeImage_GetWidth(dib); unsigned height = FreeImage_GetHeight(dib); // write the header rgbeHeaderInfo header_info; memset(&header_info, 0, sizeof(rgbeHeaderInfo)); // fill the header with correct gamma and exposure rgbe_WriteMetadata(dib, &header_info); // fill a comment sprintf(header_info.comment, "# Made with FreeImage %s", FreeImage_GetVersion()); if(!rgbe_WriteHeader(io, handle, width, height, &header_info)) { return FALSE; } // write each scanline for(unsigned y = 0; y < height; y++) { FIRGBF *scanline = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y); if(!rgbe_WritePixels_RLE(io, handle, scanline, width, 1)) { return FALSE; } } return TRUE;}
开发者ID:FlyApple,项目名称:_3rdParty,代码行数:36,
示例25: JPEGTransformFromHandle//.........这里部分代码省略......... transfoptions.perfect = (perfect == TRUE) ? TRUE : FALSE; // Drop non-transformable edge blocks: trim off any partial edge MCUs that the transform can't handle. transfoptions.trim = TRUE; try { // Initialize the JPEG decompression object with default error handling srcinfo.err = jpeg_std_error(&jsrcerr); srcinfo.err->error_exit = ls_jpeg_error_exit; srcinfo.err->output_message = ls_jpeg_output_message; jpeg_create_decompress(&srcinfo); // Initialize the JPEG compression object with default error handling dstinfo.err = jpeg_std_error(&jdsterr); dstinfo.err->error_exit = ls_jpeg_error_exit; dstinfo.err->output_message = ls_jpeg_output_message; jpeg_create_compress(&dstinfo); // Specify data source for decompression jpeg_freeimage_src(&srcinfo, src_handle, src_io); // Enable saving of extra markers that we want to copy jcopy_markers_setup(&srcinfo, copyoption); // Read the file header jpeg_read_header(&srcinfo, TRUE); // crop option char crop[64]; const BOOL hasCrop = getCropString(crop, left, top, right, bottom, swappedDim ? srcinfo.image_height : srcinfo.image_width, swappedDim ? srcinfo.image_width : srcinfo.image_height); if(hasCrop) { if(!jtransform_parse_crop_spec(&transfoptions, crop)) { FreeImage_OutputMessageProc(FIF_JPEG, "Bogus crop argument %s", crop); throw(1); } } // Any space needed by a transform option must be requested before // jpeg_read_coefficients so that memory allocation will be done right // Prepare transformation workspace // Fails right away if perfect flag is TRUE and transformation is not perfect if( !jtransform_request_workspace(&srcinfo, &transfoptions) ) { FreeImage_OutputMessageProc(FIF_JPEG, "Transformation is not perfect"); throw(1); } if(left || top) { // compute left and top offsets, it's a bit tricky, taking into account both // transform, which might have trimed the image, // and crop itself, which is adjusted to lie on a iMCU boundary const int fullWidth = swappedDim ? srcinfo.image_height : srcinfo.image_width; const int fullHeight = swappedDim ? srcinfo.image_width : srcinfo.image_height; int transformedFullWidth = fullWidth; int transformedFullHeight = fullHeight; if(trimH && transformedFullWidth/transfoptions.iMCU_sample_width > 0) { transformedFullWidth = (transformedFullWidth/transfoptions.iMCU_sample_width) * transfoptions.iMCU_sample_width; } if(trimV && transformedFullHeight/transfoptions.iMCU_sample_height > 0) { transformedFullHeight = (transformedFullHeight/transfoptions.iMCU_sample_height) * transfoptions.iMCU_sample_height; }
开发者ID:Remotion,项目名称:freeimage,代码行数:66,
示例26: jp2_warning_callback/**OpenJPEG Warning callback */static void jp2_warning_callback(const char *msg, void *client_data) { FreeImage_OutputMessageProc(s_format_id, "Warning: %s", msg);}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:6,
示例27: jp2_error_callback/**OpenJPEG Error callback */static void jp2_error_callback(const char *msg, void *client_data) { FreeImage_OutputMessageProc(s_format_id, "Error: %s", msg);}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:6,
示例28: Savestatic BOOL DLL_CALLCONVSave(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) { if ((dib) && (handle)) { BOOL bSuccess; opj_cparameters_t parameters; // compression parameters opj_event_mgr_t event_mgr; // event manager opj_image_t *image = NULL; // image to encode opj_cinfo_t* cinfo = NULL; // codec context opj_cio_t *cio = NULL; // memory byte stream // configure the event callbacks memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); event_mgr.error_handler = jp2_error_callback; event_mgr.warning_handler = jp2_warning_callback; event_mgr.info_handler = NULL; // set encoding parameters to default values opj_set_default_encoder_parameters(¶meters); parameters.tcp_numlayers = 0; // if no rate entered, apply a 16:1 rate by default if(flags == JP2_DEFAULT) { parameters.tcp_rates[0] = (float)16; } else { // for now, the flags parameter is only used to specify the rate parameters.tcp_rates[0] = (float)flags; } parameters.tcp_numlayers++; parameters.cp_disto_alloc = 1; try { // convert the dib to a OpenJPEG image image = FIBITMAPToJ2KImage(s_format_id, dib, ¶meters); if(!image) return FALSE; // encode the destination image // get a J2K compressor handle cinfo = opj_create_compress(CODEC_JP2); // catch events using our callbacks opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, NULL); // setup the encoder parameters using the current image and using user parameters opj_setup_encoder(cinfo, ¶meters, image); // open a byte stream for writing, allocate memory for all tiles cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0); // encode the image bSuccess = opj_encode(cinfo, cio, image, NULL/*parameters.index*/); if (!bSuccess) { throw "Failed to encode image"; } int codestream_length = cio_tell(cio); // write the buffer to user's IO handle io->write_proc(cio->buffer, 1, codestream_length, handle); // close and free the byte stream opj_cio_close(cio); // free remaining compression structures opj_destroy_compress(cinfo); // free image data opj_image_destroy(image); return TRUE; } catch (const char *text) { if(cio) opj_cio_close(cio); if(cinfo) opj_destroy_compress(cinfo); if(image) opj_image_destroy(image); FreeImage_OutputMessageProc(s_format_id, text); return FALSE; } } return FALSE;}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:81,
注:本文中的FreeImage_OutputMessageProc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FreeImage_Save函数代码示例 C++ FreeImage_OpenMemory函数代码示例 |