本文整理汇总了C++中DisplayModel::GetZoomReal方法的典型用法代码示例。如果您正苦于以下问题:C++ DisplayModel::GetZoomReal方法的具体用法?C++ DisplayModel::GetZoomReal怎么用?C++ DisplayModel::GetZoomReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisplayModel
的用法示例。
在下文中一共展示了DisplayModel::GetZoomReal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopySelectionToClipboard
void CopySelectionToClipboard(WindowInfo* win) {
if (!win->currentTab || !win->currentTab->selectionOnPage)
return;
CrashIf(win->currentTab->selectionOnPage->size() == 0 && win->mouseAction != MouseAction::SelectingText);
if (win->currentTab->selectionOnPage->size() == 0)
return;
CrashIf(!win->AsFixed());
if (!win->AsFixed())
return;
if (!OpenClipboard(nullptr))
return;
EmptyClipboard();
DisplayModel* dm = win->AsFixed();
#ifndef DISABLE_DOCUMENT_RESTRICTIONS
if (!dm->GetEngine()->AllowsCopyingText())
win->ShowNotification(_TR("Copying text was denied (copying as image only)"));
else
#endif
if (!dm->GetEngine()->IsImageCollection()) {
AutoFreeW selText;
bool isTextSelection = dm->textSelection->result.len > 0;
if (isTextSelection) {
selText.Set(dm->textSelection->ExtractText(L"\r\n"));
} else {
WStrVec selections;
for (SelectionOnPage& sel : *win->currentTab->selectionOnPage) {
WCHAR* text = dm->GetTextInRegion(sel.pageNo, sel.rect);
if (text)
selections.Push(text);
}
selText.Set(selections.Join());
}
// don't copy empty text
if (!str::IsEmpty(selText.Get()))
CopyTextToClipboard(selText, true);
if (isTextSelection) {
// don't also copy the first line of a text selection as an image
CloseClipboard();
return;
}
}
/* also copy a screenshot of the current selection to the clipboard */
SelectionOnPage* selOnPage = &win->currentTab->selectionOnPage->at(0);
RenderedBitmap* bmp = dm->GetEngine()->RenderBitmap(selOnPage->pageNo, dm->GetZoomReal(), dm->GetRotation(),
&selOnPage->rect, RenderTarget::Export);
if (bmp)
CopyImageToClipboard(bmp->GetBitmap(), true);
delete bmp;
CloseClipboard();
}