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(); }
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(); }
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 ); }
public RemoveLayerAction( ImageInfo image, int index, Layer layer ) : base(image) { myLayerIndex = index; myLabel = layer.Label; myPixels = (Pixel[,]) layer.Pixels.Clone(); }
public EditLayerAction( ImageInfo image, Layer layer ) : base(image) { myLayerIndex = image.Layers.IndexOf( layer ); myPixels = (Pixel[,]) layer.Pixels.Clone(); }
public EditAction( ImageInfo image ) { Image = image; PreviousAction = null; NextAction = null; }
public AddLayerAction( ImageInfo image, Layer layer ) : base(image) { myLayerIndex = image.Layers.IndexOf( layer ); myLabel = layer.Label; }
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; }
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; }
private void ChangeImage( ImageInfo image ) { canvasTabs.SelectedIndex = myCurrentImages.IndexOf( image ); canvasTabs_SelectedIndexChanged( null, null ); }