Example #1
0
QPixmap DetailsWidget::createBackground(const QSize &size, int topHeight, QWidget *widget)
{
    QPixmap pixmap(size);
    pixmap.fill(Qt::transparent);
    QPainter p(&pixmap);

    QRect topRect(0, 0, size.width(), topHeight);
    QRect fullRect(0, 0, size.width(), size.height());
    if (HostOsInfo::isMacHost())
        p.fillRect(fullRect, qApp->palette().window().color());
    else
        p.fillRect(fullRect, creatorTheme()->color(Theme::DetailsWidgetBackgroundColor));

    if (creatorTheme()->widgetStyle () == Theme::StyleDefault) {
        QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft());
        lg.setStops(creatorTheme()->gradient(Theme::DetailsWidgetHeaderGradient));
        p.fillRect(topRect, lg);
        p.setRenderHint(QPainter::Antialiasing, true);
        p.translate(0.5, 0.5);
        p.setPen(QColor(0, 0, 0, 40));
        p.setBrush(Qt::NoBrush);
        p.drawRoundedRect(fullRect.adjusted(0, 0, -1, -1), 2, 2);
        p.setBrush(Qt::NoBrush);
        p.setPen(QColor(255,255,255,140));
        p.drawRoundedRect(fullRect.adjusted(1, 1, -2, -2), 2, 2);
        p.setPen(QPen(widget->palette().color(QPalette::Mid)));
    }

    return pixmap;
}
// Tests that translations are properly handled when using KeepTransform.
TEST(TransparencyWin, TranslateOpaqueCompositeLayer)
{
    // Fill with white.
    OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1));
    Color white(0xFFFFFFFF);
    FloatRect fullRect(0, 0, 16, 16);
    src->context()->fillRect(fullRect, white);

    // Scroll down by 8 (coordinate system goes up).
    src->context()->save();
    src->context()->translate(0, -8);

    Color red(0xFFFF0000);
    Color green(0xFF00FF00);
    {
        // Make the transparency layer after translation will be @ (0, -8) with
        // size 16x16.
        TransparencyWin helper;
        helper.init(src->context(),
                    TransparencyWin::OpaqueCompositeLayer,
                    TransparencyWin::KeepTransform,
                    IntRect(0, 0, 16, 16));

        // Draw a red pixel at (15, 15). This should be the at (15, 7) after
        // the transform.
        FloatRect bottomRight(15, 15, 1, 1);
        helper.context()->fillRect(bottomRight, green);
        helper.composite();
    }

    src->context()->restore();

    // Check the pixel we wrote.
    EXPECT_EQ(green, getPixelAt(src->context(), 15, 7));
}
Example #3
0
    QPixmap DetailsWidget::cacheBackground(const QSize &size, bool expanded)
    {
        QPixmap pixmap(size);
        pixmap.fill(Qt::transparent);
        QPainter p(&pixmap);

        QRect topRect(0, 0, size.width(), d->m_useCheckBox ? d->m_summaryCheckBox->height() : d->m_summaryLabel->height());
        QRect fullRect(0, 0, size.width(), size.height());
        p.fillRect(fullRect, QColor(255, 255, 255, 40));

        QColor highlight = palette().highlight().color();
        highlight.setAlpha(0.5);
        if (expanded) {
            p.fillRect(topRect, highlight);
        }

        QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft());
        lg.setColorAt(0, QColor(255, 255, 255, 130));
        lg.setColorAt(1, QColor(255, 255, 255, 0));
        p.fillRect(topRect, lg);
        p.setRenderHint(QPainter::Antialiasing, true);
        p.translate(0.5, 0.5);
        p.setPen(QColor(0, 0, 0, 40));
        p.setBrush(Qt::NoBrush);
        p.drawRoundedRect(fullRect.adjusted(0, 0, -1, -1), 2, 2);
        p.setBrush(Qt::NoBrush);
        p.setPen(QColor(255,255,255,140));
        p.drawRoundedRect(fullRect.adjusted(1, 1, -2, -2), 2, 2);
        p.setPen(QPen(palette().color(QPalette::Mid)));

        return pixmap;
    }
