Beispiel #1
0
        static void ApplierCallback(IntPtr info, IntPtr element_ptr)
        {
            GCHandle gch = GCHandle.FromIntPtr(info);
            // note: CGPathElementType is an untyped enum, always 32bits
            CGPathElement   element = new CGPathElement(Marshal.ReadInt32(element_ptr, 0));
            ApplierFunction func    = (ApplierFunction)gch.Target;

            IntPtr ptr    = Marshal.ReadIntPtr(element_ptr, IntPtr.Size);
            int    ptsize = Marshal.SizeOf(typeof(CGPoint));

            switch (element.Type)
            {
            case CGPathElementType.CloseSubpath:
                break;

            case CGPathElementType.MoveToPoint:
            case CGPathElementType.AddLineToPoint:
                element.Point1 = (CGPoint)Marshal.PtrToStructure(ptr, typeof(CGPoint));
                break;

            case CGPathElementType.AddQuadCurveToPoint:
                element.Point1 = (CGPoint)Marshal.PtrToStructure(ptr, typeof(CGPoint));
                element.Point2 = (CGPoint)Marshal.PtrToStructure(((IntPtr)(((long)ptr) + ptsize)), typeof(CGPoint));
                break;

            case CGPathElementType.AddCurveToPoint:
                element.Point1 = (CGPoint)Marshal.PtrToStructure(ptr, typeof(CGPoint));
                element.Point2 = (CGPoint)Marshal.PtrToStructure(((IntPtr)(((long)ptr) + ptsize)), typeof(CGPoint));
                element.Point3 = (CGPoint)Marshal.PtrToStructure(((IntPtr)(((long)ptr) + (2 * ptsize))), typeof(CGPoint));
                break;
            }

            func(element);
        }
Beispiel #2
0
        public void Apply(ApplierFunction func)
        {
            GCHandle gch = GCHandle.Alloc(func);

            CGPathApply(handle, GCHandle.ToIntPtr(gch), ApplierCallback);
            gch.Free();
        }
Beispiel #3
0
		extern static void CGPDFDictionaryApplyFunction (/* CGPDFDictionaryRef */ IntPtr dic, ApplierFunction function, /* void* */ IntPtr info);
Beispiel #4
0
		public void Apply (ApplierFunction func)
		{
			GCHandle gch = GCHandle.Alloc (func);
			CGPathApply (handle, GCHandle.ToIntPtr (gch), ApplierCallback);
			gch.Free ();
		}
Beispiel #5
0
		extern static void CGPDFDictionaryApplyFunction (IntPtr dictRef, ApplierFunction function, IntPtr info);
Beispiel #6
0
 extern static void CGPDFDictionaryApplyFunction(/* CGPDFDictionaryRef */ IntPtr dic, ApplierFunction function, /* void* */ IntPtr info);
Beispiel #7
0
 extern static void CGPDFDictionaryApplyFunction(IntPtr dictRef, ApplierFunction function, IntPtr info);