public StateImageArraySizeChangeUndoItem(DmiEXState state)
 {
     _state    = state;
     _dirCount = _state.Dirs;
     _frames   = _state.Frames;
     _images   = new DmiEXImage[(int)_dirCount, _frames];
     for (int dir = 0; dir < _images.GetLength(0); dir++)
     {
         for (int frame = 0; frame < _images.GetLength(1); frame++)
         {
             _images[dir, frame] = (DmiEXImage)_state.GetImage(dir, frame).Clone();
         }
     }
 }
Ejemplo n.º 2
0
        public Bitmap[,] CutImages(DirCount dirCount, int frames)
        {
            int frame = 0;
            int dir   = 0;
            int dirs  = (int)dirCount;

            Bitmap[,] images = new Bitmap[(int)dirs, frames];
            int x = _lastOffset.X;

            for (int y = _lastOffset.Y; y < _fullImage.Height; y += _height)
            {
                for (; x < _fullImage.Width; x += _width)
                {
                    images[dir, frame] = CutSingleImage(new Point(x, y));
                    dir++;
                    if (dir == dirs)
                    {
                        dir = 0;
                        frame++;
                    }

                    if (frame == frames)
                    {
                        //we are done with our segment
                        int endwidth  = x + _width;
                        int endheight = y;
                        if (endwidth >= _fullImage.Width)
                        {
                            endwidth   = 0;
                            endheight += _height;
                        }

                        _lastOffset = new Point(endwidth, endheight);
                        return(images);
                    }
                }
                x = 0;
            }

            throw new ParsingException("Out of bounds on image while cutting"); //todo add details
        }
Ejemplo n.º 3
0
        public static Hotspot FromRawHotspot(RawHotspot rawHotspot, DirCount dirs)
        {
            int dirCount = (int)dirs;

            return(new Hotspot(rawHotspot.X, rawHotspot.Y, rawHotspot.Index % dirCount, rawHotspot.Index / dirCount));
        }