Mercurial > projects > dstep
diff dstep/applicationservices/colorsync/CMDeviceIntegration.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/applicationservices/colorsync/CMDeviceIntegration.d Mon Aug 03 14:00:21 2009 +0200 @@ -0,0 +1,162 @@ +/** + * 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.CMDeviceIntegration; + +//import dstep.AvailabilityMacros; +import dstep.applicationservices.colorsync.CMApplication; +import dstep.applicationservices.colorsync.CMBase; +import dstep.applicationservices.colorsync.CMICCProfile; +import dstep.applicationservices.colorsync.CMTypes; +import dstep.coreservices.CoreServices; +import dstep.objc.bridge.TypeEncoding; + +alias uint CMDeviceState; +alias uint CMDeviceID; +alias uint CMDeviceProfileID; +alias uint CMDeviceClass; +alias CMDeviceScope CMDeviceProfileScope; + +extern (C) +{ + alias short function (CMDeviceInfo*, void*) CMIterateDeviceInfoProcPtr; + alias short function (CMDeviceInfo*, NCMDeviceProfileInfo*, void*) CMIterateDeviceProfileProcPtr; +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __cmScannerDeviceClass = getOSType!("scnr"); + const __cmCameraDeviceClass = getOSType!("cmra"); + const __cmDisplayDeviceClass = getOSType!("mntr"); + const __cmPrinterDeviceClass = getOSType!("prtr"); + const __cmProofDeviceClass = getOSType!("pruf"); + } +} + +enum +{ + cmDeviceInfoVersion1 = 0x00010000, + cmDeviceProfileInfoVersion1 = 0x00010000, + cmDeviceProfileInfoVersion2 = 0x00020000 +} + +enum +{ + cmCurrentDeviceInfoVersion = cmDeviceInfoVersion1, + cmCurrentProfileInfoVersion = cmDeviceProfileInfoVersion1 +} + +enum +{ + cmDefaultDeviceID = 0, + cmDefaultProfileID = 0 +} + +enum +{ + cmDeviceStateDefault = 0x00000000, + cmDeviceStateOffline = 0x00000001, + cmDeviceStateBusy = 0x00000002, + cmDeviceStateForceNotify = cast(int)0x80000000, + cmDeviceStateDeviceRsvdBits = 0x00FF0000, + cmDeviceStateAppleRsvdBits = cast(int)0xFF00FFFF +} + +enum +{ + cmIterateFactoryDeviceProfiles = 0x00000001, + cmIterateCustomDeviceProfiles = 0x00000002, + cmIterateCurrentDeviceProfiles = 0x00000003, + cmIterateAllDeviceProfiles = 0x00000004, + cmIterateDeviceProfilesMask = 0x0000000F +} + +enum +{ + cmDeviceDBNotFoundErr = -4227, + cmDeviceAlreadyRegistered = -4228, + cmDeviceNotRegistered = -4229, + cmDeviceProfilesNotFound = -4230, + cmInternalCFErr = -4231 +} + +enum +{ + cmScannerDeviceClass = getOSType!("scnr"), + cmCameraDeviceClass = getOSType!("cmra"), + cmDisplayDeviceClass = getOSType!("mntr"), + cmPrinterDeviceClass = getOSType!("prtr"), + cmProofDeviceClass = getOSType!("pruf") +} + +struct CMDeviceScope +{ + CFStringRef deviceUser; + CFStringRef deviceHost; +} + +struct CMDeviceInfo +{ + uint dataVersion; + uint deviceClass; + uint deviceID; + CMDeviceScope deviceScope; + uint deviceState; + uint defaultProfileID; + CFDictionaryRef* deviceName; + uint profileCount; + uint reserved; +} + + +struct CMDeviceProfileInfo +{ + uint dataVersion; + uint profileID; + CMProfileLocation profileLoc; + CFDictionaryRef profileName; + uint reserved; +} + + +struct NCMDeviceProfileInfo +{ + uint dataVersion; + uint profileID; + CMProfileLocation profileLoc; + CFDictionaryRef profileName; + CMDeviceProfileScope profileScope; + uint reserved; +} + + +struct CMDeviceProfileArray +{ + uint profileCount; + CMDeviceProfileInfo* profiles; +} + +extern (C) +{ + CMError CMRegisterColorDevice (uint deviceClass, uint deviceID, CFDictionaryRef deviceName, CMDeviceScope* deviceScope); + CMError CMUnregisterColorDevice (uint deviceClass, uint deviceID); + CMError CMSetDefaultDevice (uint deviceClass, uint deviceID); + CMError CMGetDefaultDevice (uint deviceClass, CMDeviceID* deviceID); + CMError CMSetDeviceFactoryProfiles (uint deviceClass, uint deviceID, uint defaultProfID, CMDeviceProfileArray* deviceProfiles); + CMError CMGetDeviceFactoryProfiles (uint deviceClass, uint deviceID, CMDeviceProfileID* defaultProfID, UInt32* arraySize, CMDeviceProfileArray* deviceProfiles); + CMError CMSetDeviceDefaultProfileID (uint deviceClass, uint deviceID, uint defaultProfID); + CMError CMGetDeviceDefaultProfileID (uint deviceClass, uint deviceID, CMDeviceProfileID* defaultProfID); + CMError CMSetDeviceProfile (uint deviceClass, uint deviceID, CMDeviceProfileScope* profileScope, uint profileID, CMProfileLocation* profileLoc); + CMError CMGetDeviceProfile (uint deviceClass, uint deviceID, uint profileID, CMProfileLocation* profileLoc); + CMError CMSetDeviceState (uint deviceClass, uint deviceID, uint deviceState); + CMError CMGetDeviceState (uint deviceClass, uint deviceID, CMDeviceState* deviceState); + CMError CMGetDeviceInfo (uint deviceClass, uint deviceID, CMDeviceInfo* deviceInfo); + CMError CMIterateColorDevices (CMIterateDeviceInfoProcPtr proc, UInt32* seed, UInt32* count, void* refCon); + CMError CMIterateDeviceProfiles (CMIterateDeviceProfileProcPtr proc, UInt32* seed, UInt32* count, uint flags, void* refCon); +} \ No newline at end of file