Exemplo n.º 1
0
		public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) :
			this (referenceHdc, frameRect, frameUnit, type, null)
		{
		}
Exemplo n.º 2
0
		public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) :
			this (fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null)
		{
		}
Exemplo n.º 3
0
		private void RecordFileName (IntPtr hdc, EmfType type, MetafileFrameUnit unit)
		{
			string filename = String.Format ("test-{0}-{1}.emf", type, unit);
			IntPtr metafile;
			RectangleF rect = new RectangleF (10, 20, 100, 200);
			Status status = GDIPlus.GdipRecordMetafileFileName (filename, hdc, type, ref rect, unit, filename, out metafile);
			if (metafile != IntPtr.Zero)
				GDIPlus.GdipDisposeImage (metafile);
			if (status == Status.Ok)
				File.Delete (filename);
			Assert.AreEqual (Status.Ok, status, filename);
		}
Exemplo n.º 4
0
	public Metafile(String fileName, IntPtr referenceHdc,
					Rectangle frameRect, MetafileFrameUnit frameUnit,
					EmfType type, String description)
			{
				// TODO
			}
Exemplo n.º 5
0
        public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit,
                        EmfType type, string description)
        {
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            int status;

            if (frameRect.IsEmpty) {
                status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), 
                                                          new HandleRef(null, referenceHdc), 
                                                          unchecked((int)type),
                                                          NativeMethods.NullHandleRef, 
                                                          unchecked((int)frameUnit), 
                                                          description, 
                                                          out metafile);
            }
            else {
                GPRECT gprect = new GPRECT(frameRect);
                status = SafeNativeMethods.Gdip.GdipRecordMetafileStreamI(new GPStream(stream), 
                                                           new HandleRef(null, referenceHdc), 
                                                           unchecked((int)type),
                                                           ref gprect, 
                                                           unchecked((int)frameUnit), 
                                                           description, 
                                                           out metafile);
            }

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }
Exemplo n.º 6
0
		internal static extern Status GdipRecordMetafileStreamI ([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, IntPtr hdc, 
			EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) :
     this(fileName, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string?description) :
     this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, description)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class from the specified device context, bounded
 /// by the specified rectangle.
 /// </summary>
 public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) :
     this(referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) :
     this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class from the specified device context, bounded
 /// by the specified rectangle.
 /// </summary>
 public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) :
     this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
 {
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) :
     this(stream, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) :
     this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual)
 {
 }
Exemplo n.º 14
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type) : this (fileName, referenceHdc, frameRect, frameUnit, type, null)
		{
		}
Exemplo n.º 15
0
		public Metafile(System.IO.Stream stream, System.IntPtr ptr, Drawing.RectangleF rect, MetafileFrameUnit unit)
		{
			
			throw new NotImplementedException();
		}
Exemplo n.º 16
0
		public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, 
			EmfType type, string description) 
		{
			if (stream == null)
				throw new NullReferenceException ("stream");

			Status status = Status.NotImplemented;
			if (GDIPlus.RunningOnUnix ()) {
				// With libgdiplus we use a custom API for this, because there's no easy way
				// to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates.
				GDIPlus.GdiPlusStreamHelper sh = new GDIPlus.GdiPlusStreamHelper (stream, false);
				status = GDIPlus.GdipRecordMetafileFromDelegate_linux (sh.GetHeaderDelegate, sh.GetBytesDelegate, 
					sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, referenceHdc, 
					type, ref frameRect, frameUnit, description, out nativeObject);
			} else {
				status = GDIPlus.GdipRecordMetafileStream (new ComIStreamWrapper (stream), referenceHdc, 
					type, ref frameRect, frameUnit, description, out nativeObject);
			}
			GDIPlus.CheckStatus (status);
		}
 public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
 {
     int num;
     System.Drawing.IntSecurity.DemandReadFileIO(fileName);
     System.Drawing.IntSecurity.ObjectFromWin32Handle.Demand();
     IntPtr zero = IntPtr.Zero;
     if (frameRect.IsEmpty)
     {
         num = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc), (int) type, System.Drawing.NativeMethods.NullHandleRef, (int) frameUnit, description, out zero);
     }
     else
     {
         GPRECT gprect = new GPRECT(frameRect);
         num = SafeNativeMethods.Gdip.GdipRecordMetafileFileNameI(fileName, new HandleRef(null, referenceHdc), (int) type, ref gprect, (int) frameUnit, description, out zero);
     }
     if (num != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(num);
     }
     base.SetNativeImage(zero);
 }
