public void flattenSelection()
    {
        if (selection.width == 0 || selection.height == 0)
            return;
        for (int x = selection.x; x < selection.width + selection.x; x++)
        {
            for (int y = selection.y; y < selection.height + selection.y; y++)
            {
                try
                {
                    drawPoint(x, y, this.selectImg[x - selection.x][y
                        - selection.y]);
                }
                catch (ArrayIndexOutOfBoundsException e)
                {}
            }
        }
    }