Example #1
0
        static public CGColor?CreateByMatchingToColorSpace(CGColorSpace space, CGColorRenderingIntent intent,
                                                           CGColor color, NSDictionary options)
        {
            var h = CGColorCreateCopyByMatchingToColorSpace(space.GetHandle(), intent, color.GetHandle(), options.GetHandle());

            return(h == IntPtr.Zero ? null : new CGColor(h, owns: true));
        }
Example #2
0
        public CGImage(nint width, nint height, nint bitsPerComponent, nint bitsPerPixel, nint bytesPerRow,
                       CGColorSpace colorSpace, CGBitmapFlags bitmapFlags, CGDataProvider provider,
                       nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            if (colorSpace == null)
            {
                throw new ArgumentNullException("colorSpace");
            }
            if (width < 0)
            {
                throw new ArgumentException("width");
            }
            if (height < 0)
            {
                throw new ArgumentException("height");
            }
            if (bitsPerPixel < 0)
            {
                throw new ArgumentException("bitsPerPixel");
            }
            if (bitsPerComponent < 0)
            {
                throw new ArgumentException("bitsPerComponent");
            }
            if (bytesPerRow < 0)
            {
                throw new ArgumentException("bytesPerRow");
            }

            handle = CGImageCreate(new IntPtr(width), new IntPtr(height), new IntPtr(bitsPerComponent),
                                   new IntPtr(bitsPerPixel), new IntPtr(bytesPerRow),
                                   colorSpace.Handle, bitmapFlags, provider == null ? IntPtr.Zero : provider.Handle,
                                   decode,
                                   shouldInterpolate, intent);
        }
Example #3
0
        public CGImage(int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow,
                       CGColorSpace colorSpace, CGImageAlphaInfo alphaInfo, CGDataProvider provider,
                       nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            if (width < 0)
            {
                throw new ArgumentException("width");
            }
            if (height < 0)
            {
                throw new ArgumentException("height");
            }
            if (bitsPerPixel < 0)
            {
                throw new ArgumentException("bitsPerPixel");
            }
            if (bitsPerComponent < 0)
            {
                throw new ArgumentException("bitsPerComponent");
            }
            if (bytesPerRow < 0)
            {
                throw new ArgumentException("bytesPerRow");
            }

            handle = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow,
                                   colorSpace == null ? IntPtr.Zero : colorSpace.Handle, (CGBitmapFlags)alphaInfo, provider == null ? IntPtr.Zero : provider.Handle,
                                   decode,
                                   shouldInterpolate, intent);
        }
Example #4
0
 extern static IntPtr CGImageCreate(IntPtr size_t_width, IntPtr size_t_height, IntPtr size_t_bitsPerComponent,
                                    IntPtr size_t_bitsPerPixel, IntPtr size_t_bytesPerRow,
                                    IntPtr /* CGColorSpaceRef */ space,
                                    CGBitmapFlags bitmapInfo,
                                    IntPtr /* CGDataProviderRef */ provider,
                                    nfloat [] decode,
                                    bool shouldInterpolate,
                                    CGColorRenderingIntent intent);
Example #5
0
        static CGColor CreateByMatchingToColorSpace(CGColorSpace space, CGColorRenderingIntent intent,
                                                    CGColor color, NSDictionary options)
        {
            var h = CGColorCreateCopyByMatchingToColorSpace(space == null ? IntPtr.Zero : space.Handle, intent,
                                                            color == null ? IntPtr.Zero : color.Handle, options == null ? IntPtr.Zero : options.Handle);

            return(h == IntPtr.Zero ? null : new CGColor(h));
        }
Example #6
0
        partial void ScreenButton_down(UIButton sender)
        {
            if (!isScreen)
            {
                ScreenshotView.Hidden = false;
                ScreenBtn.SetTitle("Hide screen", UIControlState.Normal);
                isScreen = true;

                int    val = 1920 * 1080 * 4 + 8;              //ARGB 1920x1080 + 8(iosspecific)
                IntPtr b   = Marshal.AllocHGlobal(val);


                int val1 = -1;                 //return realsize after getvideoshot
                int val2 = -1;                 //return realsize after getvideoshot
                int val3 = 0;                  //return realsize after getvideoshot

                int rc = _mediaPlayer.GetVideoShot(b, ref val, ref val1, ref val2, ref val3);
                if (rc == -2)
                {
                    System.Console.WriteLine(String.Format("<binary> rc: {0} , not enough space allocated", rc));
                    Marshal.FreeHGlobal(b);
                    return;
                }
                else if (rc == -1)
                {
                    System.Console.WriteLine(String.Format("<binary> rc: {0} , error", rc));
                    Marshal.FreeHGlobal(b);
                    return;
                }


                CGDataProvider provider         = new CGDataProvider(b, val);
                int            bitsPerComponent = 8;
                int            bitsPerPixel     = 32;
                int            bytesPerRow      = val3;

                CGColorSpace           colorspaceref = CGColorSpace.CreateDeviceRGB();
                CGBitmapFlags          bitmapinfo    = CGBitmapFlags.ByteOrder32Little | CGBitmapFlags.NoneSkipFirst;
                CGColorRenderingIntent renderintent  = CGColorRenderingIntent.Default;
                CGImage imageref = new CGImage(val1, val2, bitsPerComponent, bitsPerPixel, val3, colorspaceref, bitmapinfo, provider, null, true, renderintent);

                UIImage img = new UIImage(imageref);
                ScrenShotImageView.Image = img;
                Marshal.FreeHGlobal(b);
            }
            else
            {
                ScreenBtn.SetTitle("Screen", UIControlState.Normal);
                ScreenshotView.Hidden = true;
                isScreen = false;
            }
        }
