GDI hardware acceleration

Viewed 157

So I've heard that GDI supports hardware acceleration. I have this code here:

 var x = 1;
    if (solidBrush == IntPtr.Zero)
    {
        solidBrush = CreateSolidBrush(ColorTranslator.ToWin32(Color.FromArgb(120, 120, 120)));
        hDC = CreateGraphics().GetHdc();
    }

    index += x;

    int w = x;
    int h = Height;

    //create memory device context
    var memdc = CreateCompatibleDC(hDC);

    //create bitmap
    var hbitmap = CreateCompatibleBitmap(hDC, index, h);

    ////select bitmap in to memory device context
    var holdbmp = SelectObject(memdc, hbitmap);


    RECT rect = new RECT(new Rectangle(0, 0, w, h));
    FillRect(memdc, ref rect, solidBrush);
    
    AlphaBlend(hDC, index - x, 0, w, h, memdc, 0, 0, w, h, new BLENDFUNCTION(0, 0, 128, 0));
    SelectObject(memdc, holdbmp);
    DeleteObject(hbitmap);
    DeleteDC(memdc);

which uses GDI to draw an animation (a box), but I see no GPU usage. Is it that GDI just doesn't support HW acceleration? Thanks.

0 Answers
Related