override public bool Execute() { bool nonEmpty; var rectangle = ActiveImage.Selection.Bounds(out nonEmpty); if (nonEmpty) { ActiveDrawable.EditCopy(); ActiveDrawable.EditPaste(false); ActiveImage.FloatingSelection.Offsets = new Offset(rectangle.X1, rectangle.Y1); var layer = ActiveImage.FloatingSelection.ToLayer(); // Fix me: why can't I use layer here? var dummy = new Layer(ActiveImage.ActiveDrawable) { Name = "Layer 1" }; dummy.ResizeToImageSize(); } else { var image = ActiveImage; var layer = new Layer(SelectedLayer) { Name = "Layer 1" }; image.InsertLayer(layer, 0); image.ActiveLayer = layer; SelectedLayer = layer; } return(true); }
override public bool Execute() { // TODO: check if pattern "Clipboard" is actually available ActiveDrawable.EditCopy(); Context.Pattern = new Pattern("Clipboard"); return(true); }
override public bool Execute() { // Look for script-fu-selection-to-pattern as example. The basic idea // is to create a new image and save it as a .pat file var selection = ActiveImage.Selection; bool nonEmpty; var bounds = selection.Bounds(out nonEmpty); int width = bounds.Width; int height = bounds.Height; var image = new Image(width, height, ActiveImage.BaseType); var layer = new Layer(image, "test", width, height, ImageType.Rgb, 100, LayerModeEffects.Normal); image.InsertLayer(layer, 0); Console.WriteLine("{0} {1}", image.Width, image.Height); ActiveDrawable.EditCopy(); layer.EditPaste(true); string filename = Gimp.Directory + System.IO.Path.DirectorySeparatorChar + "patterns" + System.IO.Path.DirectorySeparatorChar + _name + ".pat"; image.Save(RunMode.Noninteractive, filename, filename); // Fix me: next lines should work so we can actually set the name // of the pattern! // Procedure procedure = new Procedure("file_pat_save"); // procedure.Run(image, layer, filename, filename, _name); image.Delete(); PatternList.Refresh(); return(false); }
override public bool Execute() { ActiveDrawable.EditCopy(); return(true); }