Пример #1
0
        // Don't use this unless you know exactly what you are doing
        internal void SetParent(ExifContent adoptor)
        {
            // NOTE this api is ugly but the check prevent the parent state
            // from getting confused.  See ExifContent Add and Remove for the
            // other half.
            if (parent != null && parent.Contains(this))
            {
                parent.Remove(this);
            }

            if (adoptor != null && !adoptor.Contains(this))
            {
                adoptor.Add(this);
            }

            parent = adoptor;
        }
Пример #2
0
		public ExifEntry (ExifContent parent, Tag tag)
		{
			handle = new HandleRef (this, exif_entry_new ());
			parent.Add (this);
			this.Reset (tag);
		}
Пример #3
0
		internal ExifEntry (ExifContent parent, IntPtr native) : base (native)
		{
			this.handle = new HandleRef (this, native);
			this.parent = parent;
			exif_entry_ref (this.handle);
		}
Пример #4
0
		// Don't use this unless you know exactly what you are doing
		internal void SetParent (ExifContent adoptor) {
			// NOTE this api is ugly but the check prevent the parent state 
			// from getting confused.  See ExifContent Add and Remove for the 
			// other half.
			if (parent != null && parent.Contains (this))
				parent.Remove (this);

			if (adoptor != null && !adoptor.Contains (this))
				adoptor.Add (this);
			
			parent = adoptor;
		}
    public static void SaveJpeg(Pixbuf pixbuf, string path, int quality, Exif.ExifData exif_data)
    {
        Pixbuf temp = null;

        if (pixbuf.HasAlpha)
        {
            temp   = Flatten(pixbuf);
            pixbuf = temp;
        }

        // The DCF spec says thumbnails should be 160x120 always
        Pixbuf thumbnail = ScaleToAspect(pixbuf, 160, 120);

        byte [] thumb_data = Save(thumbnail, "jpeg", null, null);
        exif_data.Data = thumb_data;
        thumbnail.Dispose();

        // Most of the things we will set will be in the 0th ifd
        Exif.ExifContent content = exif_data.GetContents(Exif.Ifd.Zero);

        // reset the orientation tag the default is top/left
        content.GetEntry(Exif.Tag.Orientation).Reset();

        // set the write time in the datetime tag
        content.GetEntry(Exif.Tag.DateTime).Reset();

        // set the software tag
        content.GetEntry(Exif.Tag.Software).SetData(FSpot.Defines.PACKAGE + " version " + FSpot.Defines.VERSION);

        byte [] data = exif_data.Save();
        FPixbufJpegMarker [] marker = new FPixbufJpegMarker [0];
        bool result = false;

        unsafe {
            if (data.Length > 0)
            {
                fixed(byte *p = data)
                {
                    marker            = new FPixbufJpegMarker [1];
                    marker [0].type   = 0xe1;                   // APP1 marker
                    marker [0].data   = p;
                    marker [0].length = data.Length;

                    result = f_pixbuf_save_jpeg(pixbuf.Handle, path, quality, marker, marker.Length);
                }
            }
            else
            {
                result = f_pixbuf_save_jpeg(pixbuf.Handle, path, quality, marker, marker.Length);
            }
        }

        if (temp != null)
        {
            temp.Dispose();
        }

        if (result == false)
        {
            throw new System.Exception("Error Saving File");
        }
    }
Пример #6
0
 public ExifEntry(ExifContent parent, Tag tag)
 {
     handle = new HandleRef(this, exif_entry_new());
     parent.Add(this);
     this.Reset(tag);
 }
Пример #7
0
 internal ExifEntry(ExifContent parent, IntPtr native) : base(native)
 {
     this.handle = new HandleRef(this, native);
     this.parent = parent;
     exif_entry_ref(this.handle);
 }