Exemplo n.º 1
0
        private PlatformPerformance()
        {
            var handle = Dlfcn.dlopen("/usr/lib/libSystem.dylib", 0);

            self = Dlfcn.GetIntPtr(handle, "mach_task_self_");
            Dlfcn.dlclose(handle);
        }
Exemplo n.º 2
0
        internal static void IORegistryEntrySetCFProperty(IOKitObject entry, string propertyName, bool property)
        {
            var    handle  = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);
            IntPtr macbool = Dlfcn.GetIntPtr(handle, property ? "kCFBooleanTrue" : "kCFBooleanFalse");

            IORegistryEntrySetCFProperty((IntPtr)entry, ((CFString)propertyName).Handle, macbool);
        }
Exemplo n.º 3
0
        static CFAllocator()
        {
            var handle = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);

            null_ptr = Dlfcn.GetIntPtr(handle, "kCFAllocatorNull");
            Dlfcn.dlclose(handle);
        }
Exemplo n.º 4
0
        static CGPDFInfo()
        {
            IntPtr h = Dlfcn.dlopen(Constants.CoreGraphicsLibrary, 0);

            try {
                kCGPDFContextTitle               = Dlfcn.GetIntPtr(h, "kCGPDFContextTitle");
                kCGPDFContextAuthor              = Dlfcn.GetIntPtr(h, "kCGPDFContextAuthor");
                kCGPDFContextSubject             = Dlfcn.GetIntPtr(h, "kCGPDFContextSubject");
                kCGPDFContextKeywords            = Dlfcn.GetIntPtr(h, "kCGPDFContextKeywords");
                kCGPDFContextCreator             = Dlfcn.GetIntPtr(h, "kCGPDFContextCreator");
                kCGPDFContextOwnerPassword       = Dlfcn.GetIntPtr(h, "kCGPDFContextOwnerPassword");
                kCGPDFContextUserPassword        = Dlfcn.GetIntPtr(h, "kCGPDFContextUserPassword");
                kCGPDFContextEncryptionKeyLength = Dlfcn.GetIntPtr(h, "kCGPDFContextEncryptionKeyLength");
                kCGPDFContextAllowsPrinting      = Dlfcn.GetIntPtr(h, "kCGPDFContextAllowsPrinting");
                kCGPDFContextAllowsCopying       = Dlfcn.GetIntPtr(h, "kCGPDFContextAllowsCopying");
#if false
                kCGPDFContextOutputIntent        = Dlfcn.GetIntPtr(h, "kCGPDFContextOutputIntent");
                kCGPDFXOutputIntentSubtype       = Dlfcn.GetIntPtr(h, "kCGPDFXOutputIntentSubtype");
                kCGPDFXOutputConditionIdentifier = Dlfcn.GetIntPtr(h, "kCGPDFXOutputConditionIdentifier");
                kCGPDFXOutputCondition           = Dlfcn.GetIntPtr(h, "kCGPDFXOutputCondition");
                kCGPDFXRegistryName             = Dlfcn.GetIntPtr(h, "kCGPDFXRegistryName");
                kCGPDFXInfo                     = Dlfcn.GetIntPtr(h, "kCGPDFXInfo");
                kCGPDFXDestinationOutputProfile = Dlfcn.GetIntPtr(h, "kCGPDFXDestinationOutputProfile");
                kCGPDFContextOutputIntents      = Dlfcn.GetIntPtr(h, "kCGPDFContextOutputIntents");
#endif
            } finally {
                Dlfcn.dlclose(h);
            }
        }
Exemplo n.º 5
0
        static AudioSessionRouteChangeEventArgs()
        {
            var lib = Libraries.AudioToolbox.Handle;

            route_change_key   = Dlfcn.GetIntPtr(lib, "kAudioSession_RouteChangeKey_Reason");
            previous_route_key = Dlfcn.GetIntPtr(lib, "kAudioSession_AudioRouteChangeKey_PreviousRouteDescription");
            current_route_key  = Dlfcn.GetIntPtr(lib, "kAudioSession_AudioRouteChangeKey_CurrentRouteDescription");
        }
Exemplo n.º 6
0
		static AudioSessionRouteChangeEventArgs ()
		{
			var lib = Dlfcn.dlopen (Constants.AudioToolboxLibrary, 0);
			route_change_key = Dlfcn.GetIntPtr (lib, "kAudioSession_RouteChangeKey_Reason");
			previous_route_key = Dlfcn.GetIntPtr (lib, "kAudioSession_AudioRouteChangeKey_PreviousRouteDescription");
			current_route_key = Dlfcn.GetIntPtr (lib, "kAudioSession_AudioRouteChangeKey_CurrentRouteDescription");

			Dlfcn.dlclose (lib);
		}
 static JabbRApplicationHandler()
 {
     securityLibrary          = Dlfcn.dlopen(securityLibraryName, 0);
     kSecClassKey             = Dlfcn.GetIntPtr(securityLibrary, "kSecClass");
     kSecMatchLimit           = Dlfcn.GetIntPtr(securityLibrary, "kSecMatchLimit");
     kSecClassGenericPassword = Dlfcn.GetIntPtr(securityLibrary, "kSecClassGenericPassword");
     kSecAttrServer           = Dlfcn.GetIntPtr(securityLibrary, "kSecAttrServer");
     kSecAttrAccount          = Dlfcn.GetIntPtr(securityLibrary, "kSecAttrAccount");
 }
