test: access.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# access.c

Go to the documentation of this file.

    00001 /*
    00002         File:           MSICMProfileAccess.c
    00003
    00004         Contains:
    00005
    00006         Written by:     U. J. Krabbenhoeft
    00007
    00008         Copyright:      © 1993-1997 by Heidelberger Druckmaschinen AG, all rights reserved.
    00009
    00010         Version:
    00011 */
    00012 #include "Windef.h"
    00013 #include "WinGdi.h"
    00014 #include <wtypes.h>
    00015 #include "ICM.h"
    00016 #include "General.h"
    00017 /* --------------------------------------------------------------------------
    00018
    00019 CMError CMGetProfileHeader(     CMProfileRef                    prof,
    00020                                                         CMCoreProfileHeader*    header );
    00021
    00022         Abstract:
    00023
    00024         Params:
    00025
    00026         Return:
    00027                 noErr           successful
    00028
    00029    -------------------------------------------------------------------------- */
    00030 CMError CMGetProfileHeader(     CMProfileRef                    prof,
    00031                                                         CMCoreProfileHeader*    header )
    00032 {
    00033         BOOL bool;
    00034         CMError ret = badProfileError;
    00035
    00036         bool = GetColorProfileHeader( (HPROFILE)prof, (PPROFILEHEADER) header );
    00037         if (header->magic == icMagicNumber && bool )
    00038                 ret = noErr;
    00039
    00040         return (ret);
    00041 }
    00042
    00043
    00044 /* --------------------------------------------------------------------------
    00045
    00046 CMError CMGetProfileElement(    CMProfileRef            prof,
    00047                                                                 OSType                          tag,
    00048                                                                 unsigned long*          elementSize,
    00049                                                                 void*                           elementData );
    00050
    00051         Abstract:
    00052                 This function gives an pointer to the requested tag back
    00053         Params:
    00054
    00055         Return:
    00056                 noErr           successful
    00057
    00058    -------------------------------------------------------------------------- */
    00059 CMError CMGetProfileElement(    CMProfileRef            prof,
    00060                                                                 OSType                          tag,
    00061                                                                 unsigned long*          elementSize,
    00062                                                                 void*                           elementData )
    00063 {
    00064         return (CMGetPartialProfileElement(prof, tag, 0, elementSize, elementData));
    00065 }
    00066
    00067
    00068 /* --------------------------------------------------------------------------
    00069
    00070         CMError CMGetPartialProfileElement(     CMProfileRef            prof,
    00071                                                                                 OSType                          tag,
    00072                                                                                 unsigned long           offset,
    00073                                                                                 unsigned long           *byteCount,
    00074                                                                                 void                            *elementData )
    00075
    00076         Abstract:
    00077                 Core likes small amounts of memory we too but this is ascetic.
    00078         Params:
    00079
    00080         Return:
    00081                 noErr           successful
    00082
    00083    -------------------------------------------------------------------------- */
    00084
    00085 CMError CMGetPartialProfileElement(     CMProfileRef            prof,
    00086                                                                         OSType                          tag,
    00087                                                                         unsigned long           offset,
    00088                                                                         unsigned long           *byteCount,
    00089                                                                         void                            *elementData )
    00090 {
    00091         BOOL bool;
    00092         BOOL ret;
    00093
    00094         if (!byteCount)
    00095         {
    00096                 return -1;
    00097         }
    00098         SetLastError(0);
    00099         /*ret = IsColorProfileTagPresent( (HPROFILE)prof, (TAGTYPE)tag, &bool );*/
    00100         if( elementData == 0 ) *byteCount = 0;
    00101         ret = GetColorProfileElement( (HPROFILE)prof, (TAGTYPE)tag, offset, byteCount, elementData, &bool );
    00102         if( ret )               return (noErr);
    00103         /*                                      GetColorProfileElement returns FALSE for calls with elementData = 0
    00104                                                 but byteCount is set correctly */
    00105         else if( elementData == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER )      return (noErr);
    00106
    00107         return (cmElementTagNotFound);
    00108 }
    00109
    00110 /* --------------------------------------------------------------------------
    00111
    00112 Boolean CMProfileElementExists(         CMProfileRef    prof,
    00113                                                                         OSType                  tag );
    00114
    00115         Abstract:
    00116
    00117         Params:
    00118
    00119         Return:
    00120                 noErr           successful
    00121
    00122    -------------------------------------------------------------------------- */
    00123 Boolean CMProfileElementExists(         CMProfileRef    prof,
    00124                                                                         OSType                  tag )
    00125 {
    00126         BOOL bool;
    00127         IsColorProfileTagPresent( (HPROFILE)prof, (TAGTYPE)tag, &bool );
    00128         return (BOOLEAN)bool;
    00129 }
    00130
    00131