~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/CoreImage/CIImage.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#if !MONOMAC
29
29
using MonoTouch.UIKit;
30
30
using MonoTouch.CoreGraphics;
 
31
#else
 
32
using MonoMac.CoreGraphics;
31
33
#endif
32
34
 
33
35
namespace MonoMac.CoreImage {
99
101
                        }
100
102
                        return ret;
101
103
                }
 
104
 
 
105
                public static CIImage FromCGImage (CGImage image, CGColorSpace colorSpace)
 
106
                {
 
107
                        if (colorSpace == null)
 
108
                                throw new ArgumentNullException ("colorSpace");
 
109
                        
 
110
                        using (var arr = NSArray.FromIntPtrs (new IntPtr [] { colorSpace.Handle })){
 
111
                                using (var keys = NSArray.FromIntPtrs (new IntPtr [] { CIImageColorSpaceKey.Handle } )){
 
112
                                        using (var dict = NSDictionary.FromObjectsAndKeysInternal (arr, keys)){
 
113
                                                return FromCGImage (image, dict);
 
114
                                        }
 
115
                                }
 
116
                        }
 
117
                }
102
118
                
103
119
                public CIFilter [] GetAutoAdjustmentFilters ()
104
120
                {
114
130
                                return GetAutoAdjustmentFilters ();
115
131
                        return WrapFilters (_GetAutoAdjustmentFilters (dict));
116
132
                }
117
 
        }
 
133
 
 
134
                public static implicit operator CIImage (CGImage image)
 
135
                {
 
136
                        return FromCGImage (image);
 
137
                }
 
138
                
 
139
                internal static int CIFormatToInt (CIFormat format)
 
140
                {
 
141
                        switch (format) {
 
142
#if MONOMAC
 
143
                        case CIFormat.ARGB8: return FormatARGB8;                        
 
144
                        case CIFormat.RGBAh: return FormatRGBAh;
 
145
                        case CIFormat.RGBA16: return FormatRGBA16;
 
146
                        case CIFormat.RGBAf: return FormatRGBAf;
 
147
#else
 
148
                        case CIFormat.ARGB8: return FormatARGB8;
 
149
                        case CIFormat.RGBAh: return FormatRGBAh;
 
150
                        case CIFormat.BGRA8: return FormatBGRA8;
 
151
                        case CIFormat.RGBA8: return FormatRGBA8;
 
152
#endif
 
153
                        default:
 
154
                                throw new ArgumentOutOfRangeException ("format");
 
155
                        }
 
156
                }
 
157
        }
 
158
#if MONOMAC
 
159
    public enum CIFormat {
 
160
                ARGB8,
 
161
                RGBAh,
 
162
                RGBA16,
 
163
                RGBAf
 
164
        }
 
165
#else
 
166
        public enum CIFormat {
 
167
                ARGB8,
 
168
                RGBAh,
 
169
                BGRA8,
 
170
                RGBA8,
 
171
        }
 
172
#endif
118
173
}
 
 
b'\\ No newline at end of file'