コード例 #1
0
ファイル: Rectangle.cs プロジェクト: unhammer/gimp-sharp
 public void WriteSlice(Image image, string path, string name, 
     bool useGlobalExtension)
 {
     var clone = new Image(image);
       clone.Crop(Width, Height, X1, Y1);
       string filename = path + System.IO.Path.DirectorySeparatorChar +
     GetFilename(name, useGlobalExtension);
       clone.Save(RunMode.Noninteractive, filename, filename);
       clone.Delete();
 }
コード例 #2
0
        public override 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;
        }
コード例 #3
0
ファイル: AdminModule.cs プロジェクト: nfink/Haven
        private Image UpdateImage(IRootPathProvider pathProvider, IRepository repository, Image image, HttpFile newImage)
        {
            if (this.HasNewImage(image, newImage))
            {
                // delete the image
                if (image != null)
                {
                    image.Delete();
                }

                // add the new image
                image = new Image() { Filename = newImage.Name };
                repository.Add(image);
                image.SaveImage(newImage.Value);
                repository.Update(image);
            }

            return image;
        }