public void EnumerateMetafile(Metafile metafile, Point destPoint,
                                      Rectangle srcRect, GraphicsUnit unit,
                                      EnumerateMetafileProc callback, IntPtr callbackData,
                                      ImageAttributes imageAttr) {
            IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
            IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);

            GPPOINT gppoint = new GPPOINT(destPoint);
            GPRECT gprect = new GPRECT(srcRect);

            int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPointI(new HandleRef(this, this.NativeGraphics),
                                                                        new HandleRef(metafile, mf),
                                                                        gppoint,
                                                                        ref gprect,
                                                                        unchecked((int) unit),
                                                                        callback,
                                                                        new HandleRef(null, callbackData),
                                                                        new HandleRef(imageAttr, ia));

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
        }
Exemple #2
0
            //----------------------------------------------------------------------------------------                                                           
            // Helper function:  Convert GpPoint* memory block to Point[]
            //----------------------------------------------------------------------------------------
            internal static Point[] ConvertGPPOINTArray(IntPtr memory, int count) {
                if (memory == IntPtr.Zero)
                    throw new ArgumentNullException("memory");

                Point[] points = new Point[count];

                int index;
                GPPOINT pt = new GPPOINT();

                int size = (int)Marshal.SizeOf(pt.GetType());

                for (index=0; index < count; index++) {
                    pt = (GPPOINT)  UnsafeNativeMethods.PtrToStructure((IntPtr)((long)memory+index*size), pt.GetType());
                    points[index] = new Point( (int)pt.X, (int) pt.Y);
                }

                return points;
            }
Exemple #3
0
 internal static extern int GdipEnumerateMetafileSrcRectDestPointI(HandleRef graphics,
                                                                   HandleRef metafile,
                                                                   GPPOINT destPoint,
                                                                   ref GPRECT srcRect,
                                                                   int pageUnit,
                                                                   Graphics.EnumerateMetafileProc callback,
                                                                   HandleRef callbackdata,
                                                                   HandleRef imageattributes);
Exemple #4
0
 internal static extern int GdipEnumerateMetafileDestPointI(HandleRef graphics,
                                                            HandleRef metafile,
                                                            GPPOINT destPoint,
                                                            Graphics.EnumerateMetafileProc callback,
                                                            HandleRef callbackdata,
                                                            HandleRef imageattributes);
Exemple #5
0
 internal static extern int GdipCreateLineBrushI(GPPOINT point1, GPPOINT point2, int color1, int color2, int wrapMode, out IntPtr lineGradient);
 internal static Point[] ConvertGPPOINTArray(IntPtr memory, int count)
 {
     if (memory == IntPtr.Zero)
     {
         throw new ArgumentNullException("memory");
     }
     Point[] pointArray = new Point[count];
     GPPOINT gppoint = new GPPOINT();
     int num2 = Marshal.SizeOf(gppoint.GetType());
     for (int i = 0; i < count; i++)
     {
         gppoint = (GPPOINT) UnsafeNativeMethods.PtrToStructure((IntPtr) (((long) memory) + (i * num2)), gppoint.GetType());
         pointArray[i] = new Point(gppoint.X, gppoint.Y);
     }
     return pointArray;
 }