/********************************************************************* * * GUI_Color2Index */ int GUI_Color2Index(GUI_COLOR Color) { int Index; GUI_LOCK(); Index = LCD_Color2Index(Color); GUI_UNLOCK(); return Index; }
/********************************************************************* * * GUI_CURSOR_Select */ const GUI_CURSOR GUI_UNI_PTR * GUI_CURSOR_Select(const GUI_CURSOR GUI_UNI_PTR * pCursor) { int AllocSize; const GUI_BITMAP GUI_UNI_PTR * pBM; const GUI_CURSOR GUI_UNI_PTR * pOldCursor; GUI_LOCK(); pOldCursor = _pCursor; if (pCursor != _pCursor) { int i; pBM = pCursor->pBitmap; i = pBM->pPal->NumEntries > 4 ? 4 : pBM->pPal->NumEntries; while (i--) { LCD_COLOR Color = *(pBM->pPal->pPalEntries + i); _ColorIndex[i] = LCD_Color2Index(Color); } _Hide(); AllocSize = pBM->XSize * pBM->YSize * sizeof(LCD_PIXELINDEX); if (AllocSize != _AllocSize) { GUI_ALLOC_Free(_hBuffer); _hBuffer = 0; } _hBuffer = GUI_ALLOC_AllocZero(AllocSize); _CursorOn = 1; _pCursor = pCursor; _CalcRect(); _Show(); } GUI_UNLOCK(); return pOldCursor; }
/********************************************************************* * * _Log2Phys */ static int _Log2Phys(int Index) { if (Index < 4) { return _ColorIndex[Index]; } else { LCD_COLOR Color = *(_pCursor->pBitmap->pPal->pPalEntries + Index); return LCD_Color2Index(Color); } }
GUI_COLOR GUI_Color2VisColor(GUI_COLOR color) { I16 Index; GUI_COLOR r; GUI_LOCK(); Index = LCD_Color2Index(color); r = LCD_Index2Color(Index); GUI_UNLOCK(); return r; }
/********************************************************************* * * _WriteAlphaToActiveAt */ static void _WriteAlphaToActiveAt(GUI_MEMDEV_Handle hMem, int Intens, int x, int y) { /* Make sure the memory handle is valid */ if (hMem) { GUI_MEMDEV * pDev = GUI_MEMDEV_H2P(hMem); GUI_USAGE_h hUsage = pDev->hUsage; GUI_USAGE* pUsage; int YSize = pDev->YSize; int yi; if (hUsage) { pUsage = GUI_USAGE_H2P(hUsage); for (yi = 0; yi < YSize; yi++) { int xOff = 0; int XSize; XSize = GUI_USAGE_GetNextDirty(pUsage, &xOff, yi); /* Draw the partial line which needs to be drawn */ for (; XSize; ) { U8* pData; pData = (U8*)GUI_MEMDEV__XY2PTREx(pDev, xOff, yi); do { LCD_COLOR Color, BkColor; int xPos, yPos, Index; if (pDev->BitsPerPixel == 8) { Index = *pData++; } else { Index = *(U16*)pData; pData += 2; } Color = LCD_Index2Color(Index); xPos = xOff + x; yPos = yi +y; BkColor = LCD_GetPixelColor(xPos, yPos); Color = LCD_MixColors256(Color, BkColor, Intens); Index = LCD_Color2Index(Color); LCD_SetPixelIndex(xPos, yPos, Index); xOff++; } while (--XSize); XSize = GUI_USAGE_GetNextDirty(pUsage, &xOff, yi); } } } } }