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