本文整理汇总了C++中DocumentView::drawSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentView::drawSelection方法的具体用法?C++ DocumentView::drawSelection怎么用?C++ DocumentView::drawSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentView
的用法示例。
在下文中一共展示了DocumentView::drawSelection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MAX
VerticalToolHandler::VerticalToolHandler(Redrawable* view, PageRef page, double y, double zoom)
{
XOJ_INIT_TYPE(VerticalToolHandler);
this->startY = y;
this->endY = y;
this->view = view;
this->page = page;
this->layer = this->page->getSelectedLayer();
this->jumpY = 0;
for (Element* e : *this->layer->getElements())
{
if (e->getY() >= y)
{
this->elements.push_back(e);
}
}
for (Element* e : this->elements)
{
this->layer->removeElement(e, false);
this->jumpY = MAX(this->jumpY, e->getY() + e->getElementHeight());
}
this->jumpY = this->page->getHeight() - this->jumpY;
this->crBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
this->page->getWidth() * zoom, (this->page->getHeight() - y) * zoom);
cairo_t* cr = cairo_create(this->crBuffer);
cairo_scale(cr, zoom, zoom);
cairo_translate(cr, 0, -y);
DocumentView v;
v.drawSelection(cr, this);
cairo_destroy(cr);
view->rerenderPage();
}
示例2: MAX
VerticalToolHandler::VerticalToolHandler(Redrawable * view, PageRef page, double y, double zoom) {
XOJ_INIT_TYPE(VerticalToolHandler);
this->startY = y;
this->endY = y;
this->view = view;
this->page = page;
this->layer = this->page.getSelectedLayer();
this->elements = NULL;
this->jumpY = 0;
ListIterator<Element *> it = this->layer->elementIterator();
while (it.hasNext()) {
Element * e = it.next();
if (e->getY() >= y) {
this->elements = g_list_append(this->elements, e);
}
}
for (GList * l = this->elements; l != NULL; l = l->next) {
Element * e = (Element *) l->data;
this->layer->removeElement(e, false);
this->jumpY = MAX(this->jumpY, e->getY() + e->getElementHeight());
}
this->jumpY = this->page.getHeight() - this->jumpY;
this->crBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, this->page.getWidth() * zoom, (this->page.getHeight() - y) * zoom);
cairo_t * cr = cairo_create(this->crBuffer);
cairo_scale(cr, zoom, zoom);
cairo_translate(cr, 0, -y);
DocumentView v;
v.drawSelection(cr, this);
cairo_destroy(cr);
view->rerenderPage();
}