Exemplo n.º 8
0
        static CMMemoryPool()
        {
            var handle = Dlfcn.dlopen(Constants.CoreMediaLibrary, 0);

            try {
                AgeOutPeriodSelector = Dlfcn.GetIntPtr(handle, "kCMMemoryPoolOption_AgeOutPeriod");
            } finally {
                Dlfcn.dlclose(handle);
            }
        }
Exemplo n.º 9
0
        static void Init()
        {
            if (kLossyCompressionQuality != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Libraries.ImageIO.Handle;

            kLossyCompressionQuality = Dlfcn.GetIntPtr(lib, "kCGImageDestinationLossyCompressionQuality");
            kBackgroundColor         = Dlfcn.GetIntPtr(lib, "kCGImageDestinationBackgroundColor");
        }
Exemplo n.º 10
0
        static void Init()
        {
            if (kTypeIdentifierHint != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Libraries.ImageIO.Handle;

            kTypeIdentifierHint = Dlfcn.GetIntPtr(lib, "kCGImageSourceTypeIdentifierHint");
            kShouldCache        = Dlfcn.GetIntPtr(lib, "kCGImageSourceShouldCache");
            kShouldAllowFloat   = Dlfcn.GetIntPtr(lib, "kCGImageSourceShouldAllowFloat");
        }
        static void Init()
        {
            if (kLossyCompressionQuality != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            kLossyCompressionQuality = Dlfcn.GetIntPtr(lib, "kCGImageDestinationLossyCompressionQuality");
            kBackgroundColor         = Dlfcn.GetIntPtr(lib, "kCGImageDestinationBackgroundColor");
            Dlfcn.dlclose(lib);
        }
Exemplo n.º 12
0
        static void Init()
        {
            if (kCreateThumbnailWithTransform != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Libraries.ImageIO.Handle;

            kCreateThumbnailFromImageIfAbsent = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailFromImageIfAbsent");
            kCreateThumbnailFromImageAlways   = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailFromImageAlways");
            kThumbnailMaxPixelSize            = Dlfcn.GetIntPtr(lib, "kCGImageSourceThumbnailMaxPixelSize");
            kCreateThumbnailWithTransform     = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailWithTransform");
        }
Exemplo n.º 13
0
        static void Init()
        {
            if (kTypeIdentifierHint != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            kTypeIdentifierHint = Dlfcn.GetIntPtr(lib, "kCGImageSourceTypeIdentifierHint");
            kShouldCache        = Dlfcn.GetIntPtr(lib, "kCGImageSourceShouldCache");
            kShouldAllowFloat   = Dlfcn.GetIntPtr(lib, "kCGImageSourceShouldAllowFloat");
            Dlfcn.dlclose(lib);
        }
Exemplo n.º 14
0
        //static readonly IntPtr UseContextFlag;

        static CFAllocator()
        {
            var handle = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);

            try {
                default_ptr        = Dlfcn.GetIntPtr(handle, "kCFAllocatorDefault");
                system_default_ptr = Dlfcn.GetIntPtr(handle, "kCFAllocatorSystemDefault");
                malloc_ptr         = Dlfcn.GetIntPtr(handle, "kCFAllocatorMalloc");
                malloc_zone_ptr    = Dlfcn.GetIntPtr(handle, "kCFAllocatorMallocZone");
                null_ptr           = Dlfcn.GetIntPtr(handle, "kCFAllocatorNull");
                //	UseContextFlag = Dlfcn.GetIntPtr (handle, "kCFAllocatorUseContext");
            } finally {
                Dlfcn.dlclose(handle);
            }
        }
Exemplo n.º 15
0
        static CFBoolean()
        {
            var handle = Dlfcn.dlopen(Constants.CoreFoundationLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }
            try {
                True  = new CFBoolean(Dlfcn.GetIntPtr(handle, "kCFBooleanTrue"), false);
                False = new CFBoolean(Dlfcn.GetIntPtr(handle, "kCFBooleanFalse"), false);
            }
            finally {
                Dlfcn.dlclose(handle);
            }
        }
Exemplo n.º 16
0
        static void Init()
        {
            if (kCreateThumbnailWithTransform != IntPtr.Zero)
            {
                return;
            }

            IntPtr lib = Dlfcn.dlopen(Constants.ImageIOLibrary, 0);

            kCreateThumbnailFromImageIfAbsent = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailFromImageIfAbsent");
            kCreateThumbnailFromImageAlways   = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailFromImageAlways");
            kThumbnailMaxPixelSize            = Dlfcn.GetIntPtr(lib, "kCGImageSourceThumbnailMaxPixelSize");
            kCreateThumbnailWithTransform     = Dlfcn.GetIntPtr(lib, "kCGImageSourceCreateThumbnailWithTransform");

            Dlfcn.dlclose(lib);
        }
Exemplo n.º 17
0
        public static void Initialize(CFRunLoop runLoop, string runMode)
        {
            CFString s = runMode == null ? null : new CFString(runMode);
            int      k = AudioSessionInitialize(runLoop == null ? IntPtr.Zero : runLoop.Handle, s == null ? IntPtr.Zero : s.Handle, Interruption, IntPtr.Zero);

            if (k != 0 && k != (int)AudioSessionErrors.AlreadyInitialized)
            {
                throw new AudioSessionException(k);
            }

            if (initialized)
            {
                return;
            }

            IntPtr lib = Dlfcn.dlopen(Constants.AudioToolboxLibrary, 0);

            AudioRouteKey_Inputs  = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_AudioRouteKey_Inputs"));
            AudioRouteKey_Outputs = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_AudioRouteKey_Outputs"));
            AudioRouteKey_Type    = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_AudioRouteKey_Type"));

            InputRoute_LineIn       = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionInputRoute_LineIn"));
            InputRoute_BuiltInMic   = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionInputRoute_BuiltInMic"));
            InputRoute_HeadsetMic   = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionInputRoute_HeadsetMic"));
            InputRoute_BluetoothHFP = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionInputRoute_BluetoothHFP"));
            InputRoute_USBAudio     = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionInputRoute_USBAudio"));

            OutputRoute_LineOut         = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_LineOut"));
            OutputRoute_Headphones      = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_Headphones"));
            OutputRoute_BluetoothHFP    = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_BluetoothHFP"));
            OutputRoute_BluetoothA2DP   = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_BluetoothA2DP"));
            OutputRoute_BuiltInReceiver = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_BuiltInReceiver"));
            OutputRoute_BuiltInSpeaker  = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_BuiltInSpeaker"));
            OutputRoute_USBAudio        = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_USBAudio"));
            OutputRoute_HDMI            = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_HDMI"));
            OutputRoute_AirPlay         = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSessionOutputRoute_AirPlay"));

            InputSourceKey_ID          = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_InputSourceKey_ID"));
            InputSourceKey_Description = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_InputSourceKey_Description"));

            OutputDestinationKey_ID          = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_OutputDestinationKey_ID"));
            OutputDestinationKey_Description = new NSString(Dlfcn.GetIntPtr(lib, "kAudioSession_OutputDestinationKey_Description"));

            Dlfcn.dlclose(lib);

            initialized = true;
        }
Exemplo n.º 18
0
        // On load, construct the CIRawFilter
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var asset = Asset;

            if (asset == null)
            {
                return;
            }

            // Setup options to request original image.
            var options = new PHImageRequestOptions {
                Version     = PHImageRequestOptionsVersion.Original,
                Synchronous = true
            };

            // Request the image data and UTI type for the image.
            PHImageManager.DefaultManager.RequestImageData(asset, options, (imageData, dataUTI, _, __) => {
                if (imageData == null || dataUTI == null)
                {
                    return;
                }

                // Create a CIRawFilter from original image data.
                // UTI type is passed in to provide the CIRawFilter with a hint about the UTI type of the Raw file.
                //var rawOptions = [String (kCGImageSourceTypeIdentifierHint) : dataUTI ]
                var rawOptions     = new NSMutableDictionary();
                var imageIOLibrary = Dlfcn.dlopen("/System/Library/Frameworks/ImageIO.framework/ImageIO", 0);
                var key            = Dlfcn.GetIntPtr(imageIOLibrary, "kCGImageSourceTypeIdentifierHint");
                rawOptions.LowlevelSetObject(dataUTI, key);

                ciRawFilter = CIFilter.CreateRawFilter(imageData, rawOptions);
                if (ciRawFilter == null)
                {
                    return;
                }

                // Get the native size of the image produced by the CIRawFilter.
                var sizeValue = ciRawFilter.ValueForKey(Keys.kCIOutputNativeSizeKey) as CIVector;
                if (sizeValue != null)
                {
                    imageNativeSize = new CGSize(sizeValue.X, sizeValue.Y);
                }

                // Record the original value of the temperature, and setup the editing slider.
                var tempValue = (NSNumber)ciRawFilter.ValueForKey(Keys.kCIInputNeutralTemperatureKey);
                if (tempValue != null)
                {
                    originalTemp = tempValue.FloatValue;
                    TempSlider.SetValue(tempValue.FloatValue, animated: false);
                }

                // Record the original value of the tint, and setup the editing slider.
                var tintValue = (NSNumber)ciRawFilter.ValueForKey(Keys.kCIInputNeutralTintKey);
                if (tintValue != null)
                {
                    originalTint = tintValue.FloatValue;
                    TintSlider.SetValue(tintValue.FloatValue, animated: false);
                }
            });

            // Create EAGL context used to render the CIImage produced by the CIRawFilter to display.
            ImageView.Context = new EAGLContext(EAGLRenderingAPI.OpenGLES3);
            ciContext         = CIContext.FromContext(ImageView.Context, new CIContextOptions {
                CIImageFormat = CIImage.FormatRGBAh
            });
        }