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
22 #include "wine/port.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv
);
28 /***********************************************************************
29 * DIBDRV_RealizePalette
31 UINT
DIBDRV_RealizePalette( DIBDRVPHYSDEV
*physDev
, HPALETTE hpal
, BOOL primary
)
35 MAYBE(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
);
43 /* DIB section selected in, additional (if needed) engine code */
44 ONCE(FIXME("STUB\n"));
50 /***********************************************************************
51 * DIBDRV_UnrealizePalette
53 BOOL
DIBDRV_UnrealizePalette( HPALETTE hpal
)
57 MAYBE(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"));
69 /***********************************************************************
70 * DIBDRV_GetSystemPaletteEntries
72 UINT
DIBDRV_GetSystemPaletteEntries( DIBDRVPHYSDEV
*physDev
, UINT start
, UINT count
,
73 LPPALETTEENTRY entries
)
77 MAYBE(TRACE("physDev:%p, start:%d, count:%d, entries:%p\n", physDev
, start
, count
, entries
));
81 /* DIB section selected in, use DIB Engine */
82 ONCE(FIXME("STUB\n"));
87 /* DDB selected in, use X11 driver */
88 res
= _DIBDRV_GetDisplayDriver()->pGetSystemPaletteEntries(physDev
->X11PhysDev
, start
, count
, entries
);
93 /***********************************************************************
94 * DIBDRV_GetNearestColor
96 COLORREF
DIBDRV_GetNearestColor( DIBDRVPHYSDEV
*physDev
, COLORREF color
)
100 MAYBE(TRACE("physDev:%p, color:%x\n", physDev
, color
));
104 /* DIB section selected in, use DIB Engine */
105 ONCE(FIXME("STUB\n"));
110 /* DDB selected in, use X11 driver */
111 res
= _DIBDRV_GetDisplayDriver()->pGetNearestColor(physDev
->X11PhysDev
, color
);
116 /***********************************************************************
117 * DIBDRV_RealizeDefaultPalette
119 UINT
DIBDRV_RealizeDefaultPalette( DIBDRVPHYSDEV
*physDev
)
122 #ifdef DIBDRV_ENABLE_MAYBE
127 MAYBE(TRACE("physDev:%p\n", physDev
));
131 /* DIB section selected in, use DIB Engine */
132 ONCE(FIXME("STUB\n"));
133 /* HACK - we can't get the dib color table during SelectBitmap since it hasn't
134 been initialized yet. This is called from DC_InitDC so it's a convenient place
135 to grab the color table. */
136 MAYBE(TRACE("Color table size = %d, Color table = %p\n", physDev
->physBitmap
.colorTableSize
, physDev
->physBitmap
.colorTable
));
137 if(!physDev
->physBitmap
.colorTableGrabbed
)
139 MAYBE(TRACE("Grabbing palette\n"));
140 physDev
->physBitmap
.colorTable
= HeapAlloc(GetProcessHeap(), 0, sizeof(physDev
->physBitmap
.colorTable
[0]) * physDev
->physBitmap
.colorTableSize
);
141 GetDIBColorTable(physDev
->hdc
, 0, physDev
->physBitmap
.colorTableSize
, physDev
->physBitmap
.colorTable
);
142 #ifdef DIBDRV_ENABLE_MAYBE
143 for(i
= 0; i
< physDev
->physBitmap
.colorTableSize
; i
++)
145 q
= physDev
->physBitmap
.colorTable
+ i
;
146 TRACE(" %03d : R%03d G%03d B%03d\n", i
, q
->rgbRed
, q
->rgbGreen
, q
->rgbBlue
);
149 physDev
->physBitmap
.colorTableGrabbed
= TRUE
;
155 /* DDB selected in, use X11 driver */
156 res
= _DIBDRV_GetDisplayDriver()->pRealizeDefaultPalette(physDev
->X11PhysDev
);
161 BOOL
DIBDRV_GetICMProfile(DIBDRVPHYSDEV
*physDev
, LPDWORD lpcbName
, LPWSTR lpszFilename
)
165 MAYBE(TRACE("physDev:%p, lpcpName:%p, lpszFilename:%p\n", physDev
, lpcbName
, lpszFilename
));
169 /* DIB section selected in, use DIB Engine */
170 ONCE(FIXME("STUB\n"));
176 /* DDB selected in, use X11 driver */
177 res
= _DIBDRV_GetDisplayDriver()->pGetICMProfile(physDev
->X11PhysDev
, lpcbName
, lpszFilename
);