mscms_priv.h 3.52 KB
Newer Older
1 2 3
/*
 * MSCMS - Color Management System for Wine
 *
4
 * Copyright 2004, 2005 Hans Leidekker
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
19 20
 */

21
#ifdef HAVE_LCMS
22 23

/*  These basic Windows types are defined in lcms.h when compiling on
24
 *  a non-Windows platform (why?), so they would normally not conflict
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
 *  with anything included earlier. But since we are building Wine they
 *  most certainly will have been defined before we include lcms.h.
 *  The preprocessor comes to the rescue.
 */

#define BYTE    LCMS_BYTE
#define LPBYTE  LCMS_LPBYTE
#define WORD    LCMS_WORD
#define LPWORD  LCMS_LPWORD
#define DWORD   LCMS_DWORD
#define LPDWORD LCMS_LPDWORD
#define BOOL    LCMS_BOOL
#define LPSTR   LCMS_LPSTR
#define LPVOID  LCMS_LPVOID

#undef cdecl
#undef FAR

#undef ZeroMemory
#undef CopyMemory

#undef LOWORD
47
#undef HIWORD
48 49
#undef MAX_PATH

50 51 52
#ifdef HAVE_LCMS_LCMS_H
#include <lcms/lcms.h>
#else
53
#include <lcms.h>
54
#endif
55

56 57
/*  Funny thing is lcms.h defines DWORD as an 'unsigned long' whereas Wine
 *  defines it as an 'unsigned int'. To avoid compiler warnings we use a
58
 *  preprocessor define for DWORD and LPDWORD to get back Wine's original
59 60 61
 *  (typedef) definitions.
 */

62
#undef BOOL
63 64 65
#undef DWORD
#undef LPDWORD

66
#define BOOL    BOOL
67 68 69
#define DWORD   DWORD
#define LPDWORD LPDWORD

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
/*  A simple structure to tie together a pointer to an icc profile, an lcms
 *  color profile handle and a Windows file handle. If the profile is memory
 *  based the file handle field is set to INVALID_HANDLE_VALUE. The 'access'
 *  field records the access parameter supplied to an OpenColorProfile()
 *  call, i.e. PROFILE_READ or PROFILE_READWRITE.
 */

struct profile
{
    HANDLE file;
    DWORD access;
    icProfile *iccprofile;
    cmsHPROFILE cmsprofile;
};

struct transform
{
    cmsHTRANSFORM cmstransform;
};

extern HPROFILE create_profile( struct profile * );
extern BOOL close_profile( HPROFILE );

extern HTRANSFORM create_transform( struct transform * );
extern BOOL close_transform( HTRANSFORM );

struct profile *grab_profile( HPROFILE );
struct transform *grab_transform( HTRANSFORM );

void release_profile( struct profile * );
void release_transform( struct transform * );

extern void free_handle_tables( void );
103

104
extern DWORD MSCMS_get_tag_count( const icProfile *iccprofile );
105
extern void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag );
106 107 108 109 110
extern void MSCMS_get_tag_data( const icProfile *iccprofile, const icTag *tag, DWORD offset, void *buffer );
extern void MSCMS_set_tag_data( icProfile *iccprofile, const icTag *tag, DWORD offset, const void *buffer );
extern void MSCMS_get_profile_header( const icProfile *iccprofile, PROFILEHEADER *header );
extern void MSCMS_set_profile_header( icProfile *iccprofile, const PROFILEHEADER *header );
extern DWORD MSCMS_get_profile_size( const icProfile *iccprofile );
111

112 113
extern const char *MSCMS_dbgstr_tag(DWORD);

114
#endif /* HAVE_LCMS */