/// <summary>
        ///     Proces method that is called by the content pipeline.
        /// </summary>
        /// <remarks>
        ///     If you are using this processor without the assistance of the Content Pipeline Tool,
        ///     then the other Process(AsepriteImporterResult) overload should be used instead.
        /// </remarks>
        /// <param name="input">
        ///     The <see cref="AsepriteImporterResult"/> instance created as part
        ///     of the import process.
        /// </param>
        /// <param name="context"></param>
        /// <returns>
        ///     A new <see cref="AsepriteDocumentProcessorResult"/> instance containing the result
        ///     of the processing.
        /// </returns>
        public override AsepriteDocumentProcessorResult Process(AsepriteImporterResult input, ContentProcessorContext context)
        {
            AsepriteDocumentProcessorOptions options = new AsepriteDocumentProcessorOptions
            {
                BorderPadding        = BorderPadding,
                IgnoreEmptyFrames    = IgnoreEmptyFrames,
                InnerPadding         = InnerPadding,
                MergeDuplicateFrames = MergeDuplicateFrames,
                OnlyVisibleLayers    = OnlyVisibleLayers,
                SheetType            = SheetType,
                Spacing = Spacing
            };

            //  Read the aseprite document from the stream.
            AsepriteDocument doc;

            using (MemoryStream stream = new MemoryStream(input.Data))
            {
                using (AsepriteReader reader = new AsepriteReader(stream))
                {
                    doc = new AsepriteDocument(reader);;
                }
            }

            //  Convert the document into an AnimationProcessorResult.
            AsepriteDocumentProcessorResult result = new AsepriteDocumentProcessorResult(doc, options);

            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Creates a new <see cref="AsepriteDocumentProcessorResult"/> instance.
 /// </summary>
 /// <param name="document">
 ///     The <see cref="AsepriteDocument"/> instance that was created from processing
 ///     the Aseprite file.
 /// </param>
 /// <param name="options">
 ///     The <see cref="AsepriteDocumentProcessorOptions"/> instance containing the values
 ///     supplied by the user in the content pipeline properties window.
 /// </param>
 public AsepriteDocumentProcessorResult(AsepriteDocument document, AsepriteDocumentProcessorOptions options)
 {
     _document = document;
     Options   = options;
     GetPalette();
     GetAnimations();
     CreateTexture();
     GetSlices();
 }