9daf47dff97b456c256aed96e4e71dd50a78c20b
[wine/hacks.git] / dlls / winedib.drv / palette.c
blob9daf47dff97b456c256aed96e4e71dd50a78c20b
1 /*
2 * DIBDRV palette objects
4 * Copyright 2009 Massimo Del Fedele
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include "dibdrv.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv);
28 /***********************************************************************
29 * DIBDRV_RealizePalette
31 UINT DIBDRV_RealizePalette( DIBDRVPHYSDEV *physDev, HPALETTE hpal, BOOL primary )
33 UINT res;
35 TRACE("physDev:%p, hpal:%p, primary:%s\n", physDev, hpal, (primary ? "TRUE" : "FALSE"));
37 /* we should in any case call X11 function, as UnrealizePalette() doesn't
38 * take a physDev parameter */
39 res = _DIBDRV_GetDisplayDriver()->pRealizePalette(physDev->X11PhysDev, hpal, primary);
41 if(physDev->hasDIB)
43 /* DIB section selected in, additional (if needed) engine code */
44 ONCE(FIXME("STUB\n"));
47 return res;
50 /***********************************************************************
51 * DIBDRV_UnrealizePalette
53 BOOL DIBDRV_UnrealizePalette( HPALETTE hpal )
55 BOOL res;
57 TRACE("hpal:%p\n", hpal);
59 /* we should in any case call X11 function, as UnrealizePalette() doesn't
60 * take a physDev parameter */
61 res = _DIBDRV_GetDisplayDriver()->pUnrealizePalette(hpal);
63 /* additional Engine code here, if needed */
64 ONCE(FIXME("STUB\n"));
66 return res;
69 /***********************************************************************
70 * DIBDRV_GetSystemPaletteEntries
72 UINT DIBDRV_GetSystemPaletteEntries( DIBDRVPHYSDEV *physDev, UINT start, UINT count,
73 LPPALETTEENTRY entries )
75 UINT res;
77 TRACE("physDev:%p, start:%d, count:%d, entries:%p\n", physDev, start, count, entries);
79 if(physDev->hasDIB)
81 /* DIB section selected in, use DIB Engine */
82 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
83 res = _DIBDRV_GetDisplayDriver()->pGetSystemPaletteEntries(physDev->X11PhysDev, start, count, entries);
85 else
87 /* DDB selected in, use X11 driver */
88 res = _DIBDRV_GetDisplayDriver()->pGetSystemPaletteEntries(physDev->X11PhysDev, start, count, entries);
90 return res;
93 /***********************************************************************
94 * DIBDRV_GetNearestColor
96 COLORREF DIBDRV_GetNearestColor( DIBDRVPHYSDEV *physDev, COLORREF color )
98 COLORREF res;
100 TRACE("physDev:%p, color:%x\n", physDev, color);
102 if(physDev->hasDIB)
104 /* DIB section selected in, use DIB Engine */
105 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
106 res = _DIBDRV_GetDisplayDriver()->pGetNearestColor(physDev->X11PhysDev, color);
108 else
110 /* DDB selected in, use X11 driver */
111 res = _DIBDRV_GetDisplayDriver()->pGetNearestColor(physDev->X11PhysDev, color);
113 return res;
116 /***********************************************************************
117 * DIBDRV_RealizeDefaultPalette
119 UINT DIBDRV_RealizeDefaultPalette( DIBDRVPHYSDEV *physDev )
121 UINT res;
123 TRACE("physDev:%p\n", physDev);
125 if(physDev->hasDIB)
127 /* DIB section selected in, use DIB Engine */
128 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
129 res = _DIBDRV_GetDisplayDriver()->pRealizeDefaultPalette(physDev->X11PhysDev);
131 else
133 /* DDB selected in, use X11 driver */
134 res = _DIBDRV_GetDisplayDriver()->pRealizeDefaultPalette(physDev->X11PhysDev);
136 return res;
139 BOOL DIBDRV_GetICMProfile(DIBDRVPHYSDEV *physDev, LPDWORD lpcbName, LPWSTR lpszFilename)
141 BOOL res;
143 TRACE("physDev:%p, lpcpName:%p, lpszFilename:%p\n", physDev, lpcbName, lpszFilename);
145 if(physDev->hasDIB)
147 /* DIB section selected in, use DIB Engine */
148 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
149 res = _DIBDRV_GetDisplayDriver()->pGetICMProfile(physDev->X11PhysDev, lpcbName, lpszFilename);
151 else
153 /* DDB selected in, use X11 driver */
154 res = _DIBDRV_GetDisplayDriver()->pGetICMProfile(physDev->X11PhysDev, lpcbName, lpszFilename);
156 return res;