public override Document Create(Platform generator) { Document doc = new CharacterDocument(this); doc.Generator = generator; return(doc); }
public Page(CharacterDocument document, Size canvasSize, BitFont font, Palette palette) { this.document = document; canvas = new MemoryCanvas(canvasSize); pal = palette; pal.CollectionChanged += InternalPaletteChanged; this.Font = font; }
public virtual void ResizeCanvasWidth(Stream stream, CharacterDocument document, Canvas canvas, object state = null) { if (document.ResizeCanvas) { var width = GetWidth(stream, document, state) ?? DefaultWidth; canvas.ResizeCanvas(new Size(width, canvas.Height), false); } }
public void ResizeCanvasHeight(CharacterDocument document, Canvas canvas, int?height = null) { if (document.ResizeCanvas) { if (height == null) { height = canvas.FindEndY(CanvasElement.Default) + 1; } canvas.ResizeCanvas(new Size(canvas.Width, height.Value), true); } }
protected void FillFlags(Sauce.SauceInfo sauce, CharacterDocument document) { var info = sauce.TypeInfo as Sauce.Types.BaseText.DataTypeInfo; if (info != null) { info.ICEColors = info.HasICEColors && document.ICEColours; info.AspectRatio = info.HasAspectRatio ? (bool?)document.DosAspect : null; info.LetterSpacing = info.HasLetterSpacing ? (bool?)(document.Pages[0].Font.Width == 9) : null; info.FontName = info.HasFontName ? document.Pages[0].Font.SauceID : null; } }
public virtual void EnsureSauce(CharacterDocument document) { var sauce = document.Sauce; if (sauce == null && RequiresSauce(document)) { sauce = new Sauce.SauceInfo(); } if (sauce != null) { FillSauce(sauce, document); } document.Sauce = sauce; }
protected virtual int?GetWidth(Stream stream, CharacterDocument document, object state = null) { var sauce = document.Sauce; if (sauce != null && sauce.IsValid) { var charType = sauce.TypeInfo as Sauce.Types.Character.DataTypeInfo; if (charType != null && charType.IsValidSize) { return(charType.Width); } } return(null); }
public CharacterHandler(CharacterDocument doc, bool allowBlink = true) : base(doc) { this.Undo = new UndoManager(this); this.allowBlink = allowBlink; this.AllowEditing = doc.EditMode; this.AllowToolSelection = true; doc.Info.DosAspectChanged += Info_DosAspectChanged; doc.Info.iCEColoursChanged += Info_iCEColoursChanged; doc.ICEColoursChanged += Info_iCEColoursChanged; doc.SizeChanged += document_SizeChanged; SetupIceColours(); }
protected void FillSauceSize(Sauce.SauceInfo sauce, CharacterDocument document) { var charInfo = sauce.TypeInfo as Sauce.Types.Character.DataTypeInfo; if (charInfo != null) { charInfo.Width = (ushort)document.Pages[0].Canvas.Size.Width; charInfo.Height = (ushort)(document.Pages[0].Canvas.FindEndY(CanvasElement.Default) + 1); } /*var binaryInfo = sauce.TypeInfo as Sauce.Types.Binary.DataTypeInfo; * if (binaryInfo != null) * { * binaryInfo.Width = document.Pages[0].Canvas.Size.Width; * }*/ }
protected virtual void FillSauce(Sauce.SauceInfo sauce, CharacterDocument document) { sauce.DataType = GetSauceDataType(document); }
public virtual void Save(Stream stream, CharacterDocument document) { }
public abstract void Load(Stream fs, CharacterDocument document, CharacterHandler handler);
public virtual bool RequiresSauce(CharacterDocument document) { return(document.DosAspect || document.Use9x); }
public virtual Sauce.SauceDataType GetSauceDataType(CharacterDocument document) { return(Sauce.SauceDataType.Character); }