Make ShowWindow(...,SW_SHOWNA) also work on already visible windows
[wine/multimedia.git] / dlls / mscms / icc.c
blobc6edb585f14dbd6d6fd7f0e01fa2441849ed30de
1 /*
2 * MSCMS - Color Management System for Wine
4 * Copyright 2004 Hans Leidekker
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
22 #include "wine/debug.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winnls.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winreg.h"
32 #include "winternl.h"
33 #include "icm.h"
35 #define LCMS_API_FUNCTION(f) extern typeof(f) * p##f;
36 #include "lcms_api.h"
37 #undef LCMS_API_FUNCTION
39 WINE_DEFAULT_DEBUG_CHANNEL(mscms);
41 #ifdef HAVE_LCMS_H
43 static inline void MSCMS_adjust_endianess32( ULONG *ptr )
45 #ifndef WORDS_BIGENDIAN
46 *ptr = RtlUlongByteSwap(*ptr);
47 #endif
50 void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header )
52 unsigned int i;
54 memcpy( header, iccprofile, sizeof(PROFILEHEADER) );
56 /* ICC format is big-endian, swap bytes if necessary */
57 for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
58 MSCMS_adjust_endianess32( (ULONG *)header + i );
61 void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header )
63 unsigned int i;
64 icHeader *iccheader = (icHeader *)iccprofile;
66 memcpy( iccheader, header, sizeof(icHeader) );
68 /* ICC format is big-endian, swap bytes if necessary */
69 for (i = 0; i < sizeof(icHeader) / sizeof(ULONG); i++)
70 MSCMS_adjust_endianess32( (ULONG *)iccheader + i );
73 DWORD MSCMS_get_tag_count( icProfile *iccprofile )
75 ULONG count = iccprofile->count;
77 MSCMS_adjust_endianess32( &count );
78 return count;
81 void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag )
83 icTag *tmp = (icTag *)((char *)&iccprofile->data + index * sizeof(icTag));
85 tag->sig = tmp->sig;
86 tag->offset = tmp->offset;
87 tag->size = tmp->size;
89 MSCMS_adjust_endianess32( (ULONG *)&tag->sig );
90 MSCMS_adjust_endianess32( (ULONG *)&tag->offset );
91 MSCMS_adjust_endianess32( (ULONG *)&tag->size );
94 void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer )
96 memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset );
99 void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer )
101 memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset );
104 #endif /* HAVE_LCMS_H */