Commit f016764
opacity for edit point icons
Changed files (8)
modifiedicons/active_edit_point.pngmodifiedicons/active_edit_point_handle.pngmodifiedicons/edit_point.pngmodifiedicons/edit_point_handle.pngmodifiedsrc/BackgroundSelection.valamodifiedsrc/Glyph.valamodifiedsrc/GlyphBackgroundImage.valamodifiedsrc/PenTool.vala
Diff
Binary files a/icons/active_edit_point.png and b/icons/active_edit_point.png differBinary files a/icons/active_edit_point_handle.png and b/icons/active_edit_point_handle.png differBinary files a/icons/edit_point.png and b/icons/edit_point.png differBinary files a/icons/edit_point_handle.png and b/icons/edit_point_handle.png differ@@ -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 ()))"); } } @@ -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 (); } }@@ -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 (); } @@ -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) {