ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

icc.c
Go to the documentation of this file.
00001 /*
00002  * MSCMS - Color Management System for Wine
00003  *
00004  * Copyright 2004, 2005 Hans Leidekker
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include "config.h"
00022 
00023 #include <stdarg.h>
00024 
00025 #include "windef.h"
00026 #include "winbase.h"
00027 #include "wingdi.h"
00028 #include "winuser.h"
00029 #include "winternl.h"
00030 #include "icm.h"
00031 
00032 #include "mscms_priv.h"
00033 
00034 #ifdef HAVE_LCMS
00035 
00036 static inline void MSCMS_adjust_endianness32( ULONG *ptr )
00037 {
00038 #ifndef WORDS_BIGENDIAN
00039     *ptr = RtlUlongByteSwap(*ptr);
00040 #endif
00041 }
00042 
00043 void MSCMS_get_profile_header( const icProfile *iccprofile, PROFILEHEADER *header )
00044 {
00045     unsigned int i;
00046 
00047     memcpy( header, iccprofile, sizeof(PROFILEHEADER) );
00048 
00049     /* ICC format is big-endian, swap bytes if necessary */
00050     for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
00051         MSCMS_adjust_endianness32( (ULONG *)header + i );
00052 }
00053 
00054 void MSCMS_set_profile_header( icProfile *iccprofile, const PROFILEHEADER *header )
00055 {
00056     unsigned int i;
00057     icHeader *iccheader = (icHeader *)iccprofile;
00058 
00059     memcpy( iccheader, header, sizeof(icHeader) );
00060 
00061     /* ICC format is big-endian, swap bytes if necessary */
00062     for (i = 0; i < sizeof(icHeader) / sizeof(ULONG); i++)
00063         MSCMS_adjust_endianness32( (ULONG *)iccheader + i );
00064 }
00065 
00066 DWORD MSCMS_get_tag_count( const icProfile *iccprofile )
00067 {
00068     ULONG count = iccprofile->count;
00069 
00070     MSCMS_adjust_endianness32( &count );
00071     return count;
00072 }
00073 
00074 void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag )
00075 {
00076     icTag *tmp = (icTag *)((char *)iccprofile->data + index * sizeof(icTag));
00077 
00078     tag->sig = tmp->sig;
00079     tag->offset = tmp->offset;
00080     tag->size = tmp->size;
00081 
00082     MSCMS_adjust_endianness32( &tag->sig );
00083     MSCMS_adjust_endianness32( &tag->offset );
00084     MSCMS_adjust_endianness32( &tag->size );
00085 }
00086 
00087 void MSCMS_get_tag_data( const icProfile *iccprofile, const icTag *tag, DWORD offset, void *buffer )
00088 {
00089     memcpy( buffer, (const char *)iccprofile + tag->offset + offset, tag->size - offset );
00090 }
00091 
00092 void MSCMS_set_tag_data( icProfile *iccprofile, const icTag *tag, DWORD offset, const void *buffer )
00093 {
00094     memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset );
00095 }
00096 
00097 DWORD MSCMS_get_profile_size( const icProfile *iccprofile )
00098 {
00099     DWORD size = ((const icHeader *)iccprofile)->size;
00100 
00101     MSCMS_adjust_endianness32( &size );
00102     return size;
00103 }
00104 
00105 #endif /* HAVE_LCMS */

Generated on Mon May 28 2012 04:24:27 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.