From 6c44d8f35b2acbfbedab1ea4545d4857d23da022 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 21 Jan 2005 01:11:41 +0000 Subject: Initial checkin --- AssemblyInfo.cs | 33 +++ GfxEd8.PaletteForm.resources | Bin 0 -> 4791 bytes GfxEdInterface.cmbx | 16 ++ GfxEdInterface.cs | 593 +++++++++++++++++++++++++++++++++++++++++++ GfxEdInterface.prjx | 26 ++ 5 files changed, 668 insertions(+) create mode 100644 AssemblyInfo.cs create mode 100644 GfxEd8.PaletteForm.resources create mode 100644 GfxEdInterface.cmbx create mode 100644 GfxEdInterface.cs create mode 100644 GfxEdInterface.prjx diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs new file mode 100644 index 0000000..965e66d --- /dev/null +++ b/AssemblyInfo.cs @@ -0,0 +1,33 @@ +// $Id$ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes specify the key for the sign of your assembly. See the +// .NET Framework documentation for more information about signing. +// This is not required, if you don't want signing let these attributes like they're. +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] diff --git a/GfxEd8.PaletteForm.resources b/GfxEd8.PaletteForm.resources new file mode 100644 index 0000000..92f7b22 Binary files /dev/null and b/GfxEd8.PaletteForm.resources differ diff --git a/GfxEdInterface.cmbx b/GfxEdInterface.cmbx new file mode 100644 index 0000000..e595ec8 --- /dev/null +++ b/GfxEdInterface.cmbx @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GfxEdInterface.cs b/GfxEdInterface.cs new file mode 100644 index 0000000..2491a08 --- /dev/null +++ b/GfxEdInterface.cs @@ -0,0 +1,593 @@ +// GfxEd interface +// Copyright (C) 2004 Ian Cowburn +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// $Id$ +// +using System; +using System.Collections; +using System.Drawing; +using System.Windows.Forms; +using System.IO; + +namespace GfxEdInterface +{ + /// + /// Defines the interface a plugin must follow + /// + public interface IPlugin + { + /// + /// The description for this plugin + /// + string Description {get;} + + /// + /// The short name (for drop down list use) of this plugin + /// + string ShortName {get;} + + /// + /// The copyright and author information for this plugin + /// + string Author {get;} + + /// + /// The URL where this plugin can be found + /// + string URL {get;} + + /// + /// The maximum number of colours for a sprite + /// + uint MaxColours {get;} + + /// + /// The machines palette. Sprite colours are selected from this. + /// + /// + /// Note that colour zero is considered the transparent/background + /// colour and cannot be selected for drawing. On platforms where the + /// actual colour could be used, duplicate it and weight your palette + /// routines when outputing accordingly. + /// + Colour[] Palette {get;} + + /// + /// An array indicating that that colour in the sprite can be changed. + /// + bool[] SprPalEditable {get;} + + /// + /// An array indicating that that colour in the sprite is common to all. + /// + bool[] SprPalCommon {get;} + + /// + /// The allowable sprite sizes. + /// + SpriteSize[] AllowedSizes {get;} + + /// + /// The default extension for exports + /// + string ExportExtension {get;} + + /// + /// Exports the sprites. + /// + /// The exported filename + /// A list of sprites to export + /// + bool Export(string path, SpriteList sprites); + + /// + /// Get the configuration object for the plugin. + /// + /// + /// If there is no configuration required for the plugin, null can be + /// returned. + /// + IConfig Config {get;} + + /// + /// Get the processing object for the plugin. + /// + /// + /// If there is no processing supplied by the plugin, null can be + /// returned. + /// + IProcess Process {get;} + } + + + /// + /// Defines the configuration interface for a plugin. + /// + public interface IConfig + { + /// + /// Shows the configuration dialog. + /// + void Settings(Form parent); + + /// + /// Outputs the configuration to the suppluied stream. + /// + /// + /// All file operations are done using text files. + /// + /// The output stream + void Output(TextWriter stream); + + /// + /// Inputs the configuration from the suppluied stream. + /// + /// + /// All file operations are done using text files. + /// + /// The output stream + void Input(TextReader stream); + } + + + /// + /// Defines the processing interface for a plugin. + /// + public interface IProcess + { + /// + /// Process the sprite. + /// + void Single(Sprite s); + + /// + /// Process all the sprites. + /// + void All(SpriteList s); + } + + + /// + /// Defines the allowable sizes for a sprite and their aspect ratios + /// + public class SpriteSize + { + public SpriteSize(uint w, uint h, uint xaspect, uint yaspect) + { + m_width=w; + m_height=h; + m_xaspect=xaspect; + m_yaspect=yaspect; + } + + public uint Width {get {return m_width;}} + public uint Height {get {return m_height;}} + public uint XAspect {get {return m_xaspect;}} + public uint YAspect {get {return m_yaspect;}} + + public override string ToString() + { + return m_width.ToString()+","+m_height.ToString(); + } + + private uint m_width; + private uint m_height; + private uint m_xaspect; + private uint m_yaspect; + } + + + /// + /// Describes a colour. And yes, a *very* dumb class name. + /// + public class Colour + { + public Colour(string name, byte red, byte green, byte blue) + { + m_name=name; + m_red=red; + m_blue=blue; + m_green=green; + } + + public override string ToString() + { + return Name; + } + + public string Name + { + get {return m_name;} + set {m_name=value;} + } + + public byte Red + { + get {return m_red;} + set {m_red=value;} + } + + public byte Green + { + get {return m_green;} + set {m_green=value;} + } + + public byte Blue + { + get {return m_blue;} + set {m_blue=value;} + } + + public Color DrawCol + { + get {return Color.FromArgb(m_red,m_green,m_blue);} + } + + private string m_name; + private byte m_red; + private byte m_green; + private byte m_blue; + } + + + /// + /// Describes a sprite + /// + public class Sprite + { + public Sprite(string name, uint width, uint height, uint maxcol) + { + m_name=name; + m_width=width; + m_height=height; + m_data=new uint[m_width,m_height]; + m_pal=new uint[maxcol]; + + for(uint f=0;f=0 && nx=0 && ny=0 && nx=0 && ny + /// Describes a list of sprites + /// + public class SpriteList : IEnumerable + { + public SpriteList() + { + m_list=new ArrayList(); + m_changed=false; + } + + public Sprite this [int i] + { + get {return (Sprite)m_list[i];} + set + { + m_list[i]=value; + m_changed=true; + } + } + + public void Add(Sprite s) + { + m_list.Add(s); + m_changed=true; + } + + public void Insert(int i, Sprite s) + { + m_list.Insert(i,s); + m_changed=true; + } + + public void RemoveAt(int i) + { + m_list.RemoveAt(i); + } + + public int Count + { + get {return m_list.Count;} + } + + public void Clear() + { + m_list.Clear(); + } + + public bool Changed + { + get {return m_changed;} + set {m_changed=value;} + } + + public IEnumerator GetEnumerator() + { + return m_list.GetEnumerator(); + } + + public void Output(TextWriter stream) + { + stream.WriteLine(m_list.Count); + + foreach (Sprite s in m_list) + { + s.Output(stream); + } + } + + public static SpriteList Input(TextReader stream) + { + SpriteList l=new SpriteList(); + int count=Convert.ToInt32(stream.ReadLine()); + + for(int f=0;f + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3