本文整理匯總了C++中tr1::shared_ptr::AddImage方法的典型用法代碼示例。如果您正苦於以下問題:C++ shared_ptr::AddImage方法的具體用法?C++ shared_ptr::AddImage怎麽用?C++ shared_ptr::AddImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::AddImage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: deinterlaced_image
// This method is required for all derived classes of EffectBase, and returns a
// modified openshot::Frame object
tr1::shared_ptr<Frame> Deinterlace::GetFrame(tr1::shared_ptr<Frame> frame, int frame_number)
{
// Get original size of frame's image
int original_width = frame->GetImage()->width();
int original_height = frame->GetImage()->height();
// Get the frame's image
tr1::shared_ptr<QImage> image = frame->GetImage();
const unsigned char* pixels = image->bits();
// Create a smaller, new image
QImage deinterlaced_image(image->width(), image->height() / 2, QImage::Format_RGBA8888);
const unsigned char* deinterlaced_pixels = deinterlaced_image.bits();
// Loop through the scanlines of the image (even or odd)
int start = 0;
if (isOdd)
start = 1;
for (int row = start; row < image->height(); row += 2) {
memcpy((unsigned char*)deinterlaced_pixels, pixels + (row * image->bytesPerLine()), image->bytesPerLine());
deinterlaced_pixels += image->bytesPerLine();
}
// Resize deinterlaced image back to original size, and update frame's image
image = tr1::shared_ptr<QImage>(new QImage(deinterlaced_image.scaled(original_width, original_height, Qt::IgnoreAspectRatio, Qt::FastTransformation)));
// Update image on frame
frame->AddImage(image);
// return the modified frame
return frame;
}