Class that contains data for the Read event.
Inheritance: System.EventArgs
示例#1
0
 private void CollectionScriptRead(object sender, ScriptReadEventArgs arguments)
 {
   switch (arguments.Id)
   {
     case "icon":
       arguments.Image = new MagickImage(Files.MagickNETIconPNG, arguments.Settings);
       break;
     case "snakeware":
       arguments.Image = new MagickImage(Files.SnakewarePNG, arguments.Settings);
       break;
     default:
       throw new NotImplementedException(arguments.Id);
   }
 }
示例#2
0
    private MagickImage CreateMagickImage(XmlElement element)
    {
      Throw.IfNull(nameof(element), element);

      MagickImage image = null;

      MagickReadSettings settings = CreateReadSettings((XmlElement)element.SelectSingleNode("readSettings"));

      string fileName = element.GetAttribute("fileName");
      if (!string.IsNullOrEmpty(fileName))
      {
        if (settings != null)
          image = new MagickImage(fileName, settings);
        else
          image = new MagickImage(fileName);
      }
      else
      {
        if (Read == null)
          throw new InvalidOperationException("The Read event should be bound when the fileName attribute is not set.");

        string id = element.GetAttribute("id");

        ScriptReadEventArgs eventArgs = new ScriptReadEventArgs(id, settings);

        Read(this, eventArgs);

        if (eventArgs.Image == null)
          throw new InvalidOperationException("The Image property should not be null after the Read event has been raised.");

        image = eventArgs.Image;
      }

      Execute(element, image);

      return image;
    }
示例#3
0
 private void Script_ReadNothing(object sender, ScriptReadEventArgs arguments)
 {
 }
示例#4
0
 private void ResizeScriptRead(object sender, ScriptReadEventArgs arguments)
 {
   arguments.Image = new MagickImage(Files.ImageMagickJPG, arguments.Settings);
   Assert.AreEqual("64x64", arguments.Image.GetDefine(MagickFormat.Jpeg, "size"));
 }
示例#5
0
 private void EventsScriptRead(object sender, ScriptReadEventArgs arguments)
 {
   Assert.AreEqual("read.id", arguments.Id);
   arguments.Image = new MagickImage(Files.SnakewarePNG, arguments.Settings);
 }
示例#6
0
 private void DefinesScriptRead(object sender, ScriptReadEventArgs arguments)
 {
   arguments.Image = new MagickImage(Files.InvitationTif, arguments.Settings);
   Assert.IsNull(arguments.Image.GetAttribute("exif:PixelXDimension"));
 }
示例#7
0
 private static void OnScriptRead(object sender, ScriptReadEventArgs arguments)
 {
   arguments.Image = new MagickImage(SampleFiles.SnakewareJpg);
 }