Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C#

Name: Anonymous 2011-09-12 7:59

C/C++

memcpy(Screen, Pixels, Width*Height);


C#

using System;

using System.Collections.Generic;

using System.Text;

using System.Diagnostics;

using System.Drawing;

using System.Drawing.Imaging;

using System.Drawing.Drawing2D;

using System.IO;

using System.Runtime.InteropServices;

using IlbEditorNet;





namespace AoWGraphics

{

    public class AowRect

    {

        int top;

        int left;

        int right;

        int bottom;



        public int Top

        {

            get { return top; }

            set { top = value; }

        }

        public int Left

        {

            get { return left; }

            set { left = value; }

        }

        public int Right

        {

            get { return right; }

            set { right = value; }

        }

        public int Bottom

        {

            get { return bottom; }

            set { bottom = value; }

        }



        public int Width

        {

            get { return right - left + 1; }           

        }

        public int Height

        {

            get { return bottom - top + 1; }

        }   



        public AowRect()

        {

        }



        public AowRect(int top, int left, int right, int bottom)

        {

            Set(top, left, right, bottom);

        }



        public void Set(int top, int left, int right, int bottom)

        {

            this.top = top;

            this.left = left;

            this.right = right;

            this.bottom = bottom;

        }



        public void Set(AowRect rect)

        {

            this.top = rect.top;

            this.left = rect.left;

            this.right = rect.right;

            this.bottom = rect.bottom;

        }



        public bool IsValid()

        {

            return right > left && bottom > top;

        }

    }

   


    public abstract class  AoWBitmap : IDisposable, ICloneable

    {   

        // used by editor

        protected Bitmap _original = null;

        protected Bitmap _resized = null;

        protected Int32 _cX;

        protected Int32 _cY;



        protected ScalingType _scalingType = ScalingType.None;

        protected InterpolationMode _interpolationMode = InterpolationMode.High;

        protected float _scalingFactor = 1.0f;

        protected Int32 _scaleXTo;

        protected Int32 _scaleYTo;

        protected bool _dropTransparent = false;

        protected Int32 _dropThreshold = 16;

       

        public Bitmap Original

        {

            get { return _original; }

            set { _original = value; }

        }

        public Bitmap Resized

        {

            get { return _resized; }

            set { _resized = value; }

        }

        public Int32 CX

        {

            get { return _cX; }

            set { _cX = value; }

        }

        public Int32 CY

        {

            get { return _cY; }

            set { _cY = value; }

        }

       

        public ScalingType ScalingType

        {

            get { return _scalingType; }

            set

            {

                _scalingType = value;

                if (_scalingType == ScalingType.None || _scalingType == ScalingType.Fixed)

                    _scalingFactor = 1.0f;

            }

        }

        public InterpolationMode InterpolationMode

        {

            get { return _interpolationMode; }

            set { _interpolationMode = value; }

        }

        public float ScalingFactor

        {

            get { return _scalingFactor; }

            set { _scalingFactor = value; }

        }

        public Int32 ScaleXTo

        {

            get { return _scaleXTo; }

            set { _scaleXTo = value; }

        }

        public Int32 ScaleYTo

        {

            get { return _scaleYTo; }

            set { _scaleYTo = value; }

        }

        public bool DropTransparent

        {

            get { return _dropTransparent; }

            set { _dropTransparent = value; }

        }

        public Int32 DropThreshold

        {

            get { return _dropThreshold; }

            set { _dropThreshold = value; }

        }

               

        // used to encode

        protected AoWImageType _imageType = AoWImageType.Type02_RLESprite08_0x02;

        protected AoWImageSubType _subType = AoWImageSubType.SubType03;

        protected String _name;

        protected Int32 _imageNumber;

        protected Int32 _instanceNumber;

        protected Int32 _imageDataSize;

        protected Int32 _imageDataOffset;

        protected Int32 _numPalette;

        protected AowRect _boundingBox = new AowRect();       

