本文整理汇总了C++中LibRaw::open_datastream方法的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw::open_datastream方法的具体用法?C++ LibRaw::open_datastream怎么用?C++ LibRaw::open_datastream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibRaw
的用法示例。
在下文中一共展示了LibRaw::open_datastream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: datastream
static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
LibRaw RawProcessor;
BOOL bSuccess = TRUE;
// wrap the input datastream
LibRaw_freeimage_datastream datastream(io, handle);
// open the datastream
if(RawProcessor.open_datastream(&datastream) != LIBRAW_SUCCESS) {
bSuccess = FALSE; // LibRaw : failed to open input stream (unknown format)
}
// clean-up internal memory allocations
RawProcessor.recycle();
return bSuccess;
}
示例2: load
bool RawIOHandlerPrivate::load(QIODevice *device)
{
if (device == 0) return false;
if (raw != 0) return true;
stream = new Datastream(device);
raw = new LibRaw;
if (raw->open_datastream(stream) != LIBRAW_SUCCESS) {
delete raw;
raw = 0;
delete stream;
stream = 0;
return false;
}
defaultSize = QSize(raw->imgdata.sizes.width,
raw->imgdata.sizes.height);
if (raw->imgdata.sizes.flip == 5 || raw->imgdata.sizes.flip == 6) {
defaultSize.transpose();
}
return true;
}
示例3: datastream
static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FIBITMAP *dib = NULL;
LibRaw RawProcessor;
BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
try {
// wrap the input datastream
LibRaw_freeimage_datastream datastream(io, handle);
// set decoding parameters
// the following parameters affect data reading
// --------------------------------------------
// (-w) Use camera white balance, if possible (otherwise, fallback to auto_wb)
RawProcessor.imgdata.params.use_camera_wb = 1;
// RAW data filtration mode during data unpacking and postprocessing
RawProcessor.imgdata.params.filtering_mode = LIBRAW_FILTERING_AUTOMATIC;
// (-h) outputs the image in 50% size
RawProcessor.imgdata.params.half_size = ((flags & RAW_HALFSIZE) == RAW_HALFSIZE) ? 1 : 0;
// open the datastream
if(RawProcessor.open_datastream(&datastream) != LIBRAW_SUCCESS) {
throw "LibRaw : failed to open input stream (unknown format)";
}
if(header_only) {
// header only mode
dib = FreeImage_AllocateHeaderT(header_only, FIT_RGB16, RawProcessor.imgdata.sizes.width, RawProcessor.imgdata.sizes.height);
// try to get JPEG embedded Exif metadata
if(dib) {
FIBITMAP *metadata_dib = libraw_LoadEmbeddedPreview(RawProcessor, FIF_LOAD_NOPIXELS);
if(metadata_dib) {
FreeImage_CloneMetadata(dib, metadata_dib);
FreeImage_Unload(metadata_dib);
}
}
}
else if((flags & RAW_PREVIEW) == RAW_PREVIEW) {
// try to get the embedded JPEG
dib = libraw_LoadEmbeddedPreview(RawProcessor, 0);
if(!dib) {
// no JPEG preview: try to load as 8-bit/sample (i.e. RGB 24-bit)
dib = libraw_LoadRawData(RawProcessor, 8);
}
}
else if((flags & RAW_DISPLAY) == RAW_DISPLAY) {
// load raw data as 8-bit/sample (i.e. RGB 24-bit)
dib = libraw_LoadRawData(RawProcessor, 8);
}
else {
// default: load raw data as linear 16-bit/sample (i.e. RGB 48-bit)
dib = libraw_LoadRawData(RawProcessor, 16);
}
// save ICC profile if present
if(NULL != RawProcessor.imgdata.color.profile) {
FreeImage_CreateICCProfile(dib, RawProcessor.imgdata.color.profile, RawProcessor.imgdata.color.profile_length);
}
// try to get JPEG embedded Exif metadata
if(dib && !((flags & RAW_PREVIEW) == RAW_PREVIEW) ) {
FIBITMAP *metadata_dib = libraw_LoadEmbeddedPreview(RawProcessor, FIF_LOAD_NOPIXELS);
if(metadata_dib) {
FreeImage_CloneMetadata(dib, metadata_dib);
FreeImage_Unload(metadata_dib);
}
}
// clean-up internal memory allocations
RawProcessor.recycle();
return dib;
} catch(const char *text) {
if(dib) {
FreeImage_Unload(dib);
}
RawProcessor.recycle();
FreeImage_OutputMessageProc(s_format_id, text);
}
return NULL;
}