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 if(physDev
&& physDev
->hasDIB
)
39 /* DIB section selected in, additional (if needed) engine code */
40 ONCE(FIXME("STUB\n"));
45 /* we should in any case call X11 function, as UnrealizePalette() doesn't
46 * take a physDev parameter */
47 res
= _DIBDRV_GetDisplayDriver()->pRealizePalette(physDev
? physDev
->X11PhysDev
: NULL
, hpal
, primary
);
54 /***********************************************************************
55 * DIBDRV_UnrealizePalette
57 BOOL
DIBDRV_UnrealizePalette( HPALETTE hpal
)
61 MAYBE(TRACE("hpal:%p\n", hpal
));
63 /* we should in any case call X11 function, as UnrealizePalette() doesn't
64 * take a physDev parameter */
65 res
= _DIBDRV_GetDisplayDriver()->pUnrealizePalette(hpal
);
67 /* additional Engine code here, if needed */
68 ONCE(FIXME("STUB\n"));
73 /***********************************************************************
74 * DIBDRV_GetSystemPaletteEntries
76 UINT
DIBDRV_GetSystemPaletteEntries( DIBDRVPHYSDEV
*physDev
, UINT start
, UINT count
,
77 LPPALETTEENTRY entries
)
81 MAYBE(TRACE("physDev:%p, start:%d, count:%d, entries:%p\n", physDev
, start
, count
, entries
));
85 /* DIB section selected in, use DIB Engine */
86 ONCE(FIXME("STUB\n"));
91 /* DDB selected in, use X11 driver */
92 res
= _DIBDRV_GetDisplayDriver()->pGetSystemPaletteEntries(physDev
->X11PhysDev
, start
, count
, entries
);
97 /***********************************************************************
98 * DIBDRV_GetNearestColor
100 COLORREF
DIBDRV_GetNearestColor( DIBDRVPHYSDEV
*physDev
, COLORREF color
)
104 MAYBE(TRACE("physDev:%p, color:%x\n", physDev
, color
));
108 /* DIB section selected in, use DIB Engine */
109 ONCE(FIXME("STUB\n"));
114 /* DDB selected in, use X11 driver */
115 res
= _DIBDRV_GetDisplayDriver()->pGetNearestColor(physDev
->X11PhysDev
, color
);
120 /***********************************************************************
121 * DIBDRV_RealizeDefaultPalette
123 UINT
DIBDRV_RealizeDefaultPalette( DIBDRVPHYSDEV
*physDev
)
126 #ifdef DIBDRV_ENABLE_MAYBE
131 MAYBE(TRACE("physDev:%p\n", physDev
));
135 /* DIB section selected in, use DIB Engine */
136 ONCE(FIXME("STUB\n"));
137 /* HACK - we can't get the dib color table during SelectBitmap since it hasn't
138 been initialized yet. This is called from DC_InitDC so it's a convenient place
139 to grab the color table. */
140 MAYBE(TRACE("Color table size = %d, Color table = %p\n", physDev
->physBitmap
.colorTableSize
, physDev
->physBitmap
.colorTable
));
141 if(!physDev
->physBitmap
.colorTableGrabbed
)
143 MAYBE(TRACE("Grabbing palette\n"));
144 physDev
->physBitmap
.colorTable
= HeapAlloc(GetProcessHeap(), 0, sizeof(physDev
->physBitmap
.colorTable
[0]) * physDev
->physBitmap
.colorTableSize
);
145 GetDIBColorTable(physDev
->hdc
, 0, physDev
->physBitmap
.colorTableSize
, physDev
->physBitmap
.colorTable
);
146 #ifdef DIBDRV_ENABLE_MAYBE
147 for(i
= 0; i
< physDev
->physBitmap
.colorTableSize
; i
++)
149 q
= physDev
->physBitmap
.colorTable
+ i
;
150 TRACE(" %03d : R%03d G%03d B%03d\n", i
, q
->rgbRed
, q
->rgbGreen
, q
->rgbBlue
);
153 physDev
->physBitmap
.colorTableGrabbed
= TRUE
;
159 /* DDB selected in, use X11 driver */
160 res
= _DIBDRV_GetDisplayDriver()->pRealizeDefaultPalette(physDev
->X11PhysDev
);
165 BOOL
DIBDRV_GetICMProfile(DIBDRVPHYSDEV
*physDev
, LPDWORD lpcbName
, LPWSTR lpszFilename
)
169 MAYBE(TRACE("physDev:%p, lpcpName:%p, lpszFilename:%p\n", physDev
, lpcbName
, lpszFilename
));
173 /* DIB section selected in, use DIB Engine */
174 ONCE(FIXME("STUB\n"));
180 /* DDB selected in, use X11 driver */
181 res
= _DIBDRV_GetDisplayDriver()->pGetICMProfile(physDev
->X11PhysDev
, lpcbName
, lpszFilename
);