Example #1
0
        /// <summary>
        /// <para>Constructs a new <see cref="T:Xsharp.Image"/> instance
        /// that represents an off-screen image that was loaded
        /// from a file.</para>
        /// </summary>
        ///
        /// <param name="screen">
        /// <para>The screen upon which to create the new pixmap.</para>
        /// </param>
        ///
        /// <param name="filename">
        /// <para>The file to load the image from.</para>
        /// </param>
        ///
        /// <exception cref="T:System.ArgumentNullException">
        /// <para>The <paramref name="filename"/> parameter is
        /// <see langword="null"/>.</para>
        /// </exception>
        ///
        /// <exception cref="T:System.FormatException">
        /// <para>The image format is not recognized.</para>
        /// </exception>
        ///
        /// <exception cref="T:Xsharp.XInvalidOperationException">
        /// <para>Raised if <paramref name="filename"/> could not be
        /// loaded for some reason.</para>
        /// </exception>
        public Image(Screen screen, String filename)
        {
            Display dpy;

            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }
            if (screen != null)
            {
                dpy = screen.DisplayOfScreen;
            }
            else
            {
                dpy    = Application.Primary.Display;
                screen = dpy.DefaultScreenOfDisplay;
            }
            this.screen = screen;
            DotGNU.Images.Image img = new DotGNU.Images.Image();
            img.Load(filename);
            Frame frame = img.GetFrame(0);

            try
            {
                dpy.Lock();
                pixmapXImage = ConvertImage.FrameToXImage(screen, frame);
                maskXImage   = ConvertImage.MaskToXImage(screen, frame);
            }
            finally
            {
                dpy.Unlock();
            }
        }
Example #2
0
 // Load the icon contents from a stream, and then set the
 // current frame to the first one in the icon image.
 private void Load(Stream stream)
 {
     image = new DotGNU.Images.Image();
     image.Load(stream);
     frame    = image.GetFrame(0);
     frameNum = 0;
 }
Example #3
0
 public static Image FromStream
     (Stream stream, bool useEmbeddedColorManagement)
 {
     DotGNU.Images.Image image = new DotGNU.Images.Image();
     image.Load(stream);
     return(new Bitmap(image));
 }
Example #4
0
 public static Image FromFile
     (String filename, bool useEmbeddedColorManagement)
 {
     DotGNU.Images.Image image = new DotGNU.Images.Image();
     image.Load(filename);
     return(new Bitmap(image));
 }
Example #5
0
	internal Image(SerializationInfo info, StreamingContext context)
			{
				// Do we need to Handle PixelFormats ?.
				byte[] data = null;
				data = (byte[])info.GetValue("Data", typeof(byte[]));
				MemoryStream stream = new MemoryStream(data,false);
				DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
				dgImage.Load(stream);
				SetDGImage(dgImage);
			}
Example #6
0
        internal Image(SerializationInfo info, StreamingContext context)
        {
            // Do we need to Handle PixelFormats ?.
            byte[] data = null;
            data = (byte[])info.GetValue("Data", typeof(byte[]));
            MemoryStream stream = new MemoryStream(data, false);

            DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
            dgImage.Load(stream);
            SetDGImage(dgImage);
        }
Example #7
0
        public Bitmap(Type type, String resource)
        {
            Stream stream = GetManifestResourceStream(type, resource);

            if (stream == null)
            {
                throw new ArgumentException(S._("Arg_UnknownResource"));
            }
            try
            {
                DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
                dgImage.Load(stream);
                SetDGImage(dgImage);
            }
            finally
            {
                stream.Close();
            }
        }
Example #8
0
	/// <summary>
	/// <para>Constructs a new <see cref="T:Xsharp.Image"/> instance
	/// that represents an off-screen image that was loaded
	/// from a file.</para>
	/// </summary>
	///
	/// <param name="screen">
	/// <para>The screen upon which to create the new pixmap.</para>
	/// </param>
	///
	/// <param name="filename">
	/// <para>The file to load the image from.</para>
	/// </param>
	///
	/// <exception cref="T:System.ArgumentNullException">
	/// <para>The <paramref name="filename"/> parameter is
	/// <see langword="null"/>.</para>
	/// </exception>
	///
	/// <exception cref="T:System.FormatException">
	/// <para>The image format is not recognized.</para>
	/// </exception>
	///
	/// <exception cref="T:Xsharp.XInvalidOperationException">
	/// <para>Raised if <paramref name="filename"/> could not be
	/// loaded for some reason.</para>
	/// </exception>
	public Image(Screen screen, String filename)
			{
				Display dpy;
				if(filename == null)
				{
					throw new ArgumentNullException("filename");
				}
				if(screen != null)
				{
					dpy = screen.DisplayOfScreen;
				}
				else
				{
					dpy = Application.Primary.Display;
					screen = dpy.DefaultScreenOfDisplay;
				}
				this.screen = screen;
				DotGNU.Images.Image img = new DotGNU.Images.Image();
				img.Load(filename);
				Frame frame = img.GetFrame(0);
				try
				{
					dpy.Lock();
					pixmapXImage = ConvertImage.FrameToXImage(screen, frame);
					maskXImage = ConvertImage.MaskToXImage(screen, frame);
				}
				finally
				{
					dpy.Unlock();
				}
			}
Example #9
0
	public static Image FromStream
				(Stream stream, bool useEmbeddedColorManagement)
			{
				DotGNU.Images.Image image = new DotGNU.Images.Image();
				image.Load(stream);
				return new Bitmap(image);
			}
Example #10
0
	public static Image FromFile
				(String filename, bool useEmbeddedColorManagement)
			{
				DotGNU.Images.Image image = new DotGNU.Images.Image();
				image.Load(filename);
				return new Bitmap(image);
			}
Example #11
0
	public Bitmap(Type type, String resource)
			{
				Stream stream = GetManifestResourceStream(type, resource);
				if(stream == null)
				{
					throw new ArgumentException(S._("Arg_UnknownResource"));
				}
				try
				{
					DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
					dgImage.Load(stream);
					SetDGImage(dgImage);
				}
				finally
				{
					stream.Close();
				}
			}
Example #12
0
	public Bitmap(String filename, bool useIcm)
			{
				DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
				dgImage.Load(filename);
				SetDGImage(dgImage);
			}
Example #13
0
	public Bitmap(Stream stream, bool useIcm)
			{
				DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
				dgImage.Load(stream);
				SetDGImage(dgImage);
			}
Example #14
0
 public Bitmap(String filename, bool useIcm)
 {
     DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
     dgImage.Load(filename);
     SetDGImage(dgImage);
 }
Example #15
0
 public Bitmap(Stream stream, bool useIcm)
 {
     DotGNU.Images.Image dgImage = new DotGNU.Images.Image();
     dgImage.Load(stream);
     SetDGImage(dgImage);
 }
Example #16
0
	// Load the icon contents from a stream, and then set the
	// current frame to the first one in the icon image.
	private void Load(Stream stream)
			{
				image = new DotGNU.Images.Image();
				image.Load(stream);
				frame = image.GetFrame(0);
				frameNum = 0;
			}