1/*
2 * MacPorted.c --
3 *
4 *		Some utility functions just to get some Mac specific
5 *              functionality on Windows for QuickTimeTcl.
6 *
7 *              IMPORTANT: many functions are stripped down versions just
8 *              to get the basic stuff on Windows, beware!
9 */
10
11#include "QuickTimeTclWin.h"
12#include "QuickTimeTcl.h"
13
14/*
15 *----------------------------------------------------------------------
16 *
17 * TkSetMacColor --
18 *
19 *	Populates a Macintosh RGBColor structure from a X style
20 *	pixel value.
21 *
22 * Results:
23 *	Returns false if not a real pixel, true otherwise.
24 *
25 * Side effects:
26 *	The variable macColor is updated to the pixels value.
27 *
28 *----------------------------------------------------------------------
29 */
30
31int
32TkSetMacColor(
33    unsigned long pixel,	/* Pixel value to convert. */
34    RGBColor *macColor)		/* Mac color struct to modify. */
35{
36#ifdef WORDS_BIGENDIAN
37    macColor->blue = (unsigned short) ((pixel & 0xFF) << 8);
38    macColor->green = (unsigned short) (((pixel >> 8) & 0xFF) << 8);
39    macColor->red = (unsigned short) (((pixel >> 16) & 0xFF) << 8);
40#else
41    macColor->red = (unsigned short) (((pixel >> 24) & 0xFF) << 8);
42    macColor->green = (unsigned short) (((pixel >> 16) & 0xFF) << 8);
43    macColor->blue = (unsigned short) (((pixel >> 8) & 0xFF) << 8);
44#endif
45    return true;
46}
47