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


C++ Rect::contains方法代码示例

本文整理汇总了C++中geom::Rect::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::contains方法的具体用法?C++ Rect::contains怎么用?C++ Rect::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geom::Rect的用法示例。


在下文中一共展示了Rect::contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getLetterAt

Layout::iterator Layout::getLetterAt(double x, double y) const
{
    Geom::Point point(x, y);

    double rotation;
    for (iterator it = begin() ; it != end() ; it.nextCharacter()) {
        Geom::Rect box = characterBoundingBox(it, &rotation);
        // todo: rotation
        if (box.contains(point)) return it;
    }
    return end();
}
开发者ID:vinics,项目名称:inkscape,代码行数:12,代码来源:Layout-TNG-OutIter.cpp

示例2: _pickItem

/**
 * Get the item under the specified point.
 * Searches the tree for the first item in the Z-order which is closer than
 * @a delta to the given point. The pick should be visual - for example
 * an object with a thick stroke should pick on the entire area of the stroke.
 * @param p Search point
 * @param delta Maximum allowed distance from the point
 * @param sticky Whether the pick should ignore visibility and sensitivity.
 *               When false, only visible and sensitive objects are considered.
 *               When true, invisible and insensitive objects can also be picked.
 */
DrawingItem *
DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags)
{
    // Sometimes there's no BBOX in state, reason unknown (bug 992817)
    // I made this not an assert to remove the warning
    if (!(_state & STATE_BBOX) || !(_state & STATE_PICK)) {
        g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d",
                  _state & STATE_BBOX, _state & STATE_PICK);
        return NULL;
    }
    // ignore invisible and insensitive items unless sticky
    if (!(flags & PICK_STICKY) && !(_visible && _sensitive))
        return NULL;

    bool outline = _drawing.outline();

    if (!_drawing.outline()) {
        // pick inside clipping path; if NULL, it means the object is clipped away there
        if (_clip) {
            DrawingItem *cpick = _clip->pick(p, delta, flags | PICK_AS_CLIP);
            if (!cpick) return NULL;
        }
        // same for mask
        if (_mask) {
            DrawingItem *mpick = _mask->pick(p, delta, flags);
            if (!mpick) return NULL;
        }
    }

    Geom::OptIntRect box = (outline || (flags & PICK_AS_CLIP)) ? _bbox : _drawbox;
    if (!box) {
        return NULL;
    }

    Geom::Rect expanded = *box;
    expanded.expandBy(delta);

    if (expanded.contains(p)) {
        return _pickItem(p, delta, flags);
    }
    return NULL;
}
开发者ID:AakashDabas,项目名称:inkscape,代码行数:53,代码来源:drawing-item.cpp

示例3: is_within

static bool is_within(Geom::Rect const &area, Geom::Rect const &box)
{
    return area.contains(box);
}
开发者ID:step21,项目名称:inkscape-osx-packaging-native,代码行数:4,代码来源:document.cpp


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