本文整理汇总了C++中exiv2::image::AutoPtr::io方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::io方法的具体用法?C++ AutoPtr::io怎么用?C++ AutoPtr::io使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::image::AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::io方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyMetadata
void ExifTransfer::copyMetadata() {
try {
dst = Exiv2::ImageFactory::open(BasicIo::AutoPtr(new MemIo(data, dataSize)));
dst->readMetadata();
} catch (Exiv2::Error & e) {
std::cerr << "Exiv2 error: " << e.what() << std::endl;
return;
}
try {
src = Exiv2::ImageFactory::open(srcFile.toLocal8Bit().constData());
src->readMetadata();
copyXMP();
copyIPTC();
copyEXIF();
} catch (Exiv2::Error & e) {
std::cerr << "Exiv2 error: " << e.what() << std::endl;
// At least we have to set the SubImage1 file type to Primary Image
dst->exifData()["Exif.SubImage1.NewSubfileType"] = 0;
}
try {
dst->writeMetadata();
FileIo fileIo(dstFile.toLocal8Bit().constData());
fileIo.open("wb");
fileIo.write(dst->io());
fileIo.close();
} catch (Exiv2::Error & e) {
std::cerr << "Exiv2 error: " << e.what() << std::endl;
}
}
示例2: saveExifData
// Saves Exifdata to given file
void FlickrUpload::saveExifData(Exiv2::ExifData *exifData, QByteArray *image){
try {
Exiv2::Image::AutoPtr destImage = Exiv2::ImageFactory::open(
(Exiv2::byte*)image->constData(), (long)image->size());
destImage->setExifData(*exifData);
destImage->writeMetadata();
// get updated image data
Exiv2::BasicIo& rawio = destImage->io();
Exiv2::DataBuf dbuf = rawio.read( rawio.size() );
image->clear();
image->append(QByteArray::fromRawData((char*)dbuf.pData_, dbuf.size_));
} catch (Exiv2::Error& e) {
qCritical("[SaveFile] %s", e.what());
}
}
示例3: save
bool JpegContent::save(QIODevice* device)
{
if (!d->mImage.isNull()) {
if (!d->updateRawDataFromImage()) {
return false;
}
}
if (d->mRawData.size() == 0) {
d->mErrorString = i18nc("@info", "No data to store.");
return false;
}
if (d->mPendingTransformation) {
applyPendingTransformation();
d->mPendingTransformation = false;
}
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((unsigned char*)d->mRawData.data(), d->mRawData.size());
// Store Exif info
image->setExifData(d->mExifData);
image->setComment(d->mComment.toUtf8().data());
image->writeMetadata();
// Update mRawData
Exiv2::BasicIo& io = image->io();
d->mRawData.resize(io.size());
io.read((unsigned char*)d->mRawData.data(), io.size());
QDataStream stream(device);
stream.writeRawData(d->mRawData.data(), d->mRawData.size());
// Make sure we are up to date
loadFromData(d->mRawData);
return true;
}