summaryrefslogtreecommitdiff
path: root/src/page.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/page.vala')
-rw-r--r--src/page.vala26
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)