Exemplo n.º 18
0
        public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect,
                        MetafileFrameUnit frameUnit, EmfType type, String description)
        {
            IntSecurity.DemandReadFileIO(fileName);
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            GPRECTF rectf = new GPRECTF(frameRect);
            int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, 
                                                            new HandleRef(null, referenceHdc), 
                                                            unchecked((int)type), 
                                                            ref rectf,
                                                            unchecked((int)frameUnit), 
                                                            description, 
                                                            out metafile);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
 {
     System.Drawing.IntSecurity.DemandReadFileIO(fileName);
     System.Drawing.IntSecurity.ObjectFromWin32Handle.Demand();
     IntPtr zero = IntPtr.Zero;
     GPRECTF gprectf = new GPRECTF(frameRect);
     int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc), (int) type, ref gprectf, (int) frameUnit, description, out zero);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     base.SetNativeImage(zero);
 }
Exemplo n.º 20
0
		internal static extern Status GdipRecordMetafileFileNameI ([MarshalAs (UnmanagedType.LPWStr)] string filename, IntPtr hdc, EmfType type,
			ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
Exemplo n.º 21
0
		public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) 
		{
			throw new NotImplementedException ();
		}
Exemplo n.º 22
0
		static internal extern Status GdipRecordMetafileFromDelegateI_linux (StreamGetHeaderDelegate getHeader, 
			StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, 
			StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect, 
			MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
Exemplo n.º 23
0
		public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) 
		{
			throw new NotImplementedException ();
		}
Exemplo n.º 24
0
		private Status RecordFileName_EmptyRectangle (IntPtr hdc, MetafileFrameUnit unit)
		{
			string filename = String.Format ("emptyrectangle-{0}.emf", unit);
			IntPtr metafile = IntPtr.Zero;
			RectangleF empty = new RectangleF ();
			Status status = GDIPlus.GdipRecordMetafileFileName (filename, hdc, EmfType.EmfPlusDual, ref empty, unit, filename, out metafile);
			if (metafile != IntPtr.Zero)
				GDIPlus.GdipDisposeImage (metafile);
			if (status == Status.Ok)
				File.Delete (filename);
			return status;
		}
Exemplo n.º 25
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type,
															string description) 
		{
			throw new NotImplementedException ();
		}
Exemplo n.º 26
0
		public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) :
			this (referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null)
		{
		}
	public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) {}
Exemplo n.º 28
0
		public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) :
			this (stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null)
		{
		}
	public Metafile(string fileName, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, MetafileFrameUnit frameUnit, string description) {}
Exemplo n.º 30
0
		public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type) : this (stream, referenceHdc, frameRect, frameUnit, type, null)
		{
		}
	public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, MetafileFrameUnit frameUnit) {}
Exemplo n.º 32
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, 
			string description) : this (fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual,
			description) 
		{
		}
	public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) {}
Exemplo n.º 34
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type, string description) 
		{
			Status status = GDIPlus.GdipRecordMetafileFileName (fileName, referenceHdc, type, ref frameRect, frameUnit, 
				description, out nativeObject);
			GDIPlus.CheckStatus (status);
		}
Exemplo n.º 35
0
 internal static extern int GdipRecordMetafileStreamI(Interop.Ole32.IStream stream, IntPtr referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile);