本文整理汇总了C++中LPDIRECTDRAWPALETTE::GetEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWPALETTE::GetEntries方法的具体用法?C++ LPDIRECTDRAWPALETTE::GetEntries怎么用?C++ LPDIRECTDRAWPALETTE::GetEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWPALETTE
的用法示例。
在下文中一共展示了LPDIRECTDRAWPALETTE::GetEntries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SimpleFindClosestIndex
DWORD
CDirect2DRMDevice::GetColor(BYTE r, BYTE g, BYTE b)
{
HRESULT hr;
if (m_pddsBackBuffer == NULL)
return E_NOTINITIALIZED;
// REVIEW: this function is heavy weight when the device is palettized
DWORD nBPP = m_ddsd.ddpfPixelFormat.dwRGBBitCount;
if (nBPP <= 8) {
// palettized
PALETTEENTRY rgpe[nMAXPALETTEENTRIES];
LPDIRECTDRAWPALETTE pddp = NULL;
if (FAILED(hr = m_pddsBackBuffer->GetPalette(&pddp)) ||
FAILED(hr = pddp->GetEntries(0, 0, nMAXPALETTEENTRIES, rgpe))) {
MMRELEASE(pddp);
return hr;
}
MMRELEASE(pddp);
return SimpleFindClosestIndex(rgpe, 1 << nBPP, r, g, b);
} else {
// RGB
return m_pixi.Pack(r, g, b);
}
return 0;
}
示例2: PisteDraw_Paletti_Pyorita
int PisteDraw_Paletti_Pyorita(UCHAR eka_vari, UCHAR vika_vari)
{
UCHAR i;
if (FAILED(PD_lpddpal->GetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette get entries failed!\n");
return PD_VIRHE;
}
PALETTEENTRY temp_vari;
temp_vari.peRed = PD_paletti_nyt[vika_vari].peRed;
temp_vari.peGreen = PD_paletti_nyt[vika_vari].peGreen;
temp_vari.peBlue = PD_paletti_nyt[vika_vari].peBlue;
for (i=vika_vari;i>eka_vari;i--)
{
PD_paletti_nyt[i].peRed = PD_paletti_nyt[i-1].peRed;
PD_paletti_nyt[i].peGreen = PD_paletti_nyt[i-1].peGreen;
PD_paletti_nyt[i].peBlue = PD_paletti_nyt[i-1].peBlue;
}
PD_paletti_nyt[eka_vari].peRed = temp_vari.peRed;
PD_paletti_nyt[eka_vari].peGreen = temp_vari.peGreen;
PD_paletti_nyt[eka_vari].peBlue = temp_vari.peBlue;
if (FAILED(PD_lpddpal->SetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette set entries failed!\n");
return PD_VIRHE;
}
return 0;
}
示例3: PisteDraw_Paletti_Get
int PisteDraw_Paletti_Get(PALETTEENTRY *&paletti)
{
if (FAILED(PD_lpddpal->GetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette get failed!\n");
return PD_VIRHE;
}
paletti = (PALETTEENTRY *)PD_paletti_nyt;
return 0;
}
示例4: PisteDraw_Fade_Paletti_Do
int PisteDraw_Fade_Paletti_Do(int pros)
{
UCHAR i;
if (FAILED(PD_lpddpal->GetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette get entries failed!\n");
return PD_VIRHE;
}
for (i=0;i<255;i++)
{
PD_paletti_nyt[i].peRed = (PD_paletti[i].peRed * pros / 100);
PD_paletti_nyt[i].peGreen = (PD_paletti[i].peGreen * pros / 100);
PD_paletti_nyt[i].peBlue = (PD_paletti[i].peBlue * pros / 100);
}
if (FAILED(PD_lpddpal->SetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette set entries failed!\n");
return PD_VIRHE;
}
return 0;
}
示例5: SetupPalette
bool SetupPalette(LPDIRECTDRAWPALETTE lpDDPalette)
{
if (!lpDDPalette)
{
//logOutput << CurrentTimeString() << "Detaching palette" << endl;
g_CurrentPalette.Free();
g_bUsePalette = false;
return false;
}
logOutput << CurrentTimeString() << "initializing palette" << endl;
DWORD caps;
HRESULT hr;
if (FAILED(hr = lpDDPalette->GetCaps(&caps)))
{
logOutput << CurrentTimeString() << "Failed to get palette caps" << endl;
printDDrawError(hr, "SetupPalette");
return false;
}
if (caps & DDPCAPS_8BITENTRIES)
{
logOutput << CurrentTimeString() << "8-bit index-palette used (lookup color is an index to another lookup table), not implemented" << endl;
return false;
}
DWORD numEntries = 0;
if (caps & DDPCAPS_8BIT)
numEntries = 0x100;
else if (caps & DDPCAPS_4BIT)
numEntries = 0x10;
else if (caps & DDPCAPS_2BIT)
numEntries = 0x04;
else if (caps & DDPCAPS_1BIT)
numEntries = 0x02;
else
{
logOutput << CurrentTimeString() << "Unrecognized palette format" << endl;
return false;
}
//logOutput << CurrentTimeString() << "Trying to retrieve " << numEntries << " palette entries" << endl;
g_CurrentPalette.Reallocate(numEntries);
hr = lpDDPalette->GetEntries(0, 0, numEntries, g_CurrentPalette.entries);
if (FAILED(hr))
{
logOutput << CurrentTimeString() << "Failed to retrieve palette entries" << endl;
printDDrawError(hr, "SetupPalette");
g_CurrentPalette.Free();
return false;
}
g_CurrentPalette.primary_surface_palette_ref = lpDDPalette;
g_CurrentPalette.bInitialized = true;
g_bUsePalette = true;
logOutput << CurrentTimeString() << "Initialized palette with " << numEntries << " color entries" << endl;
return true;
}