LOCAL void PalPicker_DrawPatch( HDC hDC, LPRECT lpRect, BYTE value, FRMTYPEINFO TypeInfo, LPTR lpBuf ) /***********************************************************************/ { BLTSESSION BltSession; int dx, dy; dx = RectWidth(lpRect); dy = RectHeight(lpRect); set(lpBuf, dx, value); StartSuperBlt( &BltSession, hDC, NULL, Ctl_GetBltScreen(), lpRect, TypeInfo, 10, 0, 0, YES, NULL, NULL ); while (--dy >= 0) SuperBlt(&BltSession, lpBuf); SuperBlt(&BltSession, NULL); }
LOCAL void Palette_Paint( HDC hDC, HWND hWindow ) /***********************************************************************/ { RECT ClientRect; LPPALETTE lpPalette; int iRowIncr, iColIncr, iWidth, iHeight, iRows, iCols; int iStart, iEntry, r, c, xCount, yCount; LPRGB lpRGB, lpLine; LFIXED xrate, yrate; BLTSESSION BltSession; FRMTYPEINFO TypeInfo; // get pointer to palette information lpPalette = (LPPALETTE)GetWindowLong(hWindow, GWL_PALETTE); if (!lpPalette) return; GetClientRect(hWindow, &ClientRect); FrameRect(hDC, &ClientRect, (HBRUSH)GetStockObject(BLACK_BRUSH) ); if (!lpPalette->iColors) return; // get ClientRect and allocate buffer for SuperBlt GetChipLayout(hWindow, &ClientRect, &iRows, &iCols, &iRowIncr, &iColIncr, &iStart); iWidth = RectWidth(&ClientRect); iHeight = RectHeight(&ClientRect); lpRGB = (LPRGB)Alloc((long)iWidth*3L); if (!lpRGB) return; yrate = FGET(iHeight, iRows); xrate = FGET(iWidth, iCols); FrameSetTypeInfo(&TypeInfo, FDT_RGBCOLOR, NULL); StartSuperBlt( &BltSession, hDC, NULL, lpBltScreen, &ClientRect, TypeInfo, 10, 0, 0, YES, NULL, NULL ); for (r = 0; r < iRows; ++r) { yCount = FMUL(r+1, yrate) - FMUL(r, yrate); set24(lpRGB, iWidth, RGB(255,255,255)); SuperBlt(&BltSession, (LPTR)lpRGB); yCount -= 2; while (--yCount >= 0) { iEntry = iStart + (r * iRowIncr); lpLine = lpRGB; set24(lpLine, iWidth, RGB(255,255,255)); for (c = 0; c < iCols; ++c) { xCount = FMUL(c+1, xrate) - FMUL(c, xrate); if (iEntry < lpPalette->iColors) set24(lpLine+1, xCount-2, RGB2long(lpPalette->lpColorInfo[iEntry].rgb)); lpLine += xCount; iEntry += iColIncr; } SuperBlt(&BltSession, (LPTR)lpRGB); } set24(lpRGB, iWidth, RGB(255,255,255)); SuperBlt(&BltSession, (LPTR)lpRGB); } SuperBlt(&BltSession, NULL); FreeUp((LPTR)lpRGB); }