Clone in a terminal:
Commit f016764
Johan Mattsson - 2012-07-17T11:34:15+00:00
f016764adf0e1584dabcd06aa51b3784466334fcjohan.mattsson.m@gmail.com

opacity for edit point icons

Changed files (8)

Diff

diff --git a/icons/active_edit_point.png b/icons/active_edit_point.pngindex 0b0dcaf..d70f061 100644Binary files a/icons/active_edit_point.png and b/icons/active_edit_point.png differdiff --git a/icons/active_edit_point_handle.png b/icons/active_edit_point_handle.pngindex 0e82bc2..30c9186 100644Binary files a/icons/active_edit_point_handle.png and b/icons/active_edit_point_handle.png differdiff --git a/icons/edit_point.png b/icons/edit_point.pngindex 8da5bff..1e2d681 100644Binary files a/icons/edit_point.png and b/icons/edit_point.png differdiff --git a/icons/edit_point_handle.png b/icons/edit_point_handle.pngindex 5c58f4e..c93103d 100644Binary files a/icons/edit_point_handle.png and b/icons/edit_point_handle.png differdiff --git a/src/BackgroundSelection.vala b/src/BackgroundSelection.valaindex f0eb54e..737717e 100644--- a/src/BackgroundSelection.vala+++ b/src/BackgroundSelection.vala@@ -104,13 +104,13 @@ class BackgroundSelection : FontDisplay { 	} 		 	private bool draw_thumbnail (string file, double x, double y, Context cr, int box_index) {-		ImageSurface img; 		GlyphBackgroundImage bg = new GlyphBackgroundImage (file); 		File thumbnail = bg.get_thumbnail_file ();--		img = new ImageSurface.from_png ((!) thumbnail.get_path ());+		Pixbuf pixbuf = new Pixbuf.from_file (file);+		ImageSurface img = new ImageSurface.for_data (pixbuf.get_pixels (), Format.ARGB32, pixbuf.get_width (), pixbuf.get_height (), pixbuf.get_rowstride ()); 		 		if (img.status () != Cairo.Status.SUCCESS) {+			warning (@"Failed to load $file (height: $(pixbuf.get_height ()), width: $(pixbuf.get_width ()), stride: $(pixbuf.get_rowstride ()))"); 			return false; 		} @@ -152,6 +152,7 @@ class BackgroundSelection : FontDisplay { 		FileChooserDialog file_chooser; 		string file; 		ImageSurface image;+		Pixbuf pixbuf; 		 		try { 			file_chooser = new FileChooserDialog ("Add background image", MainWindow.get_current_window (), FileChooserAction.OPEN, Stock.CANCEL, ResponseType.CANCEL, Stock.OPEN, ResponseType.ACCEPT);@@ -160,12 +161,14 @@ class BackgroundSelection : FontDisplay { 			if (file_chooser.run () == ResponseType.ACCEPT) { 				// Fixa: Set file name relative to font folder 				file = file_chooser.get_filename ();--				image = new ImageSurface.from_png (file);+				pixbuf = new Pixbuf.from_file (file);+				image = new ImageSurface.for_data (pixbuf.get_pixels (), Format.ARGB32, pixbuf.get_height (), pixbuf.get_width (), pixbuf.get_rowstride ()); 				 				if (image.status () == Cairo.Status.SUCCESS) { 					Supplement.get_current_font ().add_background_image (file); 					MainWindow.get_glyph_canvas ().redraw ();				+				} else {+					warning (@"Failed to load $file (height: $(pixbuf.get_height ()), width: $(pixbuf.get_width ()), stride: $(pixbuf.get_rowstride ()))"); 				} 			} diff --git a/src/Glyph.vala b/src/Glyph.valaindex b602c3b..58d3095 100644--- a/src/Glyph.vala+++ b/src/Glyph.vala@@ -819,9 +819,9 @@ class Glyph : FontDisplay { 		if (!added && union_path != null) { 			Path p = (!) union_path; 			if (p.is_open ()) {-					p.add (xt, yt);-					active_path = p;-					added = true;+				p.add (xt, yt);+				active_path = p;+				added = true; 			} 		} 		@@ -1490,7 +1490,7 @@ class Glyph : FontDisplay { 		} 		 		g.active_path = active_path;-				+		 		return g; 	} @@ -1515,12 +1515,12 @@ class Glyph : FontDisplay { 		foreach (Line line in g.get_all_help_lines ()) { 			add_line (line.copy ()); 		}++		add_help_lines (); 				 		active_path = g.active_path; 		 		undo_list.remove_link (undo_list.last ());-		-		add_help_lines (); 	} 	 }diff --git a/src/GlyphBackgroundImage.vala b/src/GlyphBackgroundImage.valaindex a8e1536..7c0db7a 100644--- a/src/GlyphBackgroundImage.vala+++ b/src/GlyphBackgroundImage.vala@@ -66,26 +66,26 @@ class GlyphBackgroundImage { 	} 	 	private void create_png () {-		Gtk.Image img = new Gtk.Image.from_file (path);-		Pixbuf buf = img.pixbuf;+		ImageSurface img; 		Context ct;-		Bitmap mask;-		Pixmap pixmap; 		string fn = @"$path.png"; 		Font font = Supplement.get_current_font (); 		File folder = font.get_backgrounds_folder (); 		File original = File.new_for_path (fn); 		File png_image = folder.get_child (@"full_$((!)original.get_basename ())"); 		+		Pixbuf pixbuf;+		 		if (png_image.query_exists ()) { 			path = (!) png_image.get_path (); 			return; 		}++		pixbuf = new Pixbuf.from_file (path);+		img = new ImageSurface.for_data (pixbuf.get_pixels (), Format.ARGB32, pixbuf.get_width (), pixbuf.get_height (), pixbuf.get_rowstride ()); 		-		pixbuf_render_pixmap_and_mask (buf, out pixmap, out mask, 1);-		ct = cairo_create (pixmap);+		ct = new Context (img); 		ct.get_target ().write_to_png ((!) png_image.get_path ());- 		path = (!) png_image.get_path (); 	} 	diff --git a/src/PenTool.vala b/src/PenTool.valaindex 0144cbc..4dd2b89 100644--- a/src/PenTool.vala+++ b/src/PenTool.vala@@ -348,11 +348,17 @@ class PenTool : Tool { 		glyph.open_path (); 		glyph.add_new_edit_point (x, y); 		-		((!)glyph.active_path).points.last ().data.right_handle.parent.recalculate_linear_handles ();+		set_linear_handles_for_last_point (); 		 		move_selected = true; 	} +	void set_linear_handles_for_last_point () {+		Glyph glyph;+		glyph = MainWindow.get_current_glyph ();+		((!)glyph.active_path).points.last ().data.right_handle.parent.recalculate_linear_handles ();+	}+ 	void set_default_handle_positions () { 		Glyph g = MainWindow.get_current_glyph (); 		foreach (var p in g.path_list) {

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112