LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g) { unsigned pos; LLDCOLOR_TYPE color; #if GDISP_NEED_CONTROL switch(g->g.Orientation) { case GDISP_ROTATE_0: default: pos = PIXIL_POS(g, g->p.x, g->p.y); break; case GDISP_ROTATE_90: pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-1); break; case GDISP_ROTATE_180: pos = PIXIL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1); break; case GDISP_ROTATE_270: pos = PIXIL_POS(g, g->g.Height-g->p.y-1, g->p.x); break; } #else pos = PIXIL_POS(g, g->p.x, g->p.y); #endif #if LTDC_USE_DMA2D while(DMA2D->CR & DMA2D_CR_START); #endif color = PIXEL_ADDR(g, pos)[0]; return gdispNative2Color(color); }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { winPriv * priv; COLORREF color; priv = g->priv; WaitForSingleObject(drawMutex, INFINITE); #if GDISP_NEED_CONTROL switch(g->g.Orientation) { case GDISP_ROTATE_0: default: color = GetPixel(priv->dcBuffer, g->p.x, g->p.y); break; case GDISP_ROTATE_90: color = GetPixel(priv->dcBuffer, g->p.y, g->g.Width - 1 - g->p.x); break; case GDISP_ROTATE_180: color = GetPixel(priv->dcBuffer, g->g.Width - 1 - g->p.x, g->g.Height - 1 - g->p.y); break; case GDISP_ROTATE_270: color = GetPixel(priv->dcBuffer, g->g.Height - 1 - g->p.y, g->p.x); break; } #else color = GetPixel(priv->dcBuffer, g->p.x, g->p.y); #endif ReleaseMutex(drawMutex); return gdispNative2Color(color); }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { netPriv * priv; uint16_t buf[3]; color_t data; #if GDISP_DONT_WAIT_FOR_NET_DISPLAY if (!(g->flags & GDISP_FLG_CONNECTED)) return 0; #else while(!(g->flags & GDISP_FLG_CONNECTED)) gfxSleepMilliseconds(200); #endif priv = g->priv; buf[0] = GNETCODE_READ; buf[1] = g->p.x; buf[2] = g->p.y; MUTEX_ENTER; sendpkt(priv->netfd, buf, 3); MUTEX_EXIT; // Now wait for a reply while(!(g->flags & GDISP_FLG_HAVEDATA) || priv->data[0] != GNETCODE_READ) gfxSleepMilliseconds(1); data = gdispNative2Color(priv->data[1]); g->flags &= ~GDISP_FLG_HAVEDATA; return data; }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { winPriv * priv; COLORREF color; priv = g->priv; if (!(g->flags & GDISP_FLG_WSTREAM)) BAD_PARAMETER("read_color: not in streaming mode"); if (priv->x < priv->x0 || priv->x > priv->x1 || priv->y < priv->y0 || priv->y > priv->y1) BAD_PARAMETER("read_color: cursor outside streaming area"); if (g->flags & GDISP_FLG_WRAPPED) { BAD_PARAMETER("read_color: Warning - Area wrapped."); g->flags &= ~GDISP_FLG_WRAPPED; } WaitForSingleObject(drawMutex, INFINITE); #if GDISP_NEED_CONTROL switch(g->g.Orientation) { case GDISP_ROTATE_0: default: color = GetPixel(priv->dcBuffer, priv->x, priv->y); break; case GDISP_ROTATE_90: color = GetPixel(priv->dcBuffer, priv->y, g->g.Width - 1 - priv->x); break; case GDISP_ROTATE_180: color = GetPixel(priv->dcBuffer, g->g.Width - 1 - priv->x, g->g.Height - 1 - priv->y); break; case GDISP_ROTATE_270: color = GetPixel(priv->dcBuffer, g->g.Height - 1 - priv->y, priv->x); break; } #else color = GetPixel(priv->dcBuffer, priv->x, priv->y); #endif ReleaseMutex(drawMutex); // Update the cursor if (++priv->x > priv->x1) { priv->x = priv->x0; if (++priv->y > priv->y1) { g->flags |= GDISP_FLG_WRAPPED; priv->y = priv->y0; } } return gdispNative2Color(color); }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { uint16_t data; data = read_data(g); return gdispNative2Color(data); }