예제 #1
0
파일: WGLWidget.C 프로젝트: kdeforche/wt
void WGLWidget::resize(const WLength &width, const WLength &height)
{
  WInteractWidget::resize(width, height);
  if (pImpl_)
    layoutSizeChanged(static_cast<int>(width.value()),
		      static_cast<int>(height.value()));
}
예제 #2
0
파일: WPainter.C 프로젝트: nkabir/wt
WLength WPainter::normalizedPenWidth(const WLength& penWidth,
                                     bool correctCosmetic) const
{
    double w = penWidth.value();

    if (w == 0 && correctCosmetic) {
        // cosmetic width -- must be untransformed 1 pixel
        const WTransform& t = combinedTransform();
        if (!t.isIdentity()) {
            WTransform::TRSRDecomposition d;
            t.decomposeTranslateRotateScaleRotate(d);

            w = 2.0/(std::fabs(d.sx) + std::fabs(d.sy));
        } else
            w = 1.0;

        return WLength(w, WLength::Pixel);
    } else if (w != 0 && !correctCosmetic) {
        // non-cosmetic width -- must be transformed
        const WTransform& t = combinedTransform();
        if (!t.isIdentity()) {
            WTransform::TRSRDecomposition d;
            t.decomposeTranslateRotateScaleRotate(d);

            w *= (std::fabs(d.sx) + std::fabs(d.sy))/2.0;
        }

        return WLength(w, WLength::Pixel);
    } else
        return penWidth;
}