Example #7
0
		extern static /* CGImageRef */ IntPtr CGImageCreateWithPNGDataProvider (/* CGDataProviderRef */ IntPtr source,
			/* CGFloat[] */ nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent);
Example #8
0
 public void SetRenderingIntent(CGColorRenderingIntent intent)
 {
     CGContextSetRenderingIntent(handle, intent);
 }
Example #9
0
 extern static void CGContextSetRenderingIntent(IntPtr context, CGColorRenderingIntent intent);
Example #10
0
 extern static /* CGImageRef */ IntPtr CGImageCreateWithJPEGDataProvider(/* CGDataProviderRef */ IntPtr source,
                                                                         /* CGFloat[] */ nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent);
Example #11
0
		extern static IntPtr CGImageCreate(int size_t_width, int size_t_height, int size_t_bitsPerComponent,
						   int size_t_bitsPerPixel, int size_t_bytesPerRow,
						   IntPtr /* CGColorSpaceRef */ space,
						   CGBitmapFlags bitmapInfo,
						   IntPtr /* CGDataProviderRef */ provider,
						   float [] decode,
						   bool shouldInterpolate,
						   CGColorRenderingIntent intent);
Example #12
0
 extern static /* CGImageRef */ IntPtr CGImageCreateWithPNGDataProvider(/* CGDataProviderRef */ IntPtr source,
                                                                        /* CGFloat[] */ nfloat [] decode, [MarshalAs(UnmanagedType.I1)] bool shouldInterpolate, CGColorRenderingIntent intent);
Example #13
0
 extern static /* CGImageRef */ IntPtr CGImageCreate(/* size_t */ nint width, /* size_t */ nint height,
                                                     /* size_t */ nint bitsPerComponent, /* size_t */ nint bitsPerPixel, /* size_t */ nint bytesPerRow,
                                                     /* CGColorSpaceRef */ IntPtr space, CGBitmapFlags bitmapInfo, /* CGDataProviderRef */ IntPtr provider,
                                                     /* CGFloat[] */ nfloat [] decode, [MarshalAs(UnmanagedType.I1)] bool shouldInterpolate, CGColorRenderingIntent intent);
Example #14
0
 extern static IntPtr CGImageCreateWithPNGDataProvider(IntPtr /*CGDataProviderRef*/ source,
                                                       nfloat [] decode, bool shouldInterpolate,
                                                       CGColorRenderingIntent intent);
Example #15
0
		extern static IntPtr CGImageCreateWithPNGDataProvider(IntPtr /*CGDataProviderRef*/ source,
								      float [] decode, bool shouldInterpolate,
								      CGColorRenderingIntent intent);
