Changeset 4034 for trunk/src/gdi32/palette.cpp
- Timestamp:
- Aug 18, 2000, 8:14:59 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/palette.cpp
r3594 r4034 1 /* $Id: palette.cpp,v 1. 5 2000-05-23 18:46:21sandervl Exp $ */1 /* $Id: palette.cpp,v 1.6 2000-08-18 18:14:58 sandervl Exp $ */ 2 2 3 3 /* … … 71 71 } 72 72 rc = O32_CreatePalette(arg1); 73 dprintf(("GDI32: CreatePalette returns 0x%08X\n",rc));73 dprintf(("GDI32: CreatePalette %x %d returns 0x%08X\n", arg1, arg1->palNumEntries, rc)); 74 74 75 75 return rc; … … 77 77 //****************************************************************************** 78 78 //****************************************************************************** 79 HPALETTE WIN32API SelectPalette(HDC arg1, HPALETTE arg2, BOOL arg3)79 HPALETTE WIN32API SelectPalette(HDC hdc, HPALETTE hPalette, BOOL bForceBackground) 80 80 { 81 dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X) \n", arg1, arg2, arg3));81 dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)", hdc, hPalette, bForceBackground)); 82 82 if(DIBSection::getSection() != NULL) 83 83 { 84 DIBSection *dsect = DIBSection::findHDC( arg1);84 DIBSection *dsect = DIBSection::findHDC(hdc); 85 85 if(dsect) 86 86 { 87 int nrcolors; 87 88 PALETTEENTRY Pal[256]; 88 89 char PalSize = dsect->GetBitCount(); … … 90 91 if(PalSize<=8) 91 92 { 92 GetPaletteEntries( arg2, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);93 dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);93 nrcolors = GetPaletteEntries( hPalette, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal); 94 dsect->SetDIBColorTable(0, nrcolors, (RGBQUAD*)&Pal); 94 95 } 95 96 96 97 } 97 98 } 98 return O32_SelectPalette( arg1, arg2, arg3);99 return O32_SelectPalette(hdc, hPalette, bForceBackground); 99 100 } 100 101 //****************************************************************************** … … 117 118 //****************************************************************************** 118 119 //****************************************************************************** 119 UINT WIN32API GetPaletteEntries( HPALETTE hPalette, UINT arg2, UINT arg3, PPALETTEENTRY arg4)120 UINT WIN32API GetPaletteEntries(HPALETTE hPalette, UINT iStart, UINT count, PPALETTEENTRY entries) 120 121 { 121 dprintf(("GDI32: GetPaletteEntries %x %d-%d %x", hPalette, arg2, arg3, arg4)); 122 return O32_GetPaletteEntries(hPalette, arg2, arg3, arg4); 122 UINT rc; 123 124 rc = O32_GetPaletteEntries(hPalette, iStart, count, entries); 125 dprintf(("GDI32: GetPaletteEntries %x %d-%d %x returned %d", hPalette, iStart, count, entries, rc)); 126 return rc; 123 127 } 124 128 //****************************************************************************** … … 151 155 HPALETTE WIN32API CreateHalftonePalette(HDC hdc) 152 156 { 153 dprintf(("GDI32: CreateHalftonePalette, not implemented\n")); 154 return(NULL); 157 int i, r, g, b; 158 struct { 159 WORD Version; 160 WORD NumberOfEntries; 161 PALETTEENTRY aEntries[256]; 162 } Palette = { 163 0x300, 256 164 }; 165 166 dprintf(("GDI32: CreateHalftonePalette %x", hdc)); 167 GetSystemPaletteEntries(hdc, 0, 256, Palette.aEntries); 168 return CreatePalette((LOGPALETTE *)&Palette); 169 170 for (r = 0; r < 6; r++) { 171 for (g = 0; g < 6; g++) { 172 for (b = 0; b < 6; b++) { 173 i = r + g*6 + b*36 + 10; 174 Palette.aEntries[i].peRed = r * 51; 175 Palette.aEntries[i].peGreen = g * 51; 176 Palette.aEntries[i].peBlue = b * 51; 177 } 178 } 179 } 180 181 for (i = 216; i < 246; i++) { 182 int v = (i - 216) * 8; 183 Palette.aEntries[i].peRed = v; 184 Palette.aEntries[i].peGreen = v; 185 Palette.aEntries[i].peBlue = v; 186 } 187 188 return CreatePalette((LOGPALETTE *)&Palette); 155 189 } 156 190 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.