Beispiel #1
0
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()));
}
Beispiel #2
0
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;
}