Beispiel #1
0
        public Canvas( ImageInfo image, ToolPanel toolInfoPanel )
        {
            myOnParentResizeHandler = new EventHandler( OnParentResize );
            myOnParentMouseEnterHandler = new EventHandler( OnParentMouseEnter );
            myOnParentDisposedHandler = new EventHandler( OnParentDisposed );

            myCurrentLayerIndex = 0;

            myMovingSelected = false;
            mySelectingPixels = false;
            myDrawingPencil = false;
            myDrawingBox = false;

            Image = image;
            myToolPanel = toolInfoPanel;

            mySelectedPixels = new bool[ image.Width, image.Height ];
            mySelectedArea = 0;
            mySelectedRegion = new Region( Rectangle.Empty );
            myScaledRegion = new Region( Rectangle.Empty );

            Size = new Size( image.Width * 8, image.Height * 8 );
            BorderStyle = BorderStyle.FixedSingle;

            DoubleBuffered = true;

            InitializeComponent();
        }
Beispiel #2
0
 public ActionAnchor( ImageInfo image )
     : base(image)
 {
     mySize = image.Size;
     myLayerLabels = image.Layers.Select( x => x.Label ).ToArray();
     myLayerPixels = image.Layers.Select( x => (Pixel[,]) x.Pixels.Clone() ).ToArray();
     myPalette = (Color[]) image.Palette.Clone();
 }
Beispiel #3
0
        public Layer( ImageInfo image, String label = null )
        {
            Image = image;

            if ( label == null )
            {
                int i = 1;
                while ( image.Layers.Exists( x => x.Label.ToLower().Equals( "layer " + i ) ) )
                    ++i;

                label = "layer " + i;
            }

            Label = label;

            Pixels = new Pixel[ Width, Height ];
            Bitmap = new Bitmap( Width, Height );

            for ( int x = 0; x < Width; ++x )
                for ( int y = 0; y < Height; ++y )
                    SetPixel( x, y, Pixel.Empty );
        }
Beispiel #4
0
 public RemoveLayerAction( ImageInfo image, int index, Layer layer )
     : base(image)
 {
     myLayerIndex = index;
     myLabel = layer.Label;
     myPixels = (Pixel[,]) layer.Pixels.Clone();
 }
Beispiel #5
0
 public EditLayerAction( ImageInfo image, Layer layer )
     : base(image)
 {
     myLayerIndex = image.Layers.IndexOf( layer );
     myPixels = (Pixel[,]) layer.Pixels.Clone();
 }
Beispiel #6
0
        public EditAction( ImageInfo image )
        {
            Image = image;

            PreviousAction = null;
            NextAction = null;
        }
Beispiel #7
0
 public AddLayerAction( ImageInfo image, Layer layer )
     : base(image)
 {
     myLayerIndex = image.Layers.IndexOf( layer );
     myLabel = layer.Label;
 }
Beispiel #8
0
 private ImageInfo OpenImage( string filePath )
 {
     ImageInfo newImage = new ImageInfo( toolPanel, filePath );
     newImage.ColourIndex = colourPalettePanel.SelectedIndex;
     newImage.ZoomScale = ZoomScale;
     canvasTabs.TabPages.Add( newImage.Tab );
     myCurrentImages.Add( newImage );
     newImage.PushState();
     ChangeImage( newImage );
     return newImage;
 }
Beispiel #9
0
 private ImageInfo CreateNewImage( int width = 16, int height = 16, string name = "untitled" )
 {
     ImageInfo newImage = new ImageInfo( toolPanel, width, height, name );
     newImage.Palette = (Color[]) colourPalettePanel.Palette.Clone();
     newImage.ColourIndex = colourPalettePanel.SelectedIndex;
     newImage.ZoomScale = ZoomScale;
     newImage.ShowGrid = showGridToolStripMenuItem.Checked;
     canvasTabs.TabPages.Add( newImage.Tab );
     myCurrentImages.Add( newImage );
     newImage.PushState();
     ChangeImage( newImage );
     return newImage;
 }
Beispiel #10
0
 private void ChangeImage( ImageInfo image )
 {
     canvasTabs.SelectedIndex = myCurrentImages.IndexOf( image );
     canvasTabs_SelectedIndexChanged( null, null );
 }