VC++部件库中浮动菜单部件的解析及应用(3)
else if (PaletteColors[i].peRed + 1 PaletteColors0[i].peRed) { PaletteColors[i].peRed++; bRedZero = FALSE; } else bRedZero = TRUE; if (PaletteColors[i].peGreen + nDeta PaletteColors0[i].peGreen) { Pale
else if (PaletteColors[i].peRed + 1 <
PaletteColors0[i].peRed)
{
PaletteColors[i].peRed++;
bRedZero = FALSE;
}
else
bRedZero = TRUE;
if (PaletteColors[i].peGreen + nDeta <
PaletteColors0[i].peGreen)
{
PaletteColors[i].peGreen += nDeta;
bGreenZero = FALSE;
}
else if (PaletteColors[i].peGreen + 1 <
PaletteColors0[i].peGreen)
{
PaletteColors[i].peGreen++;
bGreenZero = FALSE;
}
else
bGreenZero = TRUE;
if (PaletteColors[i].peBlue + nDeta <
PaletteColors0[i].peBlue)
{
PaletteColors[i].peBlue += nDeta;
bBlueZero = FALSE;
}
else if (PaletteColors[i].peBlue +1 <
PaletteColors0[i].peBlue)
{
PaletteColors[i].peBlue++;
bBlueZero = FALSE;
}
else
bBlueZero = TRUE;
}
//直到恢复原始值结束
bDone = bRedZero && bGreenZero && bBlueZero;
//使系统改变调色板
pPal- >AnimatePalette(0, nTotalColors, PaletteColors);
}
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
::ReleaseCapture();
pWnd- >KillTimer(0x100);
//恢复原始调色板
pPal- >SetPaletteEntries(0, nTotalColors, PaletteColors0);
pPal- >AnimatePalette(0, nTotalColors, PaletteColors0);
}
PaletteColors0[i].peRed)
{
PaletteColors[i].peRed++;
bRedZero = FALSE;
}
else
bRedZero = TRUE;
if (PaletteColors[i].peGreen + nDeta <
PaletteColors0[i].peGreen)
{
PaletteColors[i].peGreen += nDeta;
bGreenZero = FALSE;
}
else if (PaletteColors[i].peGreen + 1 <
PaletteColors0[i].peGreen)
{
PaletteColors[i].peGreen++;
bGreenZero = FALSE;
}
else
bGreenZero = TRUE;
if (PaletteColors[i].peBlue + nDeta <
PaletteColors0[i].peBlue)
{
PaletteColors[i].peBlue += nDeta;
bBlueZero = FALSE;
}
else if (PaletteColors[i].peBlue +1 <
PaletteColors0[i].peBlue)
{
PaletteColors[i].peBlue++;
bBlueZero = FALSE;
}
else
bBlueZero = TRUE;
}
//直到恢复原始值结束
bDone = bRedZero && bGreenZero && bBlueZero;
//使系统改变调色板
pPal- >AnimatePalette(0, nTotalColors, PaletteColors);
}
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
::ReleaseCapture();
pWnd- >KillTimer(0x100);
//恢复原始调色板
pPal- >SetPaletteEntries(0, nTotalColors, PaletteColors0);
pPal- >AnimatePalette(0, nTotalColors, PaletteColors0);
}
四、 渐 隐
----渐隐就是将显示颜色由图象各象素的颜色逐渐变化为黑色(RGB(0,0,0))的过程,即定时调用CPalette::AnimatePalette,每次将各逻辑表项的peRed、peGreen、peBlue值减小一个变化量,直到它们都为0。
精彩图集