1 | /*
|
---|
2 | * OS/2 Palette functions
|
---|
3 | *
|
---|
4 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
5 | *
|
---|
6 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
7 | *
|
---|
8 | */
|
---|
9 | #define INCL_GREALL
|
---|
10 | #define INCL_WIN
|
---|
11 | #define INCL_GPI
|
---|
12 | #include <os2.h>
|
---|
13 | #include <pmddi.h>
|
---|
14 | #include <stdio.h>
|
---|
15 | #include <stdlib.h>
|
---|
16 | #include <string.h>
|
---|
17 | #include "misc.h"
|
---|
18 | #include "os2palset.h"
|
---|
19 |
|
---|
20 | //******************************************************************************
|
---|
21 | //******************************************************************************
|
---|
22 | void OS2SetPhysPalette(HWND hwndClient, void *pal)
|
---|
23 | {
|
---|
24 | PALETTEENTRY *pDirectXPal = (PALETTEENTRY *)pal;
|
---|
25 | HPS hps;
|
---|
26 | HDC hdc;
|
---|
27 | RGB2 os2rgb[256];
|
---|
28 | int i;
|
---|
29 | ULONG cclr;
|
---|
30 |
|
---|
31 | hps = WinGetPS(HWND_DESKTOP);
|
---|
32 | hdc = GpiQueryDevice(hps);
|
---|
33 | for(i=0;i<256;i++) {
|
---|
34 | os2rgb[i].bBlue = pDirectXPal[i].peBlue;
|
---|
35 | os2rgb[i].bGreen = pDirectXPal[i].peGreen;
|
---|
36 | os2rgb[i].bRed = pDirectXPal[i].peRed;
|
---|
37 | os2rgb[i].fcOptions = PC_RESERVED;
|
---|
38 | }
|
---|
39 |
|
---|
40 | GpiCreateLogColorTable(hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
|
---|
41 | LCOLF_CONSECRGB, 0, 256, (PLONG)&os2rgb);
|
---|
42 | Gre32Entry3(hdc, 0L, 0x000060C6L);
|
---|
43 | // WinInvalidateRect(HWND_DESKTOP, (PRECTL)NULL, TRUE);
|
---|
44 | WinRealizePalette(hwndClient, hps, &cclr);
|
---|
45 | WinReleasePS(hps);
|
---|
46 | }
|
---|
47 | //******************************************************************************
|
---|
48 | //******************************************************************************
|
---|
49 | void OS2ResetPhysPalette()
|
---|
50 | {
|
---|
51 | HPS hps;
|
---|
52 | HDC hdc;
|
---|
53 |
|
---|
54 | hps = WinGetPS(HWND_DESKTOP);
|
---|
55 | hdc = GpiQueryDevice(hps);
|
---|
56 | Gre32Entry3(hdc, 0L, 0x000060C7L);
|
---|
57 | WinInvalidateRect(HWND_DESKTOP, (PRECTL)NULL, TRUE);
|
---|
58 | WinReleasePS(hps);
|
---|
59 | }
|
---|
60 | //******************************************************************************
|
---|
61 | //******************************************************************************
|
---|