Exemple #1
0
void Widget::setTexCoordRegion(point_type x, point_type y, point_type w, point_type h) {
    osg::Image* image = _image();

    if(!image) return;

    point_type tw = image->s();
    point_type th = image->t();

    TexCoordArray* texs = _texs();

    // Set the LOWER_LEFT point.
    XYCoord t(x / tw, y / tw);

    (*texs)[LL] = t;

    // Set the LOWER_RIGHT point.
    t += XYCoord(w / tw, 0.0f);

    (*texs)[LR] = t;

    // Set the UPPER_RIGHT point.
    t += XYCoord(0.0f, h / th);

    (*texs)[UR] = t;

    // Set the UPPER_LEFT point.
    t += XYCoord(-(w / tw), 0.0f);

    (*texs)[UL] = t;
}
XYCoord Window::localXY(double absx, double absy) const {
    XYCoord xy = getAbsoluteOrigin();
    double  x  = absx - xy.x();
    double  y  = absy - xy.y();

    return XYCoord(x + _visibleArea[0], y + _visibleArea[1]);
}
Exemple #3
0
// Returns the WindowManager coordinates of the application window XY position.
XYCoord WindowManager::localXY(double x, double y) const {
    return XYCoord((_width / _windowWidth) * x, (_height / _windowHeight) * y);
}
Exemple #4
0
XYCoord Widget::localXY(double _x, double _y) const {
    if(!_parent) return XYCoord(_x, _y);

    return _parent->localXY(_x, _y) - getOrigin();
}