2007년 4월 8일 일요일

GDI+ paint with brush(alpha blending)

void CGdiplusDemoView::OnDraw(CDC* pDC)
{
    Graphics g(pDC->m_hDC);

    SolidBrush brush(Color(128, 255, 0, 0));
    g.FillRectangle(&brush, 50, 100, 200, 100);

    brush.SetColor(Color(128, 0, 255, 0));
    g.FillEllipse(&brush, 150, 150, 200, 100);

    brush.SetColor(Color(128, 255, 255, 0));
    g.FillPie(&brush, 50, 130, 200, 200, 135, 90);

    brush.SetColor(Color(128, 0, 0, 255));
    Point points[] = {
        Point(80, 50), Point(170, 70), Point(220, 30),
        Point(200, 110), Point(150, 90), Point(100, 150)
    };
    /*
    enum FillMode
    {
        FillModeAlternate,        // 0
        FillModeWinding           // 1
    };
    */
    g.FillClosedCurve(&brush, points, 6, FillModeAlternate, 1);
}


댓글 없음: