source: trunk/src/gdi32/palette.cpp@ 3594

Last change on this file since 3594 was 3594, checked in by sandervl, 25 years ago

minor changes

File size: 5.7 KB
Line 
1/* $Id: palette.cpp,v 1.5 2000-05-23 18:46:21 sandervl Exp $ */
2
3/*
4 * GDI32 palette apis
5 *
6 * Based on Wine code (991031) (objects\palette.c)
7 *
8 * Copyright 1993,1994 Alexandre Julliard
9 * Copyright 1996 Alex Korobka
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14#include <os2win.h>
15#include <stdlib.h>
16#include <misc.h>
17#include <string.h>
18#include "dibsect.h"
19
20#define DBG_LOCALLOG DBG_palette
21#include "dbglocal.h"
22
23static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */
24
25/***********************************************************************
26 * SetSystemPaletteUse32 [GDI32.335]
27 *
28 * RETURNS
29 * Success: Previous system palette
30 * Failure: SYSPAL_ERROR
31 */
32UINT WINAPI SetSystemPaletteUse(
33 HDC hdc, /* [in] Handle of device context */
34 UINT use) /* [in] Palette-usage flag */
35{
36 UINT old = SystemPaletteUse;
37 dprintf(("SetSystemPaletteUse: (%04x,%04x): stub\n", hdc, use ));
38 SystemPaletteUse = use;
39 return old;
40}
41/***********************************************************************
42 * GetSystemPaletteUse32 [GDI32.223] Gets state of system palette
43 *
44 * RETURNS
45 * Current state of system palette
46 */
47UINT WINAPI GetSystemPaletteUse(HDC hdc) /* [in] Handle of device context */
48{
49 dprintf(("GetSystemPaletteUse %x", hdc));
50 return SystemPaletteUse;
51}
52//******************************************************************************
53//******************************************************************************
54UINT WIN32API RealizePalette( HDC hdc)
55{
56 UINT rc;
57
58 rc = O32_RealizePalette(hdc);
59 dprintf(("GDI32: RealizePalette %x returned %d", hdc, rc));
60 return rc;
61}
62//******************************************************************************
63//******************************************************************************
64HPALETTE WIN32API CreatePalette( const LOGPALETTE * arg1)
65{
66 HPALETTE rc;
67
68 for(int i=0; i<arg1->palNumEntries;i++)
69 {
70 dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
71 }
72 rc = O32_CreatePalette(arg1);
73 dprintf(("GDI32: CreatePalette returns 0x%08X\n",rc));
74
75 return rc;
76}
77//******************************************************************************
78//******************************************************************************
79HPALETTE WIN32API SelectPalette(HDC arg1, HPALETTE arg2, BOOL arg3)
80{
81 dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)\n", arg1, arg2, arg3));
82 if(DIBSection::getSection() != NULL)
83 {
84 DIBSection *dsect = DIBSection::findHDC(arg1);
85 if(dsect)
86 {
87 PALETTEENTRY Pal[256];
88 char PalSize = dsect->GetBitCount();
89 dprintf((" - Set Palette Values in DIBSection\n"));
90 if(PalSize<=8)
91 {
92 GetPaletteEntries( arg2, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
93 dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
94 }
95
96 }
97 }
98 return O32_SelectPalette(arg1, arg2, arg3);
99}
100//******************************************************************************
101//******************************************************************************
102BOOL WIN32API AnimatePalette( HPALETTE arg1, UINT arg2, UINT arg3, const PALETTEENTRY * arg4)
103{
104 dprintf(("GDI32: AnimatePalette"));
105 return O32_AnimatePalette(arg1, arg2, arg3, arg4);
106}
107//******************************************************************************
108//******************************************************************************
109UINT WIN32API GetNearestPaletteIndex( HPALETTE arg1, COLORREF arg2)
110{
111 UINT rc;
112 dprintf(("GDI32: GetNearestPaletteIndex (0x%08X ,0x%08X) ",arg1,arg2));
113 rc = O32_GetNearestPaletteIndex(arg1, arg2);
114 dprintf(("Returns %d\n",rc));
115 return rc;
116}
117//******************************************************************************
118//******************************************************************************
119UINT WIN32API GetPaletteEntries( HPALETTE hPalette, UINT arg2, UINT arg3, PPALETTEENTRY arg4)
120{
121 dprintf(("GDI32: GetPaletteEntries %x %d-%d %x", hPalette, arg2, arg3, arg4));
122 return O32_GetPaletteEntries(hPalette, arg2, arg3, arg4);
123}
124//******************************************************************************
125//******************************************************************************
126UINT WIN32API GetSystemPaletteEntries( HDC arg1, UINT arg2, UINT arg3, PPALETTEENTRY arg4)
127{
128 UINT rc;
129
130 dprintf(("GDI32: GetSystemPaletteEntries start %d nr %d pal ptr %X", arg2, arg3, arg4));
131 rc = O32_GetSystemPaletteEntries(arg1, arg2, arg3, arg4);
132 dprintf((" GetSystemPaletteEntries returned %d", rc));
133 return(rc);
134}
135//******************************************************************************
136//******************************************************************************
137BOOL WIN32API ResizePalette( HPALETTE arg1, UINT arg2)
138{
139 dprintf(("GDI32: ResizePalette\n"));
140 return O32_ResizePalette(arg1, arg2);
141}
142//******************************************************************************
143//******************************************************************************
144UINT WIN32API SetPaletteEntries( HPALETTE hPalette, UINT arg2, UINT arg3, PALETTEENTRY * arg4)
145{
146 dprintf(("GDI32: SetPaletteEntries %x %d-%d %x", hPalette, arg2, arg3, arg4));
147 return O32_SetPaletteEntries(hPalette, arg2, arg3, (const PALETTEENTRY *)arg4);
148}
149//******************************************************************************
150//******************************************************************************
151HPALETTE WIN32API CreateHalftonePalette(HDC hdc)
152{
153 dprintf(("GDI32: CreateHalftonePalette, not implemented\n"));
154 return(NULL);
155}
156//******************************************************************************
157//******************************************************************************
Note: See TracBrowser for help on using the repository browser.