Example #16
0
		public CGImage (int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow,
				CGColorSpace colorSpace, CGImageAlphaInfo alphaInfo, CGDataProvider provider,
				nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
		{
			if (width < 0)
				throw new ArgumentException ("width");
			if (height < 0)
				throw new ArgumentException ("height");
			if (bitsPerPixel < 0)
				throw new ArgumentException ("bitsPerPixel");
			if (bitsPerComponent < 0)
				throw new ArgumentException ("bitsPerComponent");
			if (bytesPerRow < 0)
				throw new ArgumentException ("bytesPerRow");

			handle = CGImageCreate (width, height, bitsPerComponent, bitsPerPixel, bytesPerRow,
						colorSpace == null ? IntPtr.Zero : colorSpace.Handle, (CGBitmapFlags) alphaInfo, provider == null ? IntPtr.Zero : provider.Handle,
						decode,
						shouldInterpolate, intent);
		}
Example #17
0
		extern static /* CGImageRef */ IntPtr CGImageCreate (/* size_t */ nint width, /* size_t */ nint height, 
			/* size_t */ nint bitsPerComponent, /* size_t */ nint bitsPerPixel, /* size_t */ nint bytesPerRow,
			/* CGColorSpaceRef */ IntPtr space, CGBitmapFlags bitmapInfo, /* CGDataProviderRef */ IntPtr provider,
			/* CGFloat[] */ nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent);
Example #18
0
		public static CGImage FromPNG (CGDataProvider provider, float [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
		{
			if (provider == null)
				throw new ArgumentNullException ("provider");
			
			var handle = CGImageCreateWithPNGDataProvider (provider.Handle, decode, shouldInterpolate, intent);
			if (handle == IntPtr.Zero)
				return null;

			return new CGImage (handle, true);
		}
Example #19
0
 static extern IntPtr CGColorConverterCreate(/* __nullable CFDictionaryRef */ IntPtr options, 
     /* CGColorSpaceRef __nullable */ IntPtr space1, CGColorConverterTransformType transform1, CGColorRenderingIntent intent1,
     /* CGColorSpaceRef __nullable */ IntPtr space2, CGColorConverterTransformType transform2, CGColorRenderingIntent intent2,
     /* CGColorSpaceRef __nullable */ IntPtr space3, CGColorConverterTransformType transform3, CGColorRenderingIntent intent3,
     IntPtr lastSpaceMarker);
Example #20
0
        public static CGImage FromJPEG(CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            var handle = CGImageCreateWithJPEGDataProvider(provider.Handle, decode, shouldInterpolate, intent);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            return(new CGImage(handle, true));
        }
Example #21
0
		public static CGImage FromPNG (CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
		{
			var handle = CGImageCreateWithPNGDataProvider (provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate, intent);
			if (handle == IntPtr.Zero)
				return null;

			return new CGImage (handle, true);
		}
Example #22
0
 static extern /* CGColorRef __nullable */ IntPtr CGColorCreateCopyByMatchingToColorSpace(
     /* __nullable CGColorSpaceRef* */ IntPtr space, CGColorRenderingIntent intent,
     /* CGColorRef __nullable */ IntPtr color, /* __nullable CFDictionaryRef */ IntPtr options);
Example #23
0
		static extern /* CGColorRef __nullable */ IntPtr CGColorCreateCopyByMatchingToColorSpace (
			/* __nullable CGColorSpaceRef* */ IntPtr space, CGColorRenderingIntent intent,
			/* CGColorRef __nullable */ IntPtr color, /* __nullable CFDictionaryRef */ IntPtr options);
 extern static /* CGColorConversionInfoRef __nullable */ IntPtr CGColorConversionInfoCreateFromList(/* __nullable CFDictionaryRef */ IntPtr options,
                                                                                                    /* CGColorSpaceRef __nullable */ IntPtr space1, CGColorConversionInfoTransformType transform1, CGColorRenderingIntent intent1,
                                                                                                    /* CGColorSpaceRef __nullable */ IntPtr space2, CGColorConversionInfoTransformType transform2, CGColorRenderingIntent intent2,
                                                                                                    /* CGColorSpaceRef __nullable */ IntPtr space3, CGColorConversionInfoTransformType transform3, CGColorRenderingIntent intent3,
                                                                                                    IntPtr lastSpaceMarker);
Example #25
0
		static CGColor CreateByMatchingToColorSpace (CGColorSpace space, CGColorRenderingIntent intent,
			CGColor color, NSDictionary options)
		{
			var h = CGColorCreateCopyByMatchingToColorSpace (space == null ? IntPtr.Zero : space.Handle, intent,
				color == null ? IntPtr.Zero : color.Handle, options == null ? IntPtr.Zero : options.Handle);
			return h == IntPtr.Zero ? null : new CGColor (h);
		}
Example #26
0
		extern static void CGContextSetRenderingIntent(IntPtr context, CGColorRenderingIntent intent);
Example #27
0
		public void SetRenderingIntent (CGColorRenderingIntent intent)
		{
			CGContextSetRenderingIntent (handle, intent);
		}
Example #28
0
        public static CGImage FromPNG(CGDataProvider provider, nfloat [] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            var handle = CGImageCreateWithPNGDataProvider(provider == null ? IntPtr.Zero : provider.Handle, decode, shouldInterpolate, intent);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            return(new CGImage(handle, true));
        }
Example #29
0
        CGImage NewCGImage(int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow, CGColorSpace colorSpace, CGBitmapFlags bitmapFlags, CGDataProvider provider, nfloat[] decode, bool shouldInterpolate, CGColorRenderingIntent intent)
        {
            var image = new CGImage(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, bitmapFlags, dataProvider, decode, shouldInterpolate, intent);

            if (image == null)
            {
                var e = new ArgumentException("Failed to create CGImage");
                e.Data["width"]             = width;
                e.Data["height"]            = height;
                e.Data["bitsPerComponent"]  = bitsPerComponent;
                e.Data["bitsPerPixel"]      = bitsPerPixel;
                e.Data["bytesPerRow"]       = bytesPerRow;
                e.Data["colorSpace"]        = colorSpace;
                e.Data["bitmapFlags"]       = bitmapFlags;
                e.Data["dataProvider"]      = dataProvider;
                e.Data["decode"]            = decode;
                e.Data["shouldInterpolate"] = shouldInterpolate;
                e.Data["intent"]            = intent;
            }
            return(image);
        }