public void fillMemory(int[] memory) {
        int xDimSize = model.getPanelWidth();

        int xStart = model.getXnull() + model.getX() - model.getSize()/2;
        int yStart = model.getYnull() - model.getY() + model.getSize()/2;

        int	xStop = xStart + model.getSize();
        int yStop = yStart - model.getSize();

        if (xStart < - model.getSize()){
            xStart = 0;
            xStop = 0;
        }

        if (yStart > model.getPanelHeight() - 1){
            yStart = model.getPanelHeight() - 1;

        }

        if (xStop > model.getPanelWidth()){
            xStop = model.getPanelWidth();
        }

        if (yStop < 0){
            yStop = 0;
        }

        int r = 255;
        int g = 255;
        int b = 240;
        int color = (r << 16) | (g << 8) | b;


        for(int i = 0; i < memory.length; i++){
            memory[i] = color;
        }

        r = 140;
        g = 140;
        b = 140;
        color = (r << 16) | (g << 8) | b;

        for (int i = xStart; i < xStop; i++){
            if (i < 0 ) i = 0;
            for(int j = yStart; j > yStop; j--){
                memory[j* xDimSize + i] = color;
            }
        }
    }