void IntelligentSeparatedMultifunctionalButtonWidget::paintEvent(QPaintEvent *e)
{

    QRect fullRect(0, 0, this->width() - 1, this->height() - 1);
    QPainter painter(this);
//    painter.setRenderHint(QPainter::SmoothPixmapTransform);

    // finally, draw it
    BorderImageRenderer::renderPixmapAsBorderImageToPainter(this->backgroundPixmap, painter, fullRect, 10, 10, 15, 10);
}
TEST(TransparencyWin, OpaqueCompositeLayerPixel)
{
    Color red(0xFFFF0000), darkRed(0xFFBF0000);
    Color green(0xFF00FF00);

    // Make a red bottom layer, followed by a half green next layer @ 50%.
    OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1));

    FloatRect fullRect(0, 0, 16, 16);
    src->context()->fillRect(fullRect, red);
    src->context()->beginTransparencyLayer(0.5);
    FloatRect rightHalf(8, 0, 8, 16);
    src->context()->fillRect(rightHalf, green);

    // Make a transparency layer inset by one pixel, and fill it inset by
    // another pixel with 50% black.
    {
        TransparencyWin helper;
        helper.init(src->context(),
                    TransparencyWin::OpaqueCompositeLayer,
                    TransparencyWin::KeepTransform,
                    IntRect(1, 1, 14, 14));

        FloatRect inner(2, 2, 12, 12);
        helper.context()->fillRect(inner, Color(0x7f000000));
        // These coordinates are relative to the layer, whish is inset by 1x1
        // pixels from the top left. So we're actually clearing (2, 2) and
        // (13,13), which are the extreme corners of the black area (and which
        // we check below).
        clearTopLayerAlphaPixel(helper.context(), 1, 1);
        clearTopLayerAlphaPixel(helper.context(), 12, 12);
        helper.composite();
    }

    // Finish the compositing.
    src->context()->endLayer();

    // Check that we got the right values, it should be like the rectangle was
    // drawn with half opacity even though the alpha channel got messed up.
    EXPECT_EQ(red, getPixelAt(src->context(), 0, 0));
    EXPECT_EQ(red, getPixelAt(src->context(), 1, 1));
    EXPECT_EQ(darkRed, getPixelAt(src->context(), 2, 2));

    // The dark result is:
    //   (black @ 50% atop green) @ 50% atop red = 0xFF804000
    // which is 0xFFA02000 (Skia computes 0xFFA11F00 due to rounding).
    Color darkGreenRed(0xFF803f00);
    EXPECT_EQ(darkGreenRed, getPixelAt(src->context(), 13, 13));

    // 50% green on top of red = FF808000 (rounded to what Skia will produce).
    Color greenRed(0xFF807F00);
    EXPECT_EQ(greenRed, getPixelAt(src->context(), 14, 14));
    EXPECT_EQ(greenRed, getPixelAt(src->context(), 15, 15));
}
void IconImageWidget::paintEvent(QPaintEvent *e)
{
    // TODO: test
//    QWidget::paintEvent(e); // draws the background etc.


    QRect fullRect(0, 0, this->width() - 1, this->height() - 1);

    //this->refreshThePicture();

    //QPainter painter(this);
    QStylePainter painter(this); // TODO: test
    painter.setRenderHint(QPainter::SmoothPixmapTransform);

    // finally, draw it

    if(!this->_pixmapToPresent.isNull())
    {
        if(_isRotationValueChanged)
        {
            //qDebug(QString("rot p: %1").arg(rotationValue).toAscii());
            QTransform transf;
            painter.setTransform(transf.rotate(40.0f * _rotationValue, Qt::YAxis));
            painter.setTransform(transf.rotate(-20.0f * _rotationValue, Qt::XAxis));
            //painter.setTransform(transf.rotate(45, Qt::YAxis));
            //painter.setTransform(transf.rotate(30, Qt::ZAxis));

            _isRotationValueChanged = false;
        }

        //QTransform transf;
        //painter.setTransform(transf.rotate(45.0f, Qt::YAxis));

        if(_relatedAppState == AppWhirr::ApplicationGrabStates::GrabbedButNotInstalled) {
            painter.setOpacity(0.5f);
        }

        painter.drawPixmap(fullRect, this->_pixmapToPresent);
    } else {
        painter.fillRect(fullRect, QBrush(QColor(100, 100, 100)));
    }


    painter.end();
}
static void testClippedLayerKeepTransform(TransparencyWin::LayerMode layerMode)
{
    // Fill with white.
    OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1));
    Color white(0xFFFFFFFF);
    FloatRect fullRect(0, 0, 16, 16);
    src->context()->fillRect(fullRect, white);

    IntRect clipRect(IntPoint(11, 5), IntSize(1, 1));
    src->context()->clip(clipRect);

    // Scroll down by 6 (coordinate system goes up).
    src->context()->save();
    src->context()->translate(0, -6);

    Color red(0xFFFF0000);
    Color green(0xFF00FF00);
    {
        // The transparency layer after translation will be @ (0, -6) with
        // a size that would be too large to handle unclipped.
        TransparencyWin helper;
        helper.init(src->context(),
                    layerMode,
                    TransparencyWin::KeepTransform,
                    IntRect(0, 0, INT_MAX, INT_MAX));

        // Draw a green pixel at (11, 11). This should be within the clip rect
        // and at (11, 5) after the transform.
        FloatRect greenRect(11, 11, 1, 1);
        helper.context()->fillRect(greenRect, green);

        // Draw a red pixel at (9, 9). This should be outside the clip rect
        // and not drawn.
        FloatRect redRect(9, 9, 1, 1);
        helper.context()->fillRect(redRect, red);
        helper.composite();
    }

    src->context()->restore();

    // Verify green pixel got drawn in clip rect and red pixel got clipped.
    EXPECT_EQ(green, getPixelAt(src->context(), 11, 5));
    EXPECT_EQ(white, getPixelAt(src->context(), 9, 3));
}
// Same as OpaqueCompositeLayer, but the canvas has a rotation applied. This
// tests that the propert transform is applied to the copied layer.
TEST(TransparencyWin, RotateOpaqueCompositeLayer)
{
    OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1));

    // The background is white.
    Color white(0xFFFFFFFF);
    FloatRect fullRect(0, 0, 16, 16);
    src->context()->fillRect(fullRect, white);

    // Rotate the image by 90 degrees. This matrix is the same as
    // cw90.rotate(90); but avoids rounding errors. Rounding errors can cause
    // Skia to think that !rectStaysRect() and it will fall through to path
    // drawing mode, which in turn gives us antialiasing. We want no
    // antialiasing or other rounding problems since we're testing exact pixel
    // values.
    src->context()->save();
    AffineTransform cw90(0, 1, -1, 0, 0, 0);
    src->context()->concatCTM(cw90);

    // Make a transparency layer consisting of a horizontal line of 50% black.
    // Since the rotation is applied, this will actually be a vertical line
    // down the middle of the image.
    src->context()->beginTransparencyLayer(0.5);
    FloatRect blackRect(0, -9, 16, 2);
    Color black(0xFF000000);
    src->context()->fillRect(blackRect, black);

    // Now draw 50% red square.
    {
        // Create a transparency helper inset one pixel in the buffer. The
        // coordinates are before transforming into this space, and maps to
        // IntRect(1, 1, 14, 14).
        TransparencyWin helper;
        helper.init(src->context(),
                    TransparencyWin::OpaqueCompositeLayer,
                    TransparencyWin::Untransform,
                    IntRect(1, -15, 14, 14));

        // Fill with red.
        helper.context()->fillRect(helper.drawRect(), Color(0x7f7f0000));
        clearTopLayerAlphaChannel(helper.context());
        helper.composite();
    }

    // Finish the compositing.
    src->context()->endLayer();

    // Top corner should be the original background.
    EXPECT_EQ(white, getPixelAt(src->context(), 0, 0));

    // Check the stripe down the middle, first at the top...
    Color gray(0xFF808080);
    EXPECT_EQ(white, getPixelAt(src->context(), 6, 0));
    EXPECT_EQ(gray, getPixelAt(src->context(), 7, 0));
    EXPECT_EQ(gray, getPixelAt(src->context(), 8, 0));
    EXPECT_EQ(white, getPixelAt(src->context(), 9, 0));

    // ...now at the bottom.
    EXPECT_EQ(white, getPixelAt(src->context(), 6, 15));
    EXPECT_EQ(gray, getPixelAt(src->context(), 7, 15));
    EXPECT_EQ(gray, getPixelAt(src->context(), 8, 15));
    EXPECT_EQ(white, getPixelAt(src->context(), 9, 15));

    // Our red square should be 25% red over the top of those two.
    Color redwhite(0xFFdfbfbf);
    Color redgray(0xFF9f8080);
    EXPECT_EQ(white, getPixelAt(src->context(), 0, 1));
    EXPECT_EQ(redwhite, getPixelAt(src->context(), 1, 1));
    EXPECT_EQ(redwhite, getPixelAt(src->context(), 6, 1));
    EXPECT_EQ(redgray, getPixelAt(src->context(), 7, 1));
    EXPECT_EQ(redgray, getPixelAt(src->context(), 8, 1));
    EXPECT_EQ(redwhite, getPixelAt(src->context(), 9, 1));
    EXPECT_EQ(redwhite, getPixelAt(src->context(), 14, 1));
    EXPECT_EQ(white, getPixelAt(src->context(), 15, 1));

    // Complete the 50% transparent layer.
    src->context()->restore();
}
Example #9
0
void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
{
    // Determine wxDC to use based on need to double-buffer or
    // use system-generated transparent background portions
    wxDC* dcPtr;
    if ( HasTransparentBackground() )
        dcPtr = new wxPaintDC(this);
    else
        dcPtr = new wxAutoBufferedPaintDC(this);
    wxDC& dc = *dcPtr;

    wxSize sz = GetClientSize();
    const wxRect& butRect = m_btnArea;
    wxRect tcRect = m_tcArea;
    wxRect fullRect(0, 0, sz.x, sz.y);

    // artificial simple border
    if ( m_widthCustomBorder )
    {
        int customBorder = m_widthCustomBorder;

        // Set border colour
#ifdef __WXMAC__
        wxPen pen1( wxColour(133,133,133),
                    customBorder,
                    wxSOLID );
#else        
        wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT),
                    customBorder,
                    wxPENSTYLE_SOLID);
#endif
        dc.SetPen( pen1 );

        // area around both controls
        wxRect rect2(fullRect);
        if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE )
        {
            rect2 = tcRect;
            if ( customBorder == 1 )
            {
                rect2.Inflate(1);
            }
            else
            {
            #ifdef __WXGTK__
                rect2.x -= 1;
                rect2.y -= 1;
            #else
                rect2.x -= customBorder;
                rect2.y -= customBorder;
            #endif
                rect2.width += 1 + customBorder;
                rect2.height += 1 + customBorder;
            }
        }

        dc.SetBrush( *wxTRANSPARENT_BRUSH );
        dc.DrawRectangle(rect2);
    }

    // Clear the main background if the system doesn't do it by itself
    if ( !HasTransparentBackground() &&
         (tcRect.x > 0 || tcRect.y > 0) )
    {
        wxColour winCol = GetParent()->GetBackgroundColour();
        dc.SetBrush(winCol);
        dc.SetPen(winCol);

        dc.DrawRectangle(fullRect);
    }

    if ( !m_btn )
    {
        // Standard button rendering
        DrawButton(dc, butRect);
    }

    // paint required portion on the control
    if ( !m_text || m_widthCustomPaint )
    {
        wxASSERT( m_widthCustomPaint >= 0 );

        // Clear the text-control area background
        wxColour tcCol = GetBackgroundColour();
        dc.SetBrush(tcCol);
        dc.SetPen(tcCol);
        dc.DrawRectangle(tcRect);

        // this is intentionally here to allow drawed rectangle's
        // right edge to be hidden
        if ( m_text )
            tcRect.width = m_widthCustomPaint;

        dc.SetFont( GetFont() );

        dc.SetClippingRegion(tcRect);
        if ( m_popupInterface )
            m_popupInterface->PaintComboControl(dc, tcRect);
        else
            wxComboPopup::DefaultPaintComboControl(this, dc, tcRect);
    }

    delete dcPtr;
}
void CAlfPerfAppAvkonTestCaseBasic::NextAnimFrameL()
    {
    // Begin drawing
    RWindow& window = static_cast< RWindow& >( *iAvkonControl->DrawableWindow() );
    CWindowGc& gc = iAvkonControl->SystemGc();
    TRect updateRect(iAvkonControl->Rect());
    window.Invalidate( updateRect );
    window.BeginRedraw( updateRect );
    gc.Activate(window);

    // Draw background
    TRgb color (KRgbWhite);
    gc.SetBrushColor(color);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.SetPenStyle(CGraphicsContext::ESolidPen);
    gc.SetPenSize(TSize(10,10));
    gc.SetPenColor(color);    
    gc.DrawRect(updateRect);  
       
    // Calc timeline
    TTime now;
    now.UniversalTime();
    TUint millisecondFromCycleStart = now.MicroSecondsFrom(iCycleStartTime).Int64() / 1000;
    double timelinePercentage = (double)millisecondFromCycleStart / KCycleDurationMs; 
    timelinePercentage *= 0.5; // scale it a bit...
   
    // Calc rect
    TRect fullRect(updateRect);
    TSize size(fullRect.Width()*(1.0 - timelinePercentage), fullRect.Height()*(1.0 - timelinePercentage));
    TPoint windowCenter = fullRect.Center();
    TPoint tl(windowCenter.iX - size.iWidth/2, windowCenter.iY - size.iHeight/2);
    TRect rect(tl, size);
        
    // Draw
    gc.SetPenColor(KRgbBlue);
    gc.SetBrushColor(KRgbRed);
    const TPoint Point1(rect.iTl);
    const TPoint Point2(rect.iBr.iX, rect.iTl.iY);
    const TPoint Point3(rect.iBr);
    const TPoint Point4(rect.iTl.iX, rect.iBr.iY);
    const TPoint center(rect.Center());

    switch (iCycleCounter)
        {
        case 1: // DrawEllipse
            {
            gc.DrawEllipse(rect);   
            break;
            }
        case 2: // DrawRect
            {
            gc.DrawRect(rect);    
            break;
            }
        case 3: // DrawRoundRect
            {
            TSize corner(rect.Width()/5, rect.Height()/5);
            gc.DrawRoundRect(rect, corner);   
            break;
            }
        case 4: // Draw lines
            {
            gc.SetPenColor(TRgb(255,0,0));
            gc.DrawLine(Point1, Point2);       
            
            gc.SetPenColor(TRgb(200,50,0));
            gc.DrawLineTo(Point3);
            
            gc.SetPenColor(TRgb(150,100,0));
            gc.DrawLineTo(Point4);
            
            gc.SetPenColor(TRgb(100,150,0));
            gc.DrawLineBy(TPoint(0, -rect.Height()));
            
            gc.SetPenColor(TRgb(50,200,0));
            gc.MoveTo(Point2);
            gc.DrawLineTo(Point4);
                       
            gc.SetPenColor(TRgb(0,255,0));
            gc.MoveBy(TPoint(0, -rect.Height()));
            gc.DrawLineTo(Point3);
            
            gc.SetPenColor(TRgb(255,0,0));
            gc.Plot(center);
            
            break;
           }
            
        case 5: // Draw 
            {
            gc.SetPenColor(TRgb(255,0,0));
            gc.DrawArc(rect, Point2, Point1);
            gc.DrawPie(rect, Point4, Point3);
            break;
            }
            
        case 6: // Draw polygons
            {
            const TInt KNumPoints = 9;
            TPoint pointList[KNumPoints];
            pointList[0] = TPoint(Point1.iX+rect.Width()*0.25, Point1.iY);
            pointList[1] = TPoint(Point1.iX+rect.Width()*0.75, Point1.iY);
            pointList[2] = TPoint(Point2.iX, Point2.iY+rect.Height()*0.25);
            pointList[3] = TPoint(Point2.iX, Point2.iY+rect.Height()*0.75);
            pointList[4] = TPoint(Point3.iX-rect.Width()*0.25, Point3.iY);
            pointList[5] = TPoint(Point3.iX-rect.Width()*0.75, Point3.iY);
            pointList[6] = TPoint(Point4.iX, Point4.iY-rect.Height()*0.25);
            pointList[7] = TPoint(Point4.iX, Point4.iY-rect.Height()*0.75);
            pointList[8] = TPoint(Point1.iX+rect.Width()*0.25, Point1.iY);
            
            CArrayFix<TPoint>* mypoints = new CArrayFixFlat<TPoint>(KNumPoints);
            CleanupStack::PushL(mypoints);
            for(TInt i=0; i<KNumPoints; i++)
                {
                mypoints->AppendL(pointList[i]);
                }

            gc.SetPenColor(TRgb(255,0,0));
            gc.SetPenSize(TSize(20,20));
            gc.DrawPolyLine(mypoints);
            
            gc.SetPenColor(TRgb(0,255,0));
            gc.SetPenSize(TSize(15,15));
            gc.DrawPolyLine(pointList, KNumPoints);
            
            gc.SetPenColor(TRgb(255,255,0));
            gc.SetPenSize(TSize(10,10));
            gc.DrawPolygon(mypoints);
            
            gc.SetPenColor(TRgb(0,0,255));
            gc.SetPenSize(TSize(5,5));
            gc.DrawPolygon(pointList, KNumPoints);
            
            CleanupStack::PopAndDestroy(); // mypoints           
            break;
            }
            
        case 7: // Draw texts
            {
            gc.UseFont(iFont);
            gc.SetDrawMode(CGraphicsContext::EDrawModePEN);
            gc.SetPenStyle(CGraphicsContext::ESolidPen);
            gc.SetBrushStyle(CGraphicsContext::ESolidBrush);    
            
            TInt h = rect.Height() / 3;
            TInt y = rect.iTl.iY;
            TRect tinyBox(rect);
            tinyBox.SetHeight(h);
            TInt fontDescent=iFont->DescentInPixels();
            gc.SetBrushColor(TRgb(0, 0, 255)); // blue
            
            gc.SetPenColor(TRgb(0,255,0)); // green
            gc.DrawText(_L("Ilves"), tinyBox.iTl+TPoint(0, fontDescent));
            
            tinyBox.Move(0,h);
            TInt posY = tinyBox.Height()-fontDescent;
            gc.SetPenColor(TRgb(255,0,0)); 
            gc.DrawText(_L("Tappara"), tinyBox, posY);
            
            gc.SetPenColor(TRgb(0,255,0)); // green
            gc.DrawTextVertical(_L("Ilves"), tinyBox.iTl+TPoint(fontDescent, 0 ), ETrue);
            
            tinyBox.Move(0,h);
            posY = tinyBox.Height()-fontDescent;
            gc.SetPenColor(TRgb(255,0,0)); 
            gc.DrawTextVertical(_L("Tappara"), tinyBox, posY, ETrue);
            
            break;
            }

        case 8: // Draw bitmaps
            {
            TPoint pos(rect.iTl);
            gc.BitBlt(pos, iPictureBm);
            
            pos = TPoint(rect.iTl.iX + rect.Width()/3, rect.iTl.iY);
            gc.BitBlt(pos, iPictureBm, TRect(iPictureBm->SizeInPixels()));

            pos = TPoint(rect.iTl.iX + rect.Width()*2/3, rect.iTl.iY);
            gc.BitBltMasked(pos, iPictureBm, TRect(iPictureBm->SizeInPixels()), iMaskBm, EFalse);

            pos = TPoint(rect.iTl.iX, rect.iTl.iY+ rect.Height()/3);
            TRect dstRect(pos, TSize(rect.Width()/3, rect.Height()/3));
            gc.DrawBitmap(dstRect, iPictureBm, TRect(iPictureBm->SizeInPixels()));

            pos = TPoint(rect.iTl.iX + rect.Width()/3, rect.iTl.iY+ rect.Height()/3);
            dstRect =  TRect(pos, dstRect.Size());
            gc.DrawBitmap(dstRect, iPictureBm);

            pos = TPoint(rect.iTl.iX, rect.iTl.iY+ rect.Height()*2/3);
            gc.DrawBitmap(pos, iPictureBm);

            pos = TPoint(rect.iTl.iX + rect.Width()/3, rect.iTl.iY+ rect.Height()*2/3);
            dstRect =  TRect(pos, dstRect.Size());
            gc.DrawBitmapMasked(dstRect, iPictureBm, TRect(iPictureBm->SizeInPixels()), iMaskBm, EFalse);

            break;
            }
            
         case 9: // Miscellanious
            {
            TRect rect1(rect);
            rect1.SetWidth(rect.Width()/2);
            rect1.SetHeight(rect.Height()/2);
            TRect rect2(rect1);
            rect2.Move(rect1.Width(),0);
            TRect rect3(rect1);
            rect3.Move(0, rect1.Height());
            TRect rect4(rect1);
            rect4.Move(rect1.Width(), rect1.Height());
            
            // Clear
            gc.Clear();
            // Brush pattern
            gc.UseBrushPattern(iPictureBm);
            gc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
            gc.DrawRect(rect1);
            gc.DiscardBrushPattern();
            // Fading & copy rect
            gc.SetFaded(ETrue);
            gc.CopyRect(rect2.iTl, rect1);
            gc.SetFadingParameters(255,0);
            gc.CopyRect(rect3.iTl, rect1);
            // Map colors  
            gc.SetPenColor(KRgbBlue);
            gc.SetBrushColor(KRgbRed);
            gc.DrawRect(rect4);   
            TRgb colors[2] = {KRgbRed, KRgbGreen}; // change brush color
            gc.MapColors(rect4,colors,1,ETrue);
             
            break;
            }
            
     default:
           gc.DrawRect(rect);          
       }

    // End drawing
    gc.Deactivate();
    window.EndRedraw();
 
    iTestCaseFrameCount++;
    }
Example #11
0
 TEST(TiledViewPlane_Iterator, ShouldReturnTrueWhenTwoBeginIteratorsAreCompared) {
   TiledViewPlane plane;
   Recti fullRect(8, 6);
   plane.setup(Matrix4d(), fullRect);
   ASSERT_TRUE(plane.begin(fullRect) == plane.begin(fullRect));
 }
Example #12
0
QRectF QPageLayoutPrivate::paintRect() const
{
    return m_mode == QPageLayout::FullPageMode ? fullRect() : fullRect() - m_margins;
}
Example #13
0
QRectF QPageLayoutPrivate::fullRect(QPageLayout::Unit units) const
{
    return units == m_units ? fullRect() : QRectF(QPointF(0, 0), fullSizeUnits(units));
}