/*--------------------------------------------------------------------------*/
void GraphicDisplay_init(GraphicDisplay * const me,
                    UINT width,  UINT xScale,
                    UINT height, UINT yScale,
                    HWND hItem,  BYTE const bgColor[3])
{
    HDC hDC;
    BITMAPINFO bi24BitInfo;

    me->width  = width;
    me->xScale = xScale;
    me->height = height;
    me->yScale = yScale;

    me->bgColor[0] = bgColor[0];
    me->bgColor[1] = bgColor[1];
    me->bgColor[2] = bgColor[2];

    me->hItem = hItem;

    bi24BitInfo.bmiHeader.biBitCount    = 3U*8U;             /* 3 RGB bytes */
    bi24BitInfo.bmiHeader.biCompression = BI_RGB;              /* RGB color */
    bi24BitInfo.bmiHeader.biPlanes      = 1U;
    bi24BitInfo.bmiHeader.biSize        = sizeof(bi24BitInfo.bmiHeader);
    bi24BitInfo.bmiHeader.biWidth       = me->width  * me->xScale;
    bi24BitInfo.bmiHeader.biHeight      = me->height * me->yScale;

    hDC = CreateCompatibleDC(NULL);
    me->hBitmap = CreateDIBSection(hDC, &bi24BitInfo, DIB_RGB_COLORS,
                                   (void **)&me->bits, 0, 0);
    DeleteDC(hDC);

    GraphicDisplay_clear(me);
    GraphicDisplay_redraw(me);
}
Exemple #2
0
/*..........................................................................*/
void BSP_displayOff(void) {
    SegmentDisplay_setSegment(&l_userLED, 0U, 0U);
    GraphicDisplay_clear(&l_oled);
    GraphicDisplay_redraw(&l_oled);
}