Jump to content

I want to creat a plugin for animation of PNG


Zammy
 Share

Recommended Posts

As such I want to create a plugin which will animate a PNG.

It will draw in a different part of the PNG for certain time on a separate window.

I downloaded the Effects Plug-in Template but I do not want to manipulate the canvas directly. Just take parts of it and draw it in a separate window. Can I create this through this Template? I am new to plug-in programming and programming in general but am pretty comfortable with C# and I think I can manage.

Hints and advice well appreciated! :)

Link to comment
Share on other sites

Here is some sample-code:

using System;
using System.Collections.Generic;
using System.Text;
using PaintDotNet;
using PaintDotNet.Data;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace Paint.NET_FileType1
{
   public class MyFileType : FileType
   {
       public MyFileType()
           : base("Text Document",
               FileTypeFlags.SupportsLoading | FileTypeFlags.SupportsSaving,
               new String[] { ".txt" })
       {
       }

       protected override Document OnLoad(Stream input)
       {
           try
           {
               Bitmap b = new Bitmap(500, 500);

               return Document.FromImage(;
           }
           catch
           {
               MessageBox.Show("Problem Importing File");

               Bitmap b = new Bitmap(500, 500);
               return Document.FromImage(;
           }
       }

       protected override void OnSave(Document input, Stream output, SaveConfigToken token,
           Surface scratchSurface, ProgressEventHandler callback)
       {
           RenderArgs ra = new RenderArgs(new Surface(input.Size));
           input.Render(ra);

           Form f = new Form();
           PictureBox p = new PictureBox();
           p.Image = ra.Bitmap;
           f.Controls.Add(p);
           f.ShowDialog();
       }
   }

   public class MyFileTypeFactory : IFileTypeFactory
   {
       public FileType[] GetFileTypeInstances()
       {
           return new FileType[] { new MyFileType() };
       }
   }
}

KaHuc.png
Link to comment
Share on other sites

Thank you for the code but is not clear what I am supposed to do with it. Its not commented either.

Anyway I have started working with the Effect Template from Sepcot and I have done the UI Dialog box asking the user about input.

Problem is after that when I try to render the animation into a new window things start getting nasty a little bit. I read in http://www.boltbait.com/pdn/codelab/help/overview.html that the Render method is called many times with different rectangle parts of the selected area. What I need is after the user has inputted his preference to just start a new Form with the whole surface inputted as Bitmap class. From there on I think I have written my Form class to dispaly the animation.

Where to put my code after I have the input from the user? I have tried using the Render function but its called continuously which is not what I need.

Thank you for your help.

Link to comment
Share on other sites

You code snippet does not seem to run correct or I am not doing something right.

I open a file with this plug-in. (I select from the drop-down menu when I open a file that it is with my file type).

Then I try to save it and expect a new form to show up with the context of it inside a picture box right? Well it does not.

I tried with save or save as. I am using the express edition so I am not sure how to make my VS debug it. I am not sure if OnSave() is being called. If it is. It should make a new window but it doesn't. Why? No idea :( If you have any clues that would be great.

(Assumptions: OnSave() is called when you save the file.)

Link to comment
Share on other sites

  • 3 months later...

Hi. I'm planning to do an animation short next year. I'll be doing it mostly in my computer using Creatoon and Pencil. But I don't know what's the screen size and the resolution to be used in order to export the animation to film or dvd. What is the best resolution and the size of the screen - in DPI, to be used to export my animation?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...