diff options
author | Alessio Treglia <alessio@debian.org> | 2013-10-05 15:29:30 +0100 |
---|---|---|
committer | Alessio Treglia <alessio@debian.org> | 2013-10-05 15:29:30 +0100 |
commit | e51f2bbb5a0f25b37330891d769b996a2c13d277 (patch) | |
tree | 25d429c588012a476c15b6ca5b4bf393613beca3 /src/page.vala | |
parent | 438230655b539ad6aa15b017a792cab8ca7f6d89 (diff) | |
parent | 2d71d20a62ca8f6989d86db58ce64c7a862675dd (diff) |
Merge tag 'upstream/3.10.0'
Upstream version 3.10.0
Diffstat (limited to 'src/page.vala')
-rw-r--r-- | src/page.vala | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/page.vala b/src/page.vala index 3bf34d7..f27258c 100644 --- a/src/page.vala +++ b/src/page.vala @@ -63,6 +63,7 @@ public class Page public signal void scan_line_changed (); public signal void scan_direction_changed (); public signal void crop_changed (); + public signal void scan_finished (); public Page (int width, int height, int dpi, ScanDirection scan_direction) { @@ -199,6 +200,7 @@ public class Page if (size_has_changed) size_changed (); scan_line_changed (); + scan_finished (); } public ScanDirection get_scan_direction () @@ -541,6 +543,13 @@ public class Page return pixels; } + public void set_pixels (uchar[] new_pixels) + { + pixels = new_pixels; + has_data_ = new_pixels != null; + pixels_changed (); + } + // FIXME: Copied from page-view, should be shared code private uchar get_sample (uchar[] pixels, int offset, int x, int depth, int n_channels, int channel) { @@ -674,8 +683,16 @@ public class Page /* Encode into base64 */ return Base64.encode ((uchar[]) contents.to_utf8 ()); } + + public void copy_to_clipboard (Gtk.Window window) + { + Gdk.Display display = window.get_display (); + Gtk.Clipboard clipboard = Gtk.Clipboard.get_for_display (display, Gdk.SELECTION_CLIPBOARD); + var image = get_image (true); + clipboard.set_image(image); + } - public void save (string type, File file) throws Error + public void save (string type, int quality, File file) throws Error { var stream = file.replace (null, false, FileCreateFlags.NONE, null); var writer = new PixbufWriter (stream); @@ -687,9 +704,10 @@ public class Page if (strcmp (type, "jpeg") == 0) { - /* ICC profile is awaiting review in gtk2+ bugzilla */ - string[] keys = { "quality", /* "icc-profile", */ null }; - string[] values = { "90", /* icc_profile_data, */ null }; + string[] keys = { "quality", "density-unit", "x-density", "y-density", "icc-profile", null }; + string[] values = { "%d".printf (quality), "dots-per-inch", "%d".printf (dpi), "%d".printf (dpi), icc_profile_data, null }; + if (icc_profile_data == null) + keys[4] = null; writer.save (image, "jpeg", keys, values); } else if (strcmp (type, "png") == 0) |