当前位置: 首页>>代码示例>>C++>>正文


C++ DocumentView::drawSelection方法代码示例

本文整理汇总了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();
}
开发者ID:xournalpp,项目名称:xournalpp,代码行数:41,代码来源:VerticalToolHandler.cpp

示例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();
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:39,代码来源:VerticalToolHandler.cpp


注:本文中的DocumentView::drawSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。