Mercurial > projects > dstep
view dstep/applicationservices/colorsync/CMApplication.d @ 12:9f0b49a2f64e
Added the ApplicationServices frameworks: ATS, ColorSync and CoreGraphics
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 14:00:21 +0200 |
parents | |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 1, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.applicationservices.colorsync.CMApplication; //import dstep.AvailabilityMacros; import dstep.applicationservices.colorsync.CMBase; import dstep.applicationservices.colorsync.CMICCProfile; import dstep.applicationservices.colorsync.CMTypes; import dstep.coreservices.CoreServices; import dstep.internal.Version; import dstep.objc.bridge.TypeEncoding; alias uint CMBitmapColorSpace; alias CMProfileIterateProcPtr CMProfileIterateUPP; alias CMMIterateProcPtr CMMIterateUPP; extern (C) { alias short function (CMProfileIterateData*, void*) CMProfileIterateProcPtr; alias short function (CMMInfo*, void*) CMMIterateProcPtr; alias void function (float*, float*, float*, void*) CMLabToLabProcPtr; } // This is needed otherwise the enums will fail compiling with gdc version (GNU) { private { const __kDefaultCMMSignature = getOSType!("appl"); const __cmInputUse = getOSType!("inpt"); const __cmOutputUse = getOSType!("outp"); const __cmDisplayUse = getOSType!("dply"); const __cmProofUse = getOSType!("pruf"); } } static if (!D_LP64 && !Win32) { struct CMFileLocation { FSSpec spec; } struct CMPtrLocation { Ptr p; } struct CMProcedureLocation { CMProfileAccessUPP proc; void* refCon; } union CMProfLoc { CMFileLocation fileLoc; CMHandleLocation handleLoc; CMPtrLocation ptrLoc; CMProcedureLocation procLoc; CMPathLocation pathLoc; CMBufferLocation bufferLoc; } union CMAppleProfileHeader { CMHeader cm1; CM2Header cm2; CM4Header cm4; } } else { union CMProfLoc { CMHandleLocation handleLoc; CMPathLocation pathLoc; CMBufferLocation bufferLoc; } union CMAppleProfileHeader { CM2Header cm2; CM4Header cm4; } } enum { kDefaultCMMSignature = getOSType!("appl") } enum { cmPS7bit = 1, cmPS8bit = 2 } enum { cmOpenReadSpool = 1, cmOpenWriteSpool = 2, cmReadSpool = 3, cmWriteSpool = 4, cmCloseSpool = 5 } enum { cmOpenReadAccess = 1, cmOpenWriteAccess = 2, cmReadAccess = 3, cmWriteAccess = 4, cmCloseAccess = 5, cmCreateNewAccess = 6, cmAbortWriteAccess = 7, cmBeginAccess = 8, cmEndAccess = 9 } enum { cmInputUse = getOSType!("inpt"), cmOutputUse = getOSType!("outp"), cmDisplayUse = getOSType!("dply"), cmProofUse = getOSType!("pruf") } enum { kNoTransform = 0, kUseAtoB = 1, kUseBtoA = 2, kUseBtoB = 3, kDeviceToPCS = kUseAtoB, kPCSToDevice = kUseBtoA, kPCSToPCS = kUseBtoB, kUseProfileIntent = 0xFFFFFFFF } enum { cmColorSpaceSpaceMask = 0x0000003F, cmColorSpacePremulAlphaMask = 0x00000040, cmColorSpaceAlphaMask = 0x00000080, cmColorSpaceSpaceAndAlphaMask = 0x000000FF, cmColorSpacePackingMask = 0x0000FF00, cmColorSpaceEncodingMask = 0x000F0000, cmColorSpaceReservedMask = 0xFFF00000 } enum { cmNoColorPacking = 0x0000, cmWord5ColorPacking = 0x0500, cmWord565ColorPacking = 0x0600, cmLong8ColorPacking = 0x0800, cmLong10ColorPacking = 0x0A00, cmAlphaFirstPacking = 0x1000, cmOneBitDirectPacking = 0x0B00, cmAlphaLastPacking = 0x0000, cm8_8ColorPacking = 0x2800, cm16_8ColorPacking = 0x2000, cm24_8ColorPacking = 0x2100, cm32_8ColorPacking = cmLong8ColorPacking, cm40_8ColorPacking = 0x2200, cm48_8ColorPacking = 0x2300, cm56_8ColorPacking = 0x2400, cm64_8ColorPacking = 0x2500, cm32_16ColorPacking = 0x2600, cm48_16ColorPacking = 0x2900, cm64_16ColorPacking = 0x2A00, cm32_32ColorPacking = 0x2700, cmLittleEndianPacking = 0x4000, cmReverseChannelPacking = 0x8000 } enum { cmSRGB16ChannelEncoding = 0x00010000 } enum { cmNoSpace = 0x0000, cmRGBSpace = 0x0001, cmCMYKSpace = 0x0002, cmHSVSpace = 0x0003, cmHLSSpace = 0x0004, cmYXYSpace = 0x0005, cmXYZSpace = 0x0006, cmLUVSpace = 0x0007, cmLABSpace = 0x0008, cmReservedSpace1 = 0x0009, cmGraySpace = 0x000A, cmReservedSpace2 = 0x000B, cmGamutResultSpace = 0x000C, cmNamedIndexedSpace = 0x0010, cmMCFiveSpace = 0x0011, cmMCSixSpace = 0x0012, cmMCSevenSpace = 0x0013, cmMCEightSpace = 0x0014, cmAlphaPmulSpace = 0x0040, cmAlphaSpace = 0x0080, cmRGBASpace = cmRGBSpace + cmAlphaSpace, cmGrayASpace = cmGraySpace + cmAlphaSpace, cmRGBAPmulSpace = cmRGBASpace + cmAlphaPmulSpace, cmGrayAPmulSpace = cmGrayASpace + cmAlphaPmulSpace } enum { cmGray8Space = cmGraySpace + cm8_8ColorPacking, cmGray16Space = cmGraySpace, cmGray16LSpace = cmGraySpace + cmLittleEndianPacking, cmGrayA16Space = cmGrayASpace + cm16_8ColorPacking, cmGrayA32Space = cmGrayASpace, cmGrayA32LSpace = cmGrayASpace + cmLittleEndianPacking, cmGrayA16PmulSpace = cmGrayAPmulSpace + cm16_8ColorPacking, cmGrayA32PmulSpace = cmGrayAPmulSpace, cmGrayA32LPmulSpace = cmGrayAPmulSpace + cmLittleEndianPacking, cmRGB16Space = cmRGBSpace + cmWord5ColorPacking, cmRGB16LSpace = cmRGBSpace + cmWord5ColorPacking + cmLittleEndianPacking, cmRGB565Space = cmRGBSpace + cmWord565ColorPacking, cmRGB565LSpace = cmRGBSpace + cmWord565ColorPacking + cmLittleEndianPacking, cmRGB24Space = cmRGBSpace + cm24_8ColorPacking, cmRGB32Space = cmRGBSpace + cm32_8ColorPacking, cmRGB48Space = cmRGBSpace + cm48_16ColorPacking, cmRGB48LSpace = cmRGBSpace + cm48_16ColorPacking + cmLittleEndianPacking, cmARGB32Space = cmRGBASpace + cm32_8ColorPacking + cmAlphaFirstPacking, cmARGB64Space = cmRGBASpace + cm64_16ColorPacking + cmAlphaFirstPacking, cmARGB64LSpace = cmRGBASpace + cm64_16ColorPacking + cmAlphaFirstPacking + cmLittleEndianPacking, cmRGBA32Space = cmRGBASpace + cm32_8ColorPacking + cmAlphaLastPacking, cmRGBA64Space = cmRGBASpace + cm64_16ColorPacking + cmAlphaLastPacking, cmRGBA64LSpace = cmRGBASpace + cm64_16ColorPacking + cmAlphaLastPacking + cmLittleEndianPacking, cmARGB32PmulSpace = cmRGBAPmulSpace + cm32_8ColorPacking + cmAlphaFirstPacking, cmARGB64PmulSpace = cmRGBAPmulSpace + cm64_16ColorPacking + cmAlphaFirstPacking, cmARGB64LPmulSpace = cmRGBAPmulSpace + cm64_16ColorPacking + cmAlphaFirstPacking + cmLittleEndianPacking, cmRGBA32PmulSpace = cmRGBAPmulSpace + cm32_8ColorPacking + cmAlphaLastPacking, cmRGBA64PmulSpace = cmRGBAPmulSpace + cm64_16ColorPacking + cmAlphaLastPacking, cmRGBA64LPmulSpace = cmRGBAPmulSpace + cm64_16ColorPacking + cmAlphaLastPacking + cmLittleEndianPacking, cmCMYK32Space = cmCMYKSpace + cm32_8ColorPacking, cmCMYK64Space = cmCMYKSpace + cm64_16ColorPacking, cmCMYK64LSpace = cmCMYKSpace + cm64_16ColorPacking + cmLittleEndianPacking, cmHSV32Space = cmHSVSpace + cmLong10ColorPacking, cmHLS32Space = cmHLSSpace + cmLong10ColorPacking, cmYXY32Space = cmYXYSpace + cmLong10ColorPacking, cmXYZ24Space = cmXYZSpace + cm24_8ColorPacking, cmXYZ32Space = cmXYZSpace + cmLong10ColorPacking, cmXYZ48Space = cmXYZSpace + cm48_16ColorPacking, cmXYZ48LSpace = cmXYZSpace + cm48_16ColorPacking + cmLittleEndianPacking, cmLUV32Space = cmLUVSpace + cmLong10ColorPacking, cmLAB24Space = cmLABSpace + cm24_8ColorPacking, cmLAB32Space = cmLABSpace + cmLong10ColorPacking, cmLAB48Space = cmLABSpace + cm48_16ColorPacking, cmLAB48LSpace = cmLABSpace + cm48_16ColorPacking + cmLittleEndianPacking, cmGamutResult1Space = cmOneBitDirectPacking + cmGamutResultSpace, cmNamedIndexed32Space = cm32_32ColorPacking + cmNamedIndexedSpace, cmNamedIndexed32LSpace = cm32_32ColorPacking + cmNamedIndexedSpace + cmLittleEndianPacking, cmMCFive8Space = cm40_8ColorPacking + cmMCFiveSpace, cmMCSix8Space = cm48_8ColorPacking + cmMCSixSpace, cmMCSeven8Space = cm56_8ColorPacking + cmMCSevenSpace, cmMCEight8Space = cm64_8ColorPacking + cmMCEightSpace } enum { CS_MAX_PATH = 1024 } enum { cmNoProfileBase = 0, cmPathBasedProfile = 5, cmBufferBasedProfile = 6 } enum { cmProfileIterateDataVersion1 = 0x00010000, cmProfileIterateDataVersion2 = 0x00020000, cmProfileIterateDataVersion3 = 0x00030000 } enum { cmTextureRGBtoRGBX8 = 0, cmTextureRGBtoRGBX16 = 1, cmTextureRGBtoRGBXFloat32 = 2 } union CMColor { CMRGBColor rgb; CMHSVColor hsv; CMHLSColor hls; CMXYZColor XYZ; CMLabColor Lab; CMLuvColor Luv; CMYxyColor Yxy; CMCMYKColor cmyk; CMCMYColor cmy; CMGrayColor gray; CMMultichannel5Color mc5; CMMultichannel6Color mc6; CMMultichannel7Color mc7; CMMultichannel8Color mc8; CMNamedColor namedColor; } struct CMProfileLocation { short locType; CMProfLoc u; } struct CMConcatProfileSet { ushort keyIndex; ushort count; CMProfileRef* profileSet; } struct NCMConcatProfileSpec { uint renderingIntent; uint transformTag; CMProfileRef profile; } struct NCMConcatProfileSet { uint cmm; uint flags; uint flagsMask; uint profileCount; NCMConcatProfileSpec* profileSpecs; } struct CMRGBColor { ushort red; ushort green; ushort blue; } struct CMCMYKColor { ushort cyan; ushort magenta; ushort yellow; ushort black; } struct CMCMYColor { ushort cyan; ushort magenta; ushort yellow; } struct CMHLSColor { ushort hue; ushort lightness; ushort saturation; } struct CMHSVColor { ushort hue; ushort saturation; ushort value; } struct CMLabColor { ushort L; ushort a; ushort b; } struct CMLuvColor { ushort L; ushort u; ushort v; } struct CMYxyColor { ushort capY; ushort x; ushort y; } struct CMGrayColor { ushort gray; } struct CMMultichannel5Color { char* components; } struct CMMultichannel6Color { char* components; } struct CMMultichannel7Color { char* components; } struct CMMultichannel8Color { char* components; } struct CMNamedColor { uint namedColorIndex; } struct CMMInfo { uint dataSize; uint CMMType; uint CMMMfr; uint CMMVersion; char* ASCIIName; char* ASCIIDesc; uint UniCodeNameCount; wchar* UniCodeName; uint UniCodeDescCount; wchar* UniCodeDesc; } struct CMBitmap { char* image; uint width; uint height; uint rowBytes; uint pixelSize; uint space; uint user1; uint user2; } struct CMHandleLocation { Handle h; } struct CMPathLocation { char* path; } struct CMBufferLocation { void* buffer; uint size; } struct CMProfileIterateData { uint dataVersion; CM2Header header; short code; ubyte[256] name; CMProfileLocation location; uint uniCodeNameCount; wchar* uniCodeName; char* asciiName; CMMakeAndModel* makeAndModel; CMProfileMD5* digest; } enum { cmOriginalProfileLocationSize = 72, cmCurrentProfileLocationSize = CMProfileLocation.sizeof } extern (C) { CMError CMNewProfile (CMProfileRef* prof, CMProfileLocation* theProfile); CMError NCWNewLinkProfile (CMProfileRef* prof, CMProfileLocation* targetLocation, NCMConcatProfileSet* profileSet, CMConcatCallBackUPP proc, void* refCon); CMError CMMakeProfile (CMProfileRef prof, CFDictionaryRef spec); CMError CMOpenProfile (CMProfileRef* prof, CMProfileLocation* theProfile); CMError CMCloseProfile (CMProfileRef prof); CMError CMUpdateProfile (CMProfileRef prof); CMError CMCopyProfile (CMProfileRef* targetProf, CMProfileLocation* targetLocation, CMProfileRef srcProf); CMError CMValidateProfile (CMProfileRef prof, char* valid, char* preferredCMMnotfound); CMError NCMGetProfileLocation (CMProfileRef prof, CMProfileLocation* theProfile, UInt32* locationSize); CMError CMProfileCopyICCData (CFAllocatorRef allocator, CMProfileRef prof); CMError CMGetProfileHeader (CMProfileRef prof, CMAppleProfileHeader* header); CMError CMSetProfileHeader (CMProfileRef prof, CMAppleProfileHeader* header); CMError CMCloneProfileRef (CMProfileRef prof); CMError CMGetProfileRefCount (CMProfileRef prof, long* count); CMError CMProfileModified (CMProfileRef prof, char* modified); CMError CMGetProfileMD5 (CMProfileRef prof, ubyte[16] digest); CMError CMCountProfileElements (CMProfileRef prof, UInt32* elementCount); CMError CMProfileElementExists (CMProfileRef prof, uint tag, char* found); CMError CMGetProfileElement (CMProfileRef prof, uint tag, UInt32* elementSize, void* elementData); CMError CMSetProfileElement (CMProfileRef prof, uint tag, uint elementSize, void* elementData); CMError CMSetProfileElementSize (CMProfileRef prof, uint tag, uint elementSize); CMError CMSetProfileElementReference (CMProfileRef prof, uint elementTag, uint referenceTag); CMError CMGetPartialProfileElement (CMProfileRef prof, uint tag, uint offset, UInt32* byteCount, void* elementData); CMError CMSetPartialProfileElement (CMProfileRef prof, uint tag, uint offset, uint byteCount, void* elementData); CMError CMGetIndProfileElementInfo (CMProfileRef prof, uint index, OSType* tag, UInt32* elementSize, char* refs); CMError CMGetIndProfileElement (CMProfileRef prof, uint index, UInt32* elementSize, void* elementData); CMError CMRemoveProfileElement (CMProfileRef prof, uint tag); CMError CMGetProfileDescriptions (CMProfileRef prof, char* aName, UInt32* aCount, ubyte[256] mName, ScriptCode* mCode, wchar* uName, UniCharCount* uCount); CMError CMSetProfileDescriptions (CMProfileRef prof, char* aName, uint aCount, char* mName, short mCode, wchar* uName, uint uCount); CMError CMCopyProfileLocalizedStringDictionary (CMProfileRef prof, uint tag, CFDictionaryRef* theDict); CMError CMSetProfileLocalizedStringDictionary (CMProfileRef prof, uint tag, CFDictionaryRef theDict); CMError CMCopyProfileLocalizedString (CMProfileRef prof, uint tag, CFStringRef reqLocale, CFStringRef* locale, CFStringRef* str); CMError CMCopyProfileDescriptionString (CMProfileRef prof, CFStringRef* str); CMError CMGetNamedColorInfo (CMProfileRef prof, UInt32* deviceChannels, OSType* deviceColorSpace, OSType* PCSColorSpace, UInt32* count, char* prefix, char* suffix); CMError CMGetNamedColorValue (CMProfileRef prof, char* name, CMColor* deviceColor, CMColor* PCSColor); CMError CMGetIndNamedColorValue (CMProfileRef prof, uint index, CMColor* deviceColor, CMColor* PCSColor); CMError CMGetNamedColorIndex (CMProfileRef prof, char* name, UInt32* index); CMError CMGetNamedColorName (CMProfileRef prof, uint index, char* name); CMError NCWNewColorWorld (CMWorldRef* cw, CMProfileRef src, CMProfileRef dst); CMError NCWConcatColorWorld (CMWorldRef* cw, NCMConcatProfileSet* profileSet, CMConcatCallBackUPP proc, void* refCon); CMError CWDisposeColorWorld (CMWorldRef cw); CMError CWMatchColors (CMWorldRef cw, CMColor* myColors, uint count); CMError CWCheckColors (CMWorldRef cw, CMColor* myColors, uint count, char* result); CMError CWMatchBitmap (CMWorldRef cw, CMBitmap* bitmap, CMBitmapCallBackUPP progressProc, void* refCon, CMBitmap* matchedBitmap); CMError CWCheckBitmap (CMWorldRef cw, CMBitmap* bitmap, CMBitmapCallBackUPP progressProc, void* refCon, CMBitmap* resultBitmap); CMError CWGetCMMSignature (CMWorldRef cw); CMError CWFillLookupTexture (CMWorldRef cw, uint gridPoints, uint format, uint dataSize, void* data); CMError CMGetSystemProfile (CMProfileRef* prof); CMError CMGetDefaultProfileBySpace (uint dataColorSpace, CMProfileRef* prof); CMError CMGetDefaultProfileByUse (uint use, CMProfileRef* prof); CMError CMGetProfileByAVID (uint theID, CMProfileRef* prof); CMError CMSetProfileByAVID (uint theID, CMProfileRef prof); CMError CMGetGammaByAVID (uint theID, CMVideoCardGamma* gamma, UInt32* size); CMError CMSetGammaByAVID (uint theID, CMVideoCardGamma* gamma); CMError CMIterateColorSyncFolder (CMProfileIterateUPP proc, UInt32* seed, UInt32* count, void* refCon); CMError CMIterateCMMInfo (CMMIterateUPP proc, UInt32* count, void* refCon); CMError CMGetColorSyncVersion (UInt32* version_); CMError CMLaunchControlPanel (uint flags); CMError CMGetPS2ColorSpace (CMProfileRef srcProf, uint flags, CMFlattenUPP proc, void* refCon, char* preferredCMMnotfound); CMError CMGetPS2ColorRenderingIntent (CMProfileRef srcProf, uint flags, CMFlattenUPP proc, void* refCon, char* preferredCMMnotfound); CMError CMGetPS2ColorRendering (CMProfileRef srcProf, CMProfileRef dstProf, uint flags, CMFlattenUPP proc, void* refCon, char* preferredCMMnotfound); CMError CMGetPS2ColorRenderingVMSize (CMProfileRef srcProf, CMProfileRef dstProf, UInt32* vmSize, char* preferredCMMnotfound); }