        protected UInt32 _originalBackgroundColour = 0;

        protected UInt32 _resizedBackgroundColour = 0;



        protected Int32 _xShift;

        protected Int32 _yShift;

        protected AoWAutoShift _autoShift = AoWAutoShift.None;

        protected AoWLoadMode _loadMode = AoWLoadMode.lmWhenUsed;

        // used for blend

        protected AoWShowMode _showMode = AoWShowMode.smOpaque;

        protected AoWBlendMode _blendMode = AoWBlendMode.bmAlpha;

        protected Int32 _blendValue = 0;



        // force this value for type 17 and 18

        // because I don't  know its meaning

        protected AoWClipXHack _clipXHack = AoWClipXHack.None;



        // subimage list

        protected List<AoWBitmap> _subImageList = new List<AoWBitmap>();

       

        public AoWImageType ImageType

        {

            get { return _imageType; }

            set { _imageType = value; }

        }

        public AoWImageSubType SubType

        {

            get { return _subType; }

            set { _subType = value; }

        }

        public String Name

        {

            get { return _name; }

            set { _name = value; }

        }

        public Int32 ImageNumber

        {

            get { return _imageNumber; }

            set { _imageNumber = value; }

        }

        public Int32 InstanceNumber

        {

            get { return _instanceNumber; }

            set { _instanceNumber = value; }

        }

        public Int32 ImageDataSize

        {

            get { return _imageDataSize; }

            set { _imageDataSize = value; }

        }

        public Int32 ImageDataOffset

        {

            get { return _imageDataOffset; }

            set { _imageDataOffset = value; }

        }

        public Int32 NumPalette

        {

            get { return _numPalette; }

            set { _numPalette = value; }

        }       

        public AowRect BoundingBox

        {

            get { return _boundingBox; }

            set { _boundingBox = value; }

        }

        public UInt32 OriginalBackgroundColour

        {

            get { return _originalBackgroundColour; }

            set { _originalBackgroundColour = value; }

        }

        public UInt32 ResizedBackgroundColour

        {

            get { return _resizedBackgroundColour; }

            set { _resizedBackgroundColour = value; }

        }

        public Int32 XShift

        {

            get { return _xShift; }

            set { _xShift = value; }

        }

        public Int32 YShift

        {

            get { return _yShift; }

            set { _yShift = value; }

        }



        public AoWLoadMode LoadMode

        {

            get { return _loadMode; }

            set { _loadMode = value; }

        }

        public AoWShowMode ShowMode

        {

            get { return _showMode; }

            set { _showMode = value; }

        }

        public AoWBlendMode BlendMode

        {

            get { return _blendMode; }

            set { _blendMode = value; }

        }

        public Int32 BlendValue

        {

            get { return _blendValue; }

            set { _blendValue = value; }

        }

        public AoWClipXHack ClipXHack

        {

            get { return _clipXHack; }

            set { _clipXHack = value; }

        }

        public AoWAutoShift AutoShift

        {

            get { return _autoShift; }

            set { _autoShift = value; }

        }

       

        public List<AoWBitmap> SubImageList

        {

            get { return _subImageList; }

        }



        // state utility

        public bool Is8bpp()

        {

            return _imageType == AoWImageType.Type01_Picture08_0x01

                || _imageType == AoWImageType.Type02_RLESprite08_0x02

                || _imageType == AoWImageType.Type03_Sprite08_0x03;

        }



        public bool IsPlain()

        {

            return _imageType == AoWImageType.Type16_Picture16_0x10

                || _imageType == AoWImageType.Type01_Picture08_0x01;

        }



        // constructors

        public AoWBitmap()

        {

            _name = string.Empty;

        }



        #region ICloneable Members



        public virtual object Clone()

        {

            throw new Exception("The method or operation is not implemented.");

        }



        #endregion

}

Name: Anonymous 2011-09-12 16:31

GC is great.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List