コード例 #1
0
        public override Document Create(Platform generator)
        {
            Document doc = new CharacterDocument(this);

            doc.Generator = generator;
            return(doc);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        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;
             * }*/
        }
コード例 #10
0
 protected virtual void FillSauce(Sauce.SauceInfo sauce, CharacterDocument document)
 {
     sauce.DataType = GetSauceDataType(document);
 }
コード例 #11
0
 public virtual void Save(Stream stream, CharacterDocument document)
 {
 }
コード例 #12
0
 public abstract void Load(Stream fs, CharacterDocument document, CharacterHandler handler);
コード例 #13
0
 public virtual bool RequiresSauce(CharacterDocument document)
 {
     return(document.DosAspect || document.Use9x);
 }
コード例 #14
0
 public virtual Sauce.SauceDataType GetSauceDataType(CharacterDocument document)
 {
     return(Sauce.SauceDataType.